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

Alexander Neundorf neundorf at kde.org
Thu Oct 10 15:59:01 UTC 2013


On Wednesday 09 October 2013, Sebastian Kügler wrote:
> 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/qnamespa
> ce.h:45, from
> /home/sebas/kf5/qt5/qtbase/include/QtCore/qnamespace.h:1,
>                  from
> /home/sebas/kf5/qt5/qtbase/include/QtCore/../../src/corelib/kernel/qobjectd
> efs.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?

I think Stephens work on target properties etc. in CMake is related to 
this/should make it work. But I don't know the details.

Alex


More information about the Kde-frameworks-devel mailing list