secure-software-engineering / phasar

A LLVM-based static analysis framework.
Other
919 stars 140 forks source link

Compile error in latest version. #688

Closed yuffon closed 6 months ago

yuffon commented 6 months ago

compile error report

I get an error when compiling the latest version of Phasar.

/usr/bin/ld: CMakeFiles/LLVMBasedICFGGlobCtorDtorTest.dir/LLVMBasedICFGGlobCtorDtorTest.cpp.o: undefined reference to symbol '_ZN4llvm6Linker11linkModulesERNS_6ModuleESt10unique_ptrIS1_St14default_deleteIS1_EEjSt8functionIFvS2_RKNS_9StringSetINS_15MallocAllocatorEEEEE'
/usr/bin/ld: /home/yuffon/data/programs/llvm14/llvm-install-release/lib/libLLVMLinker.so.14: error adding symbols: DSO missing from command line
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)

I use bear to print ld command and the command is as follows.

['/usr/bin/ld', '-z', 'relro', '--hash-style=gnu', '--eh-frame-hdr', '-m', 'elf_x86_64', '-dynamic-linker', '/lib64/ld-linux-x86-64.so.2', '-o', 'LLVMBasedICFGGlobCtorDtorTest', '/usr/lib/x86_64-linux-gnu/crt1.o', '/usr/lib/x86_64-linux-gnu/crti.o', '/usr/lib/gcc/x86_64-linux-gnu/11/crtbegin.o', '-L/home/yuffon/data/programs/llvm14/llvm-install-release/lib', '-L/home/yuffon/data/programs/llvm14/llvm-install-release/bin/../lib/x86_64-unknown-linux-gnu', '-L/usr/lib/gcc/x86_64-linux-gnu/11', '-L/lib/x86_64-linux-gnu', '-L/lib/../lib64', '-L/usr/lib/x86_64-linux-gnu', '-L/lib', '-L/usr/lib', 'CMakeFiles/LLVMBasedICFGGlobCtorDtorTest.dir/LLVMBasedICFGGlobCtorDtorTest.cpp.o', '-rpath', '/home/yuffon/data/programs/llvm14/llvm-install-release/lib:/usr/local/lib', '../../../lib/libphasar.a', '../../../lib/libgtest.a', '../../../lib/Controller/libphasar_controller.a', '../../../lib/PhasarLLVM/DataFlow/Mono/libphasar_mono.a', '../../../lib/PhasarLLVM/DataFlow/IfdsIde/libphasar_llvm_ifdside.a', '../../../lib/PhasarLLVM/TaintConfig/libphasar_taintconfig.a', '../../../external/json-schema-validator/libnlohmann_json_schema_validator.a', '../../../lib/PhasarLLVM/libphasar_llvm.a', '../../../lib/PhasarLLVM/ControlFlow/libphasar_llvm_controlflow.a', '../../../lib/PhasarLLVM/Pointer/libphasar_llvm_pointer.a', '../../../lib/Pointer/libphasar_pointer.a', '../../../lib/PhasarLLVM/DB/libphasar_llvm_db.a', '../../../lib/PhasarLLVM/Utils/libphasar_llvm_utils.a', '../../../lib/Config/libphasar_config.a', '../../../lib/PhasarLLVM/TypeHierarchy/libphasar_llvm_typehierarchy.a', '../../../lib/AnalysisStrategy/libphasar_analysis_strategy.a', '../../../lib/DB/libphasar_db.a', '../../../lib/PhasarLLVM/Passes/libphasar_passes.a', '../../../lib/Utils/libphasar_utils.a', '/usr/local/lib/libsqlite3.so', '../../../lib/ControlFlow/libphasar_controlflow.a', '-lstdc++fs', '/usr/local/lib/libboost_graph.so.1.83.0', '/usr/local/lib/libboost_regex.so.1.83.0', '/home/yuffon/data/programs/llvm14/llvm-install-release/lib/libLLVMPasses.so.14', '/home/yuffon/data/programs/llvm14/llvm-install-release/lib/libLLVMBitWriter.so.14', '/home/yuffon/data/programs/llvm14/llvm-install-release/lib/libLLVMIRReader.so.14', '/home/yuffon/data/programs/llvm14/llvm-install-release/lib/libLLVMAnalysis.so.14', '/home/yuffon/data/programs/llvm14/llvm-install-release/lib/libLLVMCore.so.14', '/home/yuffon/data/programs/llvm14/llvm-install-release/lib/libLLVMSupport.so.14', '/home/yuffon/data/programs/llvm14/llvm-install-release/lib/libLLVMDemangle.so.14', '-lpthread', '-rpath-link', '/home/yuffon/data/programs/llvm14/llvm-install-release/lib', '-lstdc++', '-lm', '-lgcc_s', '-lgcc', '-lc', '-lgcc_s', '-lgcc', '/usr/lib/gcc/x86_64-linux-gnu/11/crtend.o', '/usr/lib/x86_64-linux-gnu/crtn.o']

libLLVMLinker.so.14 is not in the command.

fabianbs96 commented 6 months ago

Hi @yuffon, thanks for reporting that error. Can you check whether https://github.com/secure-software-engineering/phasar/tree/f-FixUnittestNeedsLinker fixes the issue?

yuffon commented 6 months ago

Hi @yuffon, thanks for reporting that error. Can you check whether https://github.com/secure-software-engineering/phasar/tree/f-FixUnittestNeedsLinker fixes the issue?

It works on my computer.