[PATCH] D64579: [clang-shlib] Fix clang-shlib for PRIVATE dependencies

Shoaib Meenai via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 10:23:30 PDT 2019


Sorry about the breakage. I reverted it in r365922.

On 7/12/19, 9:12 AM, "Brian Rzycki via Phabricator" <reviews at reviews.llvm.org> wrote:

    brzycki added a comment.
    
    Hello @smeenai , this commit causes LLVM to fail to build when set set `-D BUILD_SHARED_LIBS=ON`. Here is the failing CMake and Ninja invocation:
    
      /tools/build/cmake-3.14.5/bin/cmake \
          -G Ninja  \
          -D CMAKE_MAKE_PROGRAM=/tools/build/ninja-1.9.0/ninja \
          -D CMAKE_C_COMPILER=/usr/lib/llvm-7/bin/clang \
          -D CMAKE_CXX_COMPILER=/usr/lib/llvm-7/bin/clang++ \
          -D CMAKE_BUILD_TYPE=Release \
          -D CMAKE_INSTALL_PREFIX=/work/upstream/install \
          -D LLVM_TOOL_CLANG_BUILD=ON \
          -D LIBCXX_INCLUDE_BENCHMARKS=ON \
          -D BUILD_SHARED_LIBS=ON \
          -D LLVM_ENABLE_ASSERTIONS=ON \
          -D LLVM_TARGETS_TO_BUILD=X86 \
          /work/upstream/llvm-project/llvm
      
      /tools/build/ninja-1.9.0/ninja -v install
    
    I am able to successfully build LLVM when I change to `-D BUILD_SHARED_LIBS=OFF`.
    
    The outputted errors happen during link time of `lib/libclang_shared.so.9svn`:
    
      FAILED: lib/libclang_shared.so.9svn
      
      ...
      
      tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CodeGenModule.cpp.o: In function `llvm::cl::opt<bool, false, llvm::cl::parser<bool> >::~opt()':
      CodeGenModule.cpp:(.text._ZN4llvm2cl3optIbLb0ENS0_6parserIbEEED2Ev[_ZN4llvm2cl3optIbLb0ENS0_6parserIbEEED2Ev]+0x7): undefined reference to `vtable for llvm::cl::Option'
      tools/clang/lib/CodeGen/CMakeFiles/obj.clangCodeGen.dir/CodeGenModule.cpp.o: In function `clang::CodeGen::CodeGenModule::CodeGenModule(clang::ASTContext&, clang::HeaderSearchOptions const&, clang::PreprocessorOptions const&, clang::CodeGenOptions const&, llvm::Module&, clang::DiagnosticsEngine&, clang::CoverageSourceInfo*)':
      CodeGenModule.cpp:(.text._ZN5clang7CodeGen13CodeGenModuleC2ERNS_10ASTContextERKNS_19HeaderSearchOptionsERKNS_19PreprocessorOptionsERKNS_14CodeGenOptionsERN4llvm6ModuleERNS_17DiagnosticsEngineEPNS_18CoverageSourceInfoE+0x57a): undefined reference to `llvm::FoldingSetBase::FoldingSetBase(unsigned int)'
      CodeGenModule.cpp:(.text._ZN5clang7CodeGen13CodeGenModuleC2ERNS_10ASTContextERKNS_19HeaderSearchOptionsERKNS_19PreprocessorOptionsERKNS_14CodeGenOptionsERN4llvm6ModuleERNS_17DiagnosticsEngineEPNS_18CoverageSourceInfoE+0x5cc): undefined reference to `llvm::Type::getVoidTy(llvm::LLVMContext&)'
      CodeGenModule.cpp:(.text._ZN5clang7CodeGen13CodeGenModuleC2ERNS_10ASTContextERKNS_19HeaderSearchOptionsERKNS_19PreprocessorOptionsERKNS_14CodeGenOptionsERN4llvm6ModuleERNS_17DiagnosticsEngineEPNS_18CoverageSourceInfoE+0x5d7): undefined reference to `llvm::Type::getInt8Ty(llvm::LLVMContext&)'
      CodeGenModule.cpp:(.text._ZN5clang7CodeGen13CodeGenModuleC2ERNS_10ASTContextERKNS_19HeaderSearchOptionsERKNS_19PreprocessorOptionsERKNS_14CodeGenOptionsERN4llvm6ModuleERNS_17DiagnosticsEngineEPNS_18CoverageSourceInfoE+0x5e3): undefined reference to `llvm::Type::getInt16Ty(llvm::LLVMContext&)'
      
      ... (clipped thousands of similar errors)
      
      WhitespaceManager.cpp:(.text._ZN5clang6formatL18AlignTokenSequenceIRZNS0_17WhitespaceManager28alignConsecutiveDeclarationsEvE3$_2EEvjjjOT_RN4llvm11SmallVectorINS2_6ChangeELj16EEE+0x129): undefined reference to `llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long)'
      tools/clang/tools/clang-fuzzer/handle-cxx/CMakeFiles/obj.clangHandleCXX.dir/handle_cxx.cpp.o: In function `clang_fuzzer::HandleCXX(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::vector<char const*, std::allocator<char const*> > const&)':
      handle_cxx.cpp:(.text._ZN12clang_fuzzer9HandleCXXERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIPKcSaISA_EE+0x67): undefined reference to `llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long)'
      handle_cxx.cpp:(.text._ZN12clang_fuzzer9HandleCXXERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIPKcSaISA_EE+0x32b): undefined reference to `llvm::MemoryBuffer::getMemBuffer(llvm::StringRef, llvm::StringRef, bool)'
      handle_cxx.cpp:(.text._ZN12clang_fuzzer9HandleCXXERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKSt6vectorIPKcSaISA_EE+0x669): undefined reference to `llvm::SmallVectorBase::grow_pod(void*, unsigned long, unsigned long)'
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    
    Repository:
      rL LLVM
    
    CHANGES SINCE LAST ACTION
      https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D64579_new_&d=DwIFAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=cpyWE0YV319Dd3hlteUrLx-qVuVLtE5TuYEWHimU5pE&s=ewqtR4F272LGTH1CzQZcQALTX6_rJIABb5AgGqr2s4Q&e= 
    
    https://urldefense.proofpoint.com/v2/url?u=https-3A__reviews.llvm.org_D64579&d=DwIFAg&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=cpyWE0YV319Dd3hlteUrLx-qVuVLtE5TuYEWHimU5pE&s=oL7blc7PIIj9vcaNL2TKUMdmqc1iN_6Tv0ddCFde7as&e= 
    
    
    
    



More information about the llvm-commits mailing list