QT5 Compilation - qglobal.h
-
Hi,
I tried to compile a qt 5.0 application. I found that it requires either -fPIC or -fPIE required to be passed even if I am building simple GUI application (Which is not a library). I checked sample test applications and they are passing -fPIE.
In Qt 4.8, this was not mandatory.
I would like to know why this has been added?
Also if i want to know if I compile without passing fPIC or fPIE?Thanks
-
Platform? Source of Qt libraries? Build system? Compiler I assume is GCC.
Assuming the mention of qglobal.h is because the "error message":http://qt.gitorious.org/qt/qtbase/blobs/stable/src/corelib/global/qglobal.h#line975 you received is:
bq. You must build your code with position independent code if Qt was built with -reduce-relocations. Compile your code with -fPIC or -fPIE.
"The commit":http://qt.gitorious.org/qt/qtbase/commit/482d96a0c5d523ace63f56bda6851926b4469dd0/diffs installed this message but also ensures the qmake uses -fPIE for applications.
I think the error message explains what you could do if you really need to avoid this: build Qt without the -reduce-relocations configure option.
-
I have the same problem and am getting the same error message. I compiled on Linux. My compilation steps are shown below. And you can see that
-reduce-relocation is not enabled. Using the example problems that install with Qt and Creator-2.8 and cmake-2.8.11. I get the error message " You must build your code with position independent code if Qt was built with -reduce-relocations". Is there a step in the build process that may be missing?git clone git://gitorious.org/qt/qt5.git qt5
cd qt5
perl init-repository --no-webkit
./configure -prefix /opt/local/Qt-5.1.1 -developer-build -opensource -nomake examples -nomake tests -no-gtkstyle
make
make install