PDA

View Full Version : Setting up Debug / Release Qt Libraries on Linux



gmat4321
4th August 2011, 21:51
I want to have both Debug and Release versions of the Qt libraries on my Linux system such that I can build both versions of my application side by side. I want to do what I can do on Windows simply by specifing either the Debug or Release build from within Qt Creator.

Nicely enough on Windows you get a .debug and .release version of your make file. I know how to use the debug/release settings in the project.pro file so I can control the compiled output of my apps code, but I'm stuck on getting the correct Qt library.

I need to be able to debug down into the Qt libraries from time to time. At this point the only way I can do this is to build two versions of the Qt environment and install them into the what appears to be the 'same' directory. I then rename the directories according to which version of the Qt libraries I want to use.

QT_INSTALL_LIBS in qmake seems to be the limiting factor. Can both the debug and release versions of the Qt libraries be in the same directory like windows? I'm not a Linux expert so I am not fully aware of what I can do with Linux libraries, etc.

gmat4321
8th August 2011, 16:26
This is my solution:

* Build and install both debug and release versions of the Qt SDK
That means I have two versions of the SDK installed. My physical directories are:


QtSDK/4.7.3
QtSDK/4.7.3-debug


* In the QtCreator Tools/Options dialog, on the Qt4 page, 'Manually' add the two directories above.
Remove the 'Qt he PATH' entry
You can also remove Qt from the PATH. QtCreator will add the qmake and tools back
into the path for you.

* From 'Edit build configuration' drop down remove extra entries so you only have the '4.7.3 Release'
and '4.7.3-debug Debug' entries.

* Make sure the 'Qt version' is correct for each build configuration. '4.7.3 Release' should be '4.7.3'
and '4.7.3-debug Debug' should be '4.7.3-debug'. If you need to change this then you probably
deleted the wrong build configuration.

* Edit 'qmake' Build Step to make sure the 'CONFIG' value is set. Expand the details,
if the 'Effective qmake call' does not include a CONFIG value, add it on the
'Additional arguments' line.

for 4.7.3-debug Debug:

CONFIG+=debug

for 4.7.3 Release

CONFIG+=release

* To make two build outputs (debug/release) you need to add the following to your .pro file:



CONFIG(release, debug|release) {
DESTDIR = release
OBJECTS_DIR = release
}else{
DESTDIR = debug
OBJECTS_DIR = debug
}


Note that the Makefile will need to be regenerated when switching build configurations, but this
appears to automatically happen.

So what you end up with is a fully debuggable version of your app including the Qt libraries and
a release version of your app with the release libraries, each in there own directory. This makes
it quick to switch back and forth between build configurations.

gmat4321
15th August 2011, 13:25
Oh, and don't forget to install the fontconfig-dev library. Depending on your Linux version if you do not include this your default Font will look really bad. For more info see here:

http://www.qtcentre.org/threads/39586-Font-problem-when-deploying-a-Qt-based-application-to-Ubuntu-10.10

bob2oneil
8th September 2011, 05:22
Are the debug libraries for 64-bit Linix available for download? I can not find anything other than release bulid for the 4.7.4 SDK