[Development] GCC-built Qt 5.6 can't be used with Clang

Hausmann Simon Simon.Hausmann at theqtcompany.com
Sat Feb 20 11:48:12 CET 2016


Hi,

Hmm, change  ‎https://codereview.qt-project.org/#/c/147846/ was supposed to fix this issue.

‎The subject of the email refers to 5.6 but in the body you say that you are building the dev branch. If it is the latter, could it be that the fix hasn't hit dev yet?

Simon

  Original Message
From: Stephen Kelly
Sent: Saturday, February 20, 2016 11:33
To: development at qt-project.org
Subject: [Development] GCC-built Qt 5.6 can't be used with Clang


Hello,

I built Qt dev branch with GCC.

Then I tried to use it to build any trivial shared library with Clang:

stephen at hal:/tmp/qmake$ make CXX=clang++ LINK=clang++ -B
makeobj[0]: Entering directory `/tmp/qmake'
/home/stephen/dev/prefix/qtbase/bin/qmake -o Makefile qmake.pro
clang++ -c -pipe -g -std=gnu++11 -std=c++11 -Wall -W -D_REENTRANT -fPIC -
DQT_CORE_LIB -I. -I/home/stephen/dev/prefix/qtbase/include -
I/home/stephen/dev/prefix/qtbase/include/QtCore -I. -
I/home/stephen/dev/prefix/qtbase/mkspecs/linux-g++ -o thelib.o thelib.cpp
rm -f libthelib.so.1.0.0 libthelib.so libthelib.so.1 libthelib.so.1.0
clang++ -Wl,-rpath,/home/stephen/dev/prefix/qtbase/lib -shared -Wl,-
soname,libthelib.so.1 -o libthelib.so.1.0.0 thelib.o  -
L/home/stephen/dev/prefix/qtbase/lib -lQt5Core -lpthread
/usr/bin/ld: thelib.o: relocation R_X86_64_32 against `qt_version_tag' can
not be used when making a shared object; recompile with -fPIC
thelib.o: error adding symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
Makefile:147: recipe for target 'libthelib.so.1.0.0' failed
make: *** [libthelib.so.1.0.0] Error 1
makeobj[0]: Leaving directory `/tmp/qmake'


1) The qt_version_tag is new in Qt 5.6, so I assume this happens with that
Qt version too.

2) If I compile with -DQT_NO_VERSION_TAGGING, then the link succeeds.

Reading the preprocessor code in qtversiontagging, I can see why.

3) Is it deliberate that GCC-built Qt can no longer be used with Clang?

I haven't seen mailing list discussion confirming that.

4) If that should still be possible, are clients expected to add their own
define of -DQT_NO_VERSION_TAGGING?

It could be added to the qmake/cmake files if so for these mixing
conditions.

Thanks,

Steve.


_______________________________________________
Development mailing list
Development at qt-project.org
http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list