Discussion:
[odb-users] Problem compiling with QT
harriev9
2016-08-04 15:53:09 UTC
Permalink
Hello,

When I compile my program (it is using QT 5.6) then i get an error
message:

/usr/include/QtCore/qglobal.h:1087:4: error: #error "You must build
your code with position independent code if Qt was built with -reduce-
relocations. " "Compile your code with -fPIC (-fPIE is not enough)."

Is it possible to compile with -fPIC and if so how do i instruct the
odb compiler to do so?

Greetings,
Harrie Versteden.
Boris Kolpackov
2016-08-05 16:13:19 UTC
Permalink
Hi Harrie,
Post by harriev9
When I compile my program (it is using QT 5.6) then i get an error
/usr/include/QtCore/qglobal.h:1087:4: error: #error "You must build
your code with position independent code if Qt was built with -reduce-
relocations. " "Compile your code with -fPIC (-fPIE is not enough)."
Is it possible to compile with -fPIC and if so how do i instruct the
odb compiler to do so?
This should not be necessary if you are using the Qt profile (-p qt).
If not, then, yes, you can pass -fPIC like this:

odb -x -fPIC ...

Here is also the relevant comment from libodb-qt/odb/qt/default/config.hxx:

// Qt5 may complain if we are building without -fPIC or -fPIE. Instead of
// asking the user to pass one of these options to the ODB compiler (which
// can, BTW, be done with -x -fPIE, for example, if one is not using the
// Qt profile), we are going to define __PIE__ ourselves just to silence
// Qt. [...]

Boris

Loading...