libnm-qt Qt5 port: -fPIC or fPIE needed?

Sebastian Kügler sebas at kde.org
Wed Oct 9 21:10:13 UTC 2013


Hi,

While porting libnm-qt to Qt5, I'm running into the following problem when 
building the tests. I've not seen this error before, and I'd like advice how 
to fix it.

[ 59%] Building CXX object 
tests/CMakeFiles/test_8021xsetting.dir/8021xsetting.cpp.o
In file included from /home/sebas/kf5/qt5/qtbase/include/QtCore/qglobal.h:1:0,
                 from 
/home/sebas/kf5/qt5/qtbase/include/QtCore/../../src/corelib/global/qnamespace.h:45,
                 from 
/home/sebas/kf5/qt5/qtbase/include/QtCore/qnamespace.h:1,
                 from 
/home/sebas/kf5/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qobjectdefs.h:45,
                 from 
/home/sebas/kf5/qt5/qtbase/include/QtCore/qobjectdefs.h:1,
                 from 
/home/sebas/kf5/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:48,
                 from /home/sebas/kf5/qt5/qtbase/include/QtCore/qobject.h:1,
                 from /home/sebas/kf5/qt5/qtbase/include/QtCore/QObject:1,
                 from /home/sebas/kf5/src/libnm-qt/tests/8021xsetting.h:24,
                 from /home/sebas/kf5/src/libnm-qt/tests/8021xsetting.cpp:21:
/home/sebas/kf5/qt5/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:991:4: 
error: #error "You must build your code with position independent code if Qt 
was built with -reduce-relocations. " "Compile your code with -fPIC or -fPIE."
make[2]: *** [tests/CMakeFiles/test_8021xsetting.dir/8021xsetting.cpp.o] Error 
1

This error comes up for a whole slew of tests. I've tried adding "-fpie" and 
"PIE" to the CMAKE_EXE_LINKER_FLAGS (also tried CMAKE_LIBRARY_LINKER_FLAGS) by 
just setting this variable, but to no avail. The rest of libnm-qt builds fine.

Could anyone give me a hint how to fix this?

Code is in the qt5 branch of libnm-qt.

Cheers,
-- 
sebas

http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9


More information about the Kde-frameworks-devel mailing list