Skip to content

ld: Undefined symbols building with BUILD_SHARED_LIBS #1224

@JuliusNmn

Description

@JuliusNmn

I'm trying to build SVF as a shared library with the BUILD_SHARED_LIBS flag introduced in 278, but linking fails with ld: undefined symbols. Without the flag, SVF builds without errors.

~ mkdir build & cd build
~ cmake .. -DLLVM_DIR=~/Developer/SVF/llvm-14.0.0.obj -DBUILD_SHARED_LIBS=on
~ make
...
[ 85%] Building CXX object svf-llvm/CMakeFiles/obj.SvfLLVM.dir/lib/SymbolTableBuilder.cpp.o
[ 85%] Built target obj.SvfLLVM
[ 86%] Linking CXX static library libSvfLLVM_static.a
[ 86%] Built target SvfLLVM_static
[ 87%] Linking CXX shared library libSvfLLVM.dylib
ld: Undefined symbols:
  SVF::SVFIR2ItvExeState::globalNullVaddrs, referenced from:
      SVF::SVFIR2ItvExeState::getVAddrs(unsigned int) in SVFIR2ItvExeState.cpp.o
  llvm::BasicBlock::BasicBlock(llvm::LLVMContext&, llvm::Twine const&, llvm::Function*, llvm::BasicBlock*), referenced from:
      llvm::BasicBlock::Create(llvm::LLVMContext&, llvm::Twine const&, llvm::Function*, llvm::BasicBlock*) in LLVMModule.cpp.o
  llvm::DataLayout::DataLayout(llvm::Module const*), referenced from:
      SVF::LLVMUtil::getDataLayout(llvm::Module*) in LLVMUtil.cpp.o
      SVF::LLVMUtil::getDataLayout(llvm::Module*) in SVFIRBuilder.cpp.o
  llvm::ModulePass::assignPassManager(llvm::PMStack&, llvm::PassManagerType), referenced from:
      vtable for SVF::BreakConstantGEPs in BreakConstantExpr.cpp.o
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions