[PATCH] D75068: libclang: Add static build support for Windows

David Zarzycki via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 25 20:10:55 PDT 2020


davezarzycki added a comment.

This breaks building libclang on Fedora 32 with clang 10.0 and lld 10.0. Do you mind if I revert this tomorrow if a quick fix cannot be found? Here is the relevant diagnostics:

FAILED: lib64/libclang.so.11
: && /usr/bin/clang++ -fPIC -Werror=switch -stdlib=libc++ -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O2 -DNDEBUG  -stdlib=libc++ -Wl,-z,defs -Wl,-z,nodelete -fuse-ld=lld -Wl,--color-diagnostics   -Wl,-O3 -Wl,--gc-sections  -Wl,--version-script,"/tmp/_update_lc/r/tools/clang/tools/libclang/libclang.exports" -shared -Wl,-soname,libclang.so.11git -o lib64/libclang.so.11 tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/BuildSystem.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CIndex.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CIndexCXX.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CIndexCodeCompletion.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CIndexDiagnostic.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CIndexHigh.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CIndexInclusionStack.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CIndexUSRs.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CIndexer.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CXComment.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CXCursor.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CXIndexDataConsumer.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CXCompilationDatabase.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CXLoadedDiagnostic.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CXSourceLocation.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CXStoredDiagnostic.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CXString.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/CXType.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/Indexing.cpp.o tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/FatalErrorHandler.cpp.o  -Wl,-rpath,"\$ORIGIN/../lib64"  lib64/libclangAST.a  lib64/libclangBasic.a  lib64/libclangDriver.a  lib64/libclangFrontend.a  lib64/libclangIndex.a  lib64/libclangLex.a  lib64/libclangSema.a  lib64/libclangSerialization.a  lib64/libclangTooling.a  lib64/libLLVMSupport.a  lib64/libclangARCMigrate.a  -ldl  lib64/libLLVMX86CodeGen.a  lib64/libLLVMX86AsmParser.a  lib64/libLLVMX86Desc.a  lib64/libLLVMX86Disassembler.a  lib64/libLLVMX86Info.a  lib64/libLLVMAArch64CodeGen.a  lib64/libLLVMAArch64AsmParser.a  lib64/libLLVMAArch64Desc.a  lib64/libLLVMAArch64Disassembler.a  lib64/libLLVMAArch64Info.a  lib64/libLLVMAArch64Utils.a  lib64/libLLVMPowerPCCodeGen.a  lib64/libLLVMPowerPCAsmParser.a  lib64/libLLVMPowerPCDesc.a  lib64/libLLVMPowerPCDisassembler.a  lib64/libLLVMPowerPCInfo.a  lib64/libLLVMRISCVCodeGen.a  lib64/libLLVMRISCVAsmParser.a  lib64/libLLVMRISCVDesc.a  lib64/libLLVMRISCVDisassembler.a  lib64/libLLVMRISCVInfo.a  lib64/libLLVMRISCVUtils.a  lib64/libLLVMCore.a  lib64/libLLVMSupport.a  lib64/libclangFormat.a  lib64/libclangToolingInclusions.a  lib64/libclangToolingCore.a  lib64/libclangFrontend.a  lib64/libclangDriver.a  lib64/libLLVMOption.a  lib64/libclangParse.a  lib64/libclangSerialization.a  lib64/libclangSema.a  lib64/libclangEdit.a  lib64/libclangRewrite.a  lib64/libclangAnalysis.a  lib64/libclangASTMatchers.a  lib64/libclangAST.a  lib64/libclangLex.a  lib64/libclangBasic.a  lib64/libLLVMFrontendOpenMP.a  lib64/libLLVMCFGuard.a  lib64/libLLVMAArch64Desc.a  lib64/libLLVMAArch64Info.a  lib64/libLLVMAArch64Utils.a  lib64/libLLVMAsmPrinter.a  lib64/libLLVMDebugInfoDWARF.a  lib64/libLLVMGlobalISel.a  lib64/libLLVMSelectionDAG.a  lib64/libLLVMCodeGen.a  lib64/libLLVMScalarOpts.a  lib64/libLLVMAggressiveInstCombine.a  lib64/libLLVMInstCombine.a  lib64/libLLVMBitWriter.a  lib64/libLLVMTransformUtils.a  lib64/libLLVMTarget.a  lib64/libLLVMAnalysis.a  lib64/libLLVMProfileData.a  lib64/libLLVMObject.a  lib64/libLLVMBitReader.a  lib64/libLLVMCore.a  lib64/libLLVMRemarks.a  lib64/libLLVMBitstreamReader.a  lib64/libLLVMTextAPI.a  lib64/libLLVMMCParser.a  lib64/libLLVMMCDisassembler.a  lib64/libLLVMMC.a  lib64/libLLVMBinaryFormat.a  lib64/libLLVMDebugInfoCodeView.a  lib64/libLLVMDebugInfoMSF.a  lib64/libLLVMSupport.a  -lz  -lrt  -ldl  -ltinfo  -lpthread  -lm  /usr/lib64/libz3.so  lib64/libLLVMDemangle.a && :
ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappings)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappings)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappings)

ld.lld: error: can't create dynamic relocation R_X86_64_32S against symbol: vtable for clang::TextDiagnosticBuffer in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in lib64/libclangFrontend.a(TextDiagnosticBuffer.cpp.o)
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappings)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappings)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappings)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappings)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappings)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappings)

ld.lld: error: can't create dynamic relocation R_X86_64_32S against symbol: vtable for clang::TextDiagnosticBuffer in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in lib64/libclangFrontend.a(TextDiagnosticBuffer.cpp.o)
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang::TextDiagnosticBuffer::~TextDiagnosticBuffer())

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappingsFromFileList)

ld.lld: error: can't create dynamic relocation R_X86_64_32S against symbol: vtable for clang::TextDiagnosticBuffer in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in lib64/libclangFrontend.a(TextDiagnosticBuffer.cpp.o)
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappingsFromFileList)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappingsFromFileList)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappingsFromFileList)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o
>>>  referenced by ARCMigrate.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/ARCMigrate.cpp.o:(clang_getRemappingsFromFileList)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/BuildSystem.cpp.o
>>>  referenced by BuildSystem.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/BuildSystem.cpp.o:(clang_VirtualFileOverlay_addFileMapping)

ld.lld: error: can't create dynamic relocation R_X86_64_32S against symbol: vtable for llvm::raw_svector_ostream in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in lib64/libLLVMSupport.a(raw_ostream.cpp.o)
>>>  referenced by BuildSystem.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/BuildSystem.cpp.o:(clang_VirtualFileOverlay_writeToBuffer)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/BuildSystem.cpp.o
>>>  referenced by BuildSystem.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/BuildSystem.cpp.o:(clang_VirtualFileOverlay_writeToBuffer)

ld.lld: error: can't create dynamic relocation R_X86_64_32S against symbol: vtable for llvm::raw_svector_ostream in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in lib64/libLLVMSupport.a(raw_ostream.cpp.o)
>>>  referenced by BuildSystem.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/BuildSystem.cpp.o:(clang_ModuleMapDescriptor_writeToBuffer)

ld.lld: error: can't create dynamic relocation R_X86_64_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output

>>> defined in tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/BuildSystem.cpp.o
>>>  referenced by BuildSystem.cpp
>>> 
>>>   tools/clang/tools/libclang/CMakeFiles/obj.libclang.dir/BuildSystem.cpp.o:(clang_ModuleMapDescriptor_writeToBuffer)

ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75068/new/

https://reviews.llvm.org/D75068





More information about the cfe-commits mailing list