[odb-users] Problem compiling with QT

Boris Kolpackov boris at codesynthesis.com
Fri Aug 5 12:13:19 EDT 2016


Hi Harrie,

harriev9 <harriev9 at gmail.com> writes:

> 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?

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



More information about the odb-users mailing list