[Qt-creator] Linker probably picks up wrong LLVM libraries when linking Qt Creator 4.9
Eike Ziller
Eike.Ziller at qt.io
Tue May 28 09:23:38 CEST 2019
> On 28. May 2019, at 07:38, Andrzej Telszewski <atelszewski at gmail.com> wrote:
>
> Hi,
>
> I came across a problem, when the linker probably picks up wrong libraries when linking Qt Creator 4.9.
>
> Instead of picking from LLVM_INSTALL_DIR, it picks the libs from system-wide installed LLVM (i.e. from /usr/lib64).
>
> This is the way I compile LLVM:
> (The version I use is 7.0 commit 4a75f114)
>
> mkdir -p build
> cd build
> cmake \
> -DCMAKE_INSTALL_PREFIX=/usr/libexec/qtcreator/clang \
> -DLLVM_LIBDIR_SUFFIX= \
> -DCMAKE_BUILD_TYPE=Release \
> -DLLVM_ENABLE_RTTI=ON \
> ..
> make
> make install
>
>
> And this is the way I try to compile Qt Creator:
>
> qmake-qt5 qtcreator.pro \
> QTC_PREFIX=/usr \
> IDE_LIBRARY_BASENAME=lib64 \
> LLVM_INSTALL_DIR=/usr/libexec/qtcreator/clang \
> QBS_INSTALL_DIR=/usr \
> DEFINES+=QBS_ENABLE_PROJECT_FILE_UPDATES
>
> make
>
>
> And it fails with the following messages (excerpt from the full log):
>
> (...)
> .obj/release-shared/clangformatutils.o: In function `ClangFormat::constructStyle(QByteArray const&)':
> clangformatutils.cpp:(.text._ZN11ClangFormatL14constructStyleERK10QByteArray+0xc4): undefined reference to `clang::format::getStyle(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::StringRef, clang::vfs::FileSystem*)'
> .obj/release-shared/clangformatutils.o: In function `ClangFormat::styleForFile(Utils::FileName, bool)':
> clangformatutils.cpp:(.text._ZN11ClangFormatL12styleForFileEN5Utils8FileNameEb+0x213): undefined reference to `clang::format::getStyle(llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::StringRef, clang::vfs::FileSystem*)'
> .obj/release-shared/clangformatutils.o:(.data.rel._ZN4llvm30VerifyDisableABIBreakingChecksE+0x0): undefined reference to `llvm::DisableABIBreakingChecks'
> collect2: error: ld returned 1 exit status
> Makefile:112: recipe for target '../../../lib64/qtcreator/plugins/libClangFormat.so' failed
> make[3]: *** [../../../lib64/qtcreator/plugins/libClangFormat.so] Error 1
> make[3]: Leaving directory '/tmp/slackrepo-desktop/slackrepo.47ixcS/build_qt-creator/qt-creator-4.9.0/src/plugins/clangformat'
> Makefile:142: recipe for target 'sub-clangformat-make_first' failed
> make[2]: *** [sub-clangformat-make_first] Error 2
> make[2]: *** Waiting for unfinished jobs....
> (...)
>
> Maybe the problem lies in this line:
>
> g++ -L/usr/lib64 -Wl,-z,origin '-Wl,-rpath,$ORIGIN:$ORIGIN/..:$ORIGIN/../lib64/qtcreator' -Wl,--no-undefined -Wl,-z,origin -Wl,-rpath,/usr/libexec/qtcreator/clang/lib -Wl,--exclude-libs,ALL -Wl,-O1 -shared -Wl,-soname,libClangFormat.so -o libClangFormat.so .obj/release-shared/clangformatbaseindenter.o .obj/release-shared/clangformatconfigwidget.o .obj/release-shared/clangformatindenter.o .obj/release-shared/clangformatplugin.o .obj/release-shared/clangformatsettings.o .obj/release-shared/clangformatutils.o .obj/release-shared/moc_clangformatconfigwidget.o .obj/release-shared/moc_clangformatplugin.o -L/tmp/slackrepo-desktop/slackrepo.47ixcS/build_qt-creator/qt-creator-4.9.0/lib64/qtcreator -L/tmp/slackrepo-desktop/slackrepo.47ixcS/build_qt-creator/qt-creator-4.9.0/lib64/qtcreator/plugins -lCppTools -lProjectExplorer -lCppEditor -lCore -lTextEditor -lQtcSsh -lCPlusPlus -lAggregation -lExtensionSystem -lUtils -lKSyntaxHighlighting -L/usr/libexec/qtcreator/clang/lib -lclangFormat -lclangToolingInclusions -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic -lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMMIRParser -lLLVMFuzzMutate -lLLVMCoverage -lLLVMTableGen -lLLVMDlltoolDriver -lLLVMOrcJIT -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiAsmPrinter -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFAsmParser -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter -lLLVMAMDGPUUtils -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lLLVMWindowsManifest -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMLineEditor -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMBitWriter -lLLVMAggressiveInstCombine -lLLVMTransformUtils -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -lz -lrt -ldl -lcurses -lm -lxml2 -lQt5Widgets -lQt5Gui -lQt5Concurrent -lQt5Network -lQt5Core -lGL -lpthread
>
> where:
> -L/usr/lib64
>
> is put before:
> -Wl,-rpath,/usr/libexec/qtcreator/clang/lib
>
> ?
>
> Uninstalling this system-wide version of LLVM for the time of building Qt Creator allows it to compile and link just fine.
>
> Please advice.
> Patches welcome :-)
>
> Thanks in advance!
Your diagnosis sounds correct, so the question is where that -L path comes from. My guess that it’s from the mkspecs, but maybe running qmake with additional -d -d -d gives something useful?
Br, Eike
--
Eike Ziller
Principal Software Engineer
The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B
More information about the Qt-creator
mailing list