Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt build both release and debug libraries

Tags:

I needed to install Qt SDK to Redhat backend machine which does not have a GUIs. (Amazon ec2). When I tried to install it failed due to fail to connect display.

Then I tried to download the source and compile. If I use configure -debug, it only compile debug libraries. Same as it compiles and install release binaries only if I specify -release. Also in my *.pro file it links the last installed build without considering CONFIG += debug or CONFIG += release

I need both formats. libQt5Core.so and libQt5Core.d.so. And need to link separate libs according to the CONFIG.

like image 371
Supun Induwara Avatar asked Apr 26 '16 04:04

Supun Induwara


2 Answers

I resolved the issue doing this.

  • First I configured configure -debug -qtlibinfix .d and installed.
  • Then I configured configure -release and installed again.

Now I have two binaries *.d.so for debug and *.so for release in /usr/local/Qt-5.6.0.

Then edited /usr/local/Qt-5.6.0/mkspecs/features/qt.prf and replaced

MODULE_MODULE = $$eval(QT.$${QTLIB}.module)

with

MODULE_MODULE =
    debug: MODULE_MODULE = $$eval(QT.$${QTLIB}.module).d
    else: MODULE_MODULE = $$eval(QT.$${QTLIB}.module)

If I used CONFIG += debug in *.pro file, it links with *.d.so. Otherwise it links with *.so.

like image 101
Supun Induwara Avatar answered Sep 28 '22 03:09

Supun Induwara


If you want both sets of libraries you can use the configure -debug-and-release option. Take a look at the Configuration Options for Qt for more options.

like image 24
A. Sarid Avatar answered Sep 28 '22 03:09

A. Sarid