[Interest] Qt 5.5 LTO build on OS X 10.9 ... llvm-ar creates unusable bootstrap.a?

René J. V. Bertin rjvbertin at gmail.com
Fri Sep 11 22:54:50 CEST 2015


Thiago Macieira wrote:

> I've only ever tested LTO builds on Linux. That's where llvm-ar comes from --
> the *official* clang + LLVM build.

OK, so I tinkered with clang.conf such that a build using MacPort's clang-3.6 
(clang++-mp-3.6) also uses the corresponding llvm-ar-mp-3.6 and llvm-nm-mp-3.6 ,
and qmodule.pri to make sure that clang++-mp-3.6 is the command used for linking 
(crucial for a LTO build with clang).

Now, I'm seeing this failure:

/opt/local/bin/llvm-ar-mp-3.6 cqs libQt5Bootstrap.a .obj/qcore_mac_objc.o 
.obj/qstring_mac.o .obj/qstandardpaths_mac.o .obj/qlatincodec.o 
.obj/qtextcodec.o .obj/qutfcodec.o .obj/qglobal.o .obj/qlogging.o .obj/qmalloc.o 
.obj/qnumeric.o .obj/qabstractfileengine.o .obj/qbuffer.o .obj/qdatastream.o 
.obj/qdebug.o .obj/qdir.o .obj/qdiriterator.o .obj/qfile.o .obj/qfileinfo.o 
.obj/qfilesystementry.o .obj/qfilesystemengine.o .obj/qfsfileengine.o 
.obj/qfsfileengine_iterator.o .obj/qiodevice.o .obj/qfiledevice.o 
.obj/qtemporaryfile.o .obj/qtextstream.o .obj/qstandardpaths.o 
.obj/qloggingcategory.o .obj/qloggingregistry.o .obj/qcoreapplication.o 
.obj/qcoreglobaldata.o .obj/qmetatype.o .obj/qvariant.o .obj/qsystemerror.o 
.obj/quuid.o .obj/qbitarray.o .obj/qbytearray.o .obj/qarraydata.o 
.obj/qbytearraymatcher.o .obj/qcommandlineparser.o .obj/qcommandlineoption.o 
.obj/qcryptographichash.o .obj/qdatetime.o .obj/qhash.o .obj/qlist.o 
.obj/qlinkedlist.o .obj/qlocale.o .obj/qlocale_tools.o .obj/qmap.o 
.obj/qregexp.o .obj/qpoint.o .obj/qrect.o .obj/qsize.o .obj/qline.o 
.obj/qstring.o .obj/qstring_compat.o .obj/qstringlist.o .obj/qvector.o 
.obj/qvsnprintf.o .obj/qxmlutils.o .obj/qxmlstream.o .obj/qjson.o 
.obj/qjsondocument.o .obj/qjsonobject.o .obj/qjsonarray.o .obj/qjsonvalue.o 
.obj/qjsonparser.o .obj/qjsonwriter.o .obj/qdom.o .obj/qxml.o 
.obj/qfilesystemengine_unix.o .obj/qfilesystemiterator_unix.o 
.obj/qfsfileengine_unix.o .obj/qcoreapplication_mac.o .obj/qcore_mac.o
rm -f ../../../lib/libQt5Bootstrap.a
mv -f libQt5Bootstrap.a ../../../lib/ 
...
gmake[3]: Entering directory '/opt/local/var/macports/build/qt5-kde-devel/qt5-
kde-devel-x11/work/build/qtbase/src/tools/moc'
/opt/local/var/macports/build/qt5-kde-devel/qt5-kde-devel-
x11/work/build/qtbase/bin/qmake -config ltcg -o Makefile 
/opt/local/var/macports/build/qt5-kde-devel/qt5-kde-devel-x11/work/qt-
everywhere-opensource-src-5.5.0/qtbase/src/tools/moc/moc.pro
...
/opt/local/bin/clang++-mp-3.6 -L/opt/local/lib -Wl,-headerpad_max_install_names 
-O3 -march=core2 -g -Wl,-dead_strip -Wl,-
syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk 
-stdlib=libc++ -mmacosx-version-min=10.7 -O2 -isysroot 
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk 
-std=c++11 -flto -fPIC -o ../../../bin/moc .obj/moc.o .obj/preprocessor.o 
.obj/generator.o .obj/parser.o .obj/token.o .obj/main.o   -
L/opt/local/var/macports/build/qt5-kde-devel/qt5-kde-devel-
x11/work/build/qtbase/lib -lQt5Bootstrap -framework Foundation -framework 
CoreServices -lz 
>>> ld: warning: ignoring file /opt/local/var/macports/build/qt5-kde-devel/qt5-
kde-devel-x11/work/build/qtbase/lib/libQt5Bootstrap.a, file was built for 
archive which is not the architecture being linked (x86_64): 
/opt/local/var/macports/build/qt5-kde-devel/qt5-kde-devel-
x11/work/build/qtbase/lib/libQt5Bootstrap.a
Undefined symbols for architecture x86_64:
  "QFileInfo::filePath() const", referenced from:
(followed by several pages of missing symbols)

Googling the error suggests either a missing x86_64 architecture (not the case) 
or a mismatch between the linker and ar, which is obviously also not the case:

%> llvm-ar-mp-3.6 --version
LLVM (http://llvm.org/):
  LLVM version 3.6.1
  Optimized build.
  Built Jun 24 2015 (10:49:09).
  Default target: x86_64-apple-darwin13.4.0
  Host CPU: corei7-avx
%> clang++-mp-3.6 --version
clang version 3.6.1 (tags/RELEASE_361/final)
Target: x86_64-apple-darwin13.4.0
Thread model: posix

So WTH?!

R.




More information about the Interest mailing list