PDA

View Full Version : qmake: removing --no-undefined option for libs.



davemar
6th October 2009, 13:57
I'm trying to build a library that includes some Qt4 bits, so I'm using qmake with the "TEMPLATE = lib" setting. The problem is, it automatically generates a --no-undefined option for the linker, as shown in this line from the Makefile:

LFLAGS = -Wl,--no-undefined -shared -Wl,-soname,libdm.so.1

However, as I'm linking in some other libraries, it spits out a load of "undefined reference" errors. If I manually remove the "-Wl,--no-undefined" bit from the Makefile, it all builds and links fine.

Is there a way of removing "--no-undefined" using the .pro file, rather than editing the generated Makefile?

axeljaeger
7th October 2009, 13:20
Edit the appropriate mkspec from Qt. You can find it in the mkspecs-directory of your Qt installation.

davemar
14th October 2009, 09:08
That's done the trick. I editted "g++.conf" in "/usr/share/qt4/mkspecs/common", so the line containing "QMAKE_LFLAGS += -Wl,--no-undefined" was changed to remove the --no-undefined bit.

Thanks for the help.