PDA

View Full Version : Compiling with debug symbols without needing QT debug libraries



bmesing
20th March 2006, 10:30
Hello,

I want to compile my application in debug mode so I put:

CONFIG += debug
in my .pro file. However, this drags in libQt3Support_debug.so
But I don't want to debug Qt, so I probably don't need this?! I wouldn't mind, but the debug package is 170 MB in size...

Any ideas?

System: Debian unstable
QT 4.1.1

Best regards

Ben

wysota
21st March 2006, 11:40
The debug symbols (and some other things too) reside in the debug library (that's why it's so large), so you can't have debug mode without using a library which contains routines which make debugging work.

libQt3Support is a library which implements backward compatibility with Qt3. You shouldn't need it. Try disabling it explicitely in your project file if you get linked with it.

bmesing
21st March 2006, 12:40
Thanks for your answer, but why do I need the QT debug symbols? As I said, I don't want to debug QT. I am unsure about the backtrace, perhaps they come in handy there.
I think it's a qmake thing. Even with CONFIG += debug it should allow to link against the normal QT library, and probably should do so by default.

I need the QT3 stuff, cause I've not yet ported every part of my application to QT4.

Best regards

Ben

wysota
21st March 2006, 13:45
So why do you need CONFIG += debug if you don't want to debug? "debug" means "debug", not "not debug". If you want to get rid of debugging symbols from the debug library you can issue a strip --strip-unneeded on it (just remember it is a one way operation). Debug library is not only about debugging symbols. Asserts and qDebug()s (and other things) probably sit there too.

bmesing
21st March 2006, 14:21
So why do you need CONFIG += debug if you don't want to debug? "debug" means "debug", not "not debug".
I think you are misunderstanding me. I do want to debug my application. Hence, I don't need QT's debugging symbols (which are totally irrelevant for my code), and shouldn't need to link against the debug version of the QT library.

The thing is: I don't need to have the debug version of the, say, mySQL library to be able to debug my application.

If I need the QT debug version of the library, I'd judge this to be a misdesign.


Debug library is not only about debugging symbols. Asserts and qDebug()s (and other things) probably sit there too.
Well, that would be a different beast, though I somehow doubt it. If so, I'd say that is a misdesign.


Best regards

Ben

wysota
21st March 2006, 15:22
The case with MySQL is different. With external libraries you just call that library (entry point) which does some job and returns to your code. With Qt you use inheritance, virtual methods, etc. which cause the flow to enter your code from within Qt code too (so you have entry points and exit points in Qt libs) which often makes it very valuable to have debug information about Qt library too.

If you insist on using a release library with debugging turned on, you can probably force qmake to use it by changing the contents of QMAKE_LIBS or other variables.

bmesing
22nd March 2006, 08:14
If you insist on using a release library with debugging turned on, you can probably force qmake to use it by changing the contents of QMAKE_LIBS or other variables.
Thanks, that was a good idea. Unfortunately it seems QT sets those values after processing the qmake file, so doing -= inside does not work :-(

Best regards

Ben

wysota
22nd March 2006, 08:39
Unfortunately it seems QT sets those values after processing the qmake file

It's not possible. There is no "after". "After" qmake there is only the Makefile. You must have changed the wrong variable or changed it not the correct way.

bmesing
22nd March 2006, 08:56
Well, I don't know what it is then, but I do


message("LIBS: $${LIBS}")
message("QMAKE_LIBS: $${QMAKE_LIBS}")
message("QMAKE_LIBS_QT: $${QMAKE_LIBS_QT}")

at the end of my qmake file. Both QMAKE_LIBS and QMAKE_LIBS_QT are empty, and LIBS only contains my manually defined libs.
I've also tried most of the other variables, but got only some uninteresting libraries like -lpthread, -lX11,...).
So unless I'm overlooking something, qmake must set the values after processing the qmake file. Or otherwise imply the command line options through the "config" values (without explicitly setting the variables). In both cases I have no idea how to convince QT not to link against the given library.

Best regards

Ben

ePharaoh
22nd March 2006, 09:05
well, this is a work-around.

don't put CONFIG+=debug
instead, just put -g in your CFLAGS and CXXFLAGS.

bmesing
22nd March 2006, 09:17
well, this is a work-around.

don't put CONFIG+=debug
instead, just put -g in your CFLAGS and CXXFLAGS.
Now it gets ugly :-) This way I would also lose the valuable information from my qDebug statements.
It seems that there is no sane way to not link against the debug version, so I'll leave it for now. Perhaps QT folks will change this in time. I think in QT3, there was no need to have a debug version of the libary either.

Best regards

Ben

Chicken Blood Machine
22nd March 2006, 19:06
Now it gets ugly :-) This way I would also lose the valuable information from my qDebug statements.
It seems that there is no sane way to not link against the debug version, so I'll leave it for now. Perhaps QT folks will change this in time. I think in QT3, there was no need to have a debug version of the libary either.

Best regards

Ben

Your qDebug statements will still work in release mode.