[Development] Qt-5.1, qglobal.h and PIC detection

Olivier Goffart olivier at woboq.com
Wed Nov 6 00:25:44 CET 2013

On Wednesday 06 November 2013 12:17:56 Christian Gagneraud wrote:
> Hi,
> I'm using CLang build-analize tool, and when I switched from Qt 4.8 to
> Qt 5.1 (insalled from Qt project's download area), I got a Qt #error,
> basically the code is built with -fPIC, but CLang doesn't define a PIC
> macro, so the build fails due to a check in qglobal.h (see details below).
> Is it possible to use CLang 3.2 with Qt 5.1 on Linux, or do I need to
> use amore recent verion of CLang or maybe wait for Qt 5.2?

Simply add -fPIC or -fPIE.

clang -fPIE -dM -E -x c /dev/null |grep -i 'PIC\|PIE\|ELF'

#define __ELF__ 1
#define __PIC__ 2
#define __PIE__ 2
#define __pic__ 2
#define __pie__ 2


Woboq - Qt services and support - http://woboq.com - http://code.woboq.org

More information about the Development mailing list