Hacking:Tools:QtCreator:Ubuntu

About this page
This page contains steps to:


 * Upgrade to Qt 5.7 from Qt 5.4 on 64-bit 8-processor laptop with Ubuntu 14.04. Note that Qt 5.7 contains Qt Creator 4.1.


 * Configure Qt Creator with:
 * custom compiler
 * custom compiler kit
 * system environment library variables
 * Configure Valentina project in Qt Creator to:
 * compile with custom compiler kit
 * compile for Release or Debug

Qt Creator's definitions for a custom compiler, custom compiler kit, and custom library paths may be overwritten during an upgrade.

The custom compiler & custom compiler kit are required to take advantage of multiprocessors.

The library paths are required to enable libraries to be found at run-time during qmake and make steps when compiling Valentina code.

Upgrade to Qt 5.7
Follow the instructions at Installing Qt 5.7 on Ubuntu.

If this is the first time you have installed Qt on Ubuntu, you may wish to first uninstall the Qt which is distributed with Ubuntu. Use Ubuntu's software center to uninstall all Qt entries.

Define system information
The following information is required to define the custom compiler, custom compiler kit, and system environment library variables.

Examples are given but should be confirmed for each Qt upgrade.


 * Qt Directory 				             $home/Qt/5.7/
 * Qt Creator Directory                               $home/Qt/Tools/QtCreator
 * Qt Compiler Directory 			     $home/Qt/5.7/gcc_64
 * Operating System Compiler Directory	             /usr/bin/g++
 * Qt Compiler Makespec Directory 		     $home/Qt/5.7/gcc_64/mkspecs/linux-g++-64/
 * Qt Compiler Makespec (from Makespec Directory)     linux-g++-64
 * Qt Compiler Library directory 		     $home/Qt/5.7/gcc_64/lib
 * Qt Creator Library directory 		      $home/Qt/Tools/QtCreator/lib/Qt/lib/
 * Compiler flags 				      -j4 (one-half of the 8 processors, to prevent system lockup during compilation)

To find this information:

In Qt Creator select Tools/Options/Build & Run/Compilers.


 * Look at the default compiler listed.


 * Note the directory included in the default compiler name (ex: GCC (x86 64bit in /usr/bin))


 * Note the type of the default compiler, listed under column 'Type' (ex: GCC)

In a terminal window or Nautilus file manager:


 * Qt Directory: Look in $home directory for Qt 5.7 subdirectories (ex: $home/Qt/5.7/).


 * Qt Creator Directory: Look in Qt Directory for the Tools/QtCreator subdirectory (ex: $home/Qt/5.7/Tools/QtCreator/)


 * Qt Compiler Directory: Look in Qt Directory for a subdirectory to match the compiler Type and processor (64-bit) type (ex: $home/Qt/5.7/gcc_64).


 * Operating System Compiler Directory: Look in the directory included in the default compiler name. For Ubuntu /usr/bin has both g++ and gcc. Choose 'g++' because it is 'gcc' with additional options to compile C++ code.


 * Qt Compiler Makespec Directory & Qt Makespec: Look in Qt Compiler Directory for the mkspecs subdirectory, then look for subdirectory that best matches your compiler. The Makespec is the name of the Makespec subdirectory (ex: $home/Qt/5.7/gcc_64/mkspecs/linux-g++-64/, makespec is linux-g++-64. The 'qmake.conf' file contains the makespec definitions for compiling under linux 64-bit using g++.)


 * Qt Compiler Library Directory and Qt Creator Library Directory: Run command locate libQt5Core.so.5.7. It should find this file in lib directories under the Qt Compiler Directory and Qt Creator Directory (ex: $home/Qt/5.7/gcc_64/lib and $home/Qt/Tools/QtCreator/lib/Qt/lib/).

Define custom compiler
In QT Creator select Tools/Options/Build&Run/Compilers.


 * Click on triangle next to Manual section and click Add.


 * Select your compiler type from the picklist. A new compiler entry appears in the Manual section.


 * Edit the following fields, don't include quote marks:
 * Name: Rename your compiler (ex: Multiprocessor 64-bit GCC)
 * Compiler path: Enter your Operating System Compiler Directory, don't use quote marks. (ex: usr/bin/g++)
 * Platform codegen flags: Enter in -jN format (ex: -j4)
 * ABI: Select entries which best match your compiler profile from the dropdown lists. (ex: x86-linux', 'x86', 'linux', 'generic', 'elf', '64bit)
 * Click Apply

Define custom compiler kit
Create a text file like the example below with your system directory information. Place double quotes "" around each path definition, separate directories with : symbol.

All entries will be Qt Compiler Library directory:Qt Creator Library directory except for QTDIR.

This information will be copy-pasted into Qt Creator.

Example text file:

In Qt Creator select Tools/Options/Build&Run/Kits:


 * Click on triangle next to Manual section and click Add. The 'Unnamed' compiler kit appears in the Manual section.


 * Edit the following fields, don't use quotes:


 * Name: Enter a name (ex: Manual Multiprocessor Qt 5.7.0 Gcc 64bit).


 * Compiler: Click on triangle in Compiler field and select your custom compiler.


 * Environment:


 * Click on Change button to the right of Environment.


 * Copy-paste all lines from your text file into the field. The double quotes as entered in the text file are required, do not remove them.


 * Qt version: Confirm that it reflects your build (ex: QT 5.7.0 GCC 64-bit)


 * Qt mkspec: Enter your Qt Makespec (ex: linux-g++-64)


 * Click on Apply to save, then OK to close the window.

Configure Valentina with custom compiler kit
In Qt Creator, select File/Open File or Project. The Valentina project window will open, or the Configure Project window will open.

If the Configure Project window opens:


 * Check the box next to your custom compiler kit


 * Click Configure Project at bottom of window to save and close. The Build & Run project window will open.

In the Valentina project window:


 * Click on Projects in left side menu. The Valentina Build & Run window will open.

In the Valentina Build & Run window:


 * Click on the 'Build' half of the Build | Run button near the top of the window. The 'Build' half of the button will turn light grey.


 * In Build Settings, Edit build configuration section, select Release from the picklist. ("Release" is best for building the nightly code, "Debug" is used for debugging your code if you are a code contributor to Valentina).


 * In General section, check the box next to Shadow build.


 * In Build Steps, Make section, click on Details.


 * In Make arguments enter -j4, don't use quotes.


 * In Build Environment/Use system environment section, click on Details. The list of System Environment variables will appear.


 * Add the six environment variables you added to the custom compiler kit.


 * Click Add, enter QTDIR


 * Click Add, enter LD_LIBRARY_PATH


 * Click Add, enter LD_RUN_PATH


 * Click Add, enter QMAKE_LFLAGS_RPATH


 * Click Add, enter QMAKE_RPATH


 * Click Add, enter QMAKE_RPATHDIR


 * Copy-paste the directory string for each of these variables, do not include the quote marks.


 * Double-click  next to QTDIR, copy-paste the QTDIR Directory from your text file, exclude quotes. Repeat for each added variable.


 * Click on the Manage Kits square button at top left of the window. The Tools/Options/Build & Run/Kits window will open.

In the Tools/Options/Build & Run/Kits window:


 * Click on your custom compiler kit.


 * Confirm that Compiler is your custom compiler and Qt Version is correct.


 * Click the Make Default button.


 * Click Apply then OK to save and return to the Valentina Build & Run window.

In the Valentina Build & Run window:


 * Click on the Monitor icon in the lower left side menu. A dark box appears showing three columns Project, Build, Run.


 * Under 'Project' select 'Valentina'


 * Under 'Build' select 'Release'


 * Under 'Run' select 'valentina'


 * Select File/Save All from QT Creator top bar menu.

Now smile and relax, you're done!!!!!!!!!