[odb-users] compile error with libodb-qt module

Christian Sell christian at gsvitec.com
Tue Jun 9 10:43:25 EDT 2015


Hello Boris,
 
the lines in qglobal.h read
 
#if !defined(QT_BOOTSTRAPPED) && defined(QT_REDUCE_RELOCATIONS) &&
defined(__ELF__) && \
(!defined(__PIC__) || (defined(__PIE__) && defined(Q_CC_GNU) && Q_CC_GNU >=
500))
#  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)."

my IDE tells me that QT_REDUCE_RELOCATION, Q_CC_GNU and Q_CC_GNU are defined.
QT_REDUCE_RELOCATION is #defined right at the top of QtCore/qconfig.h.

However, the error message clearly states tat __PIE__ is not enough, and that is
what you set in your header. I first assumed this was the problem, but found
that adding -x -fPIE to my odb command line fixed the problem.. mysterious.

let me know where else to look,
Christian
 

> Boris Kolpackov <boris at codesynthesis.com> hat am 9. Juni 2015 um 15:52
> geschrieben:
>
>
> Hi Christian,
>
> Christian Sell <christian at gsvitec.com> writes:
>
> > I am setting up a fresh development environment with ODB 2.4, Linux Mint 17
> > and
> > Qt 5.4.2 (64 bit). Not that this is the fist time that I have done
> > seomething
> > similar - but this is the first time I see the following error message when
> > compiling the libodb-qt module:
> >
> > QtCore/qglobal.h:1052: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)."
> > # error "You must build your code with position independent code if Qt was
> > built
> > with -reduce-relocations. "\
> >
> > I was able to fix that by setting the CXXFLAGS environment variable to
> > "-fPIC"
> > before doing the ./configure. However, now when compiling my own code, I am
> > getting the same message when the ODB compiler is invoked - and I have not
> > been
> > able to figure out how to mend this. Can anybody hint as to the reason why
> > this
> > occurs, and how to deal with it?
>
> I assume you have the Qt profile enabled when running the ODB compiler.
> If so, libodb-qt tries to take care of this: see odb/qt/details/config.hxx
> for how and a detailed explanation of what's going on. But I guess
> the Qt folks changed something in more recent versions of Qt so that
> whatever we are doing no longer works. Would you be able to try and
> figure out why?
>
> Specifically, take a look into QtCore/qglobal.h:1052 and see why
> defining __PIE__ is no longer sufficient. Also, maybe Qt no longer
> defines QT_REDUCE_RELOCATIONS?
>
> Thanks,
> Boris


More information about the odb-users mailing list