seahorn / sea-dsa

A new context, field, and array-sensitive heap analysis for LLVM bitcode based on DSA.
Other
157 stars 29 forks source link

sea-dsa build failed with llvm-3.8 #33

Closed mustakimur closed 6 years ago

mustakimur commented 6 years ago

Hi I have failed to build sea-dsa with llvm-3.8. Here is my system configuration:

OS: 4.4.0-112-generic #135-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

clang/llvm: http://releases.llvm.org/3.8.0/llvm-3.8.0.src.tar.xz, http://releases.llvm.org/3.8.0/cfe-3.8.0.src.tar.xz

They have been build and install successfully. image

Next, I have done: cmake -DCMAKE_INSTALL_PREFIX=\~/static-cfg/llvm-dsa/sea-dsa/install -DLLVM_DIR=~/static-cfg/build/share/llvm/cmake .. and when try the following: cmake --build . --target install It failed as following: image Here is the error: **undefined reference totypeinfo for llvm::cl::GenericOptionValue'**`

details: CMakeFiles/seadsa.dir/seadsa.cc.o:(.data.rel.ro._ZTIN4llvm2cl3optIN7sea_dsa12SeaDsaLogOptELb1ENS0_6parserINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEE[_ZTIN4llvm2cl3optIN7sea_dsa12SeaDsaLogOptELb1ENS0_6parserINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEEE]+0x18): undefined reference to typeinfo for llvm::cl::Option' CMakeFiles/seadsa.dir/seadsa.cc.o:(.data.rel.ro._ZTIN4llvm2cl15OptionValueBaseIN7sea_dsa12SeaDsaLogOptELb1EEE[_ZTIN4llvm2cl15OptionValueBaseIN7sea_dsa12SeaDsaLogOptELb1EEE]+0x10): undefined reference totypeinfo for llvm::cl::GenericOptionValue' CMakeFiles/seadsa.dir/seadsa.cc.o:(.data.rel.ro._ZTIN4llvm2cl15OptionValueCopyIbEE[_ZTIN4llvm2cl15OptionValueCopyIbEE]+0x10): undefined reference to `typeinfo for llvm::cl::GenericOptionValue' CMakeFiles/seadsa.dir/seadsa.cc.o:(.data.rel.ro._ZTIN4llvm2cl15OptionValueCopyINSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE[_ZTIN4llvm2cl15OptionValueCopyINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE]+0x10): undefined reference to typeinfo for llvm::cl::GenericOptionValue' ../lib/libSeaDsaAnalysis.a(DsaStats.cc.o):(.data.rel.ro._ZTIN7sea_dsa17DsaPrintStatsPassE[_ZTIN7sea_dsa17DsaPrintStatsPassE]+0x10): undefined reference totypeinfo for llvm::ModulePass' ../lib/libSeaDsaAnalysis.a(DsaPrinter.cc.o):(.data.rel.ro._ZTIN7sea_dsa9DsaViewerE[_ZTIN7sea_dsa9DsaViewerE]+0x10): undefined reference to typeinfo for llvm::ModulePass' ../lib/libSeaDsaAnalysis.a(DsaPrinter.cc.o):(.data.rel.ro._ZTIN7sea_dsa10DsaPrinterE[_ZTIN7sea_dsa10DsaPrinterE]+0x10): undefined reference totypeinfo for llvm::ModulePass' ../lib/libSeaDsaAnalysis.a(DsaInfo.cc.o):(.data.rel.ro._ZTIN7sea_dsa11DsaInfoPassE[_ZTIN7sea_dsa11DsaInfoPassE]+0x10): undefined reference to typeinfo for llvm::ModulePass' ../lib/libSeaDsaAnalysis.a(DsaAnalysis.cc.o):(.data.rel.ro._ZTIN4llvm2cl3optIN7sea_dsa18GlobalAnalysisKindELb0ENS0_6parserIS3_EEEE[_ZTIN4llvm2cl3optIN7sea_dsa18GlobalAnalysisKindELb0ENS0_6parserIS3_EEEE]+0x18): undefined reference totypeinfo for llvm::cl::Option' ../lib/libSeaDsaAnalysis.a(DsaAnalysis.cc.o):(.data.rel.ro._ZTIN4llvm2cl6parserIN7sea_dsa18GlobalAnalysisKindEEE[_ZTIN4llvm2cl6parserIN7sea_dsa18GlobalAnalysisKindEEE]+0x10): undefined reference to typeinfo for llvm::cl::generic_parser_base' ../lib/libSeaDsaAnalysis.a(DsaAnalysis.cc.o):(.data.rel.ro._ZTIN4llvm2cl15OptionValueCopyIN7sea_dsa18GlobalAnalysisKindEEE[_ZTIN4llvm2cl15OptionValueCopyIN7sea_dsa18GlobalAnalysisKindEEE]+0x10): undefined reference totypeinfo for llvm::cl::GenericOptionValue' ../lib/libSeaDsaAnalysis.a(DsaAnalysis.cc.o):(.data.rel.ro._ZTIN7sea_dsa11DsaAnalysisE[_ZTIN7sea_dsa11DsaAnalysisE]+0x10): undefined reference to typeinfo for llvm::ModulePass' ../lib/libSeaDsaAnalysis.a(NameValues.cc.o):(.data.rel.ro._ZTIN7sea_dsa10NameValuesE[_ZTIN7sea_dsa10NameValuesE]+0x10): undefined reference totypeinfo for llvm::ModulePass' ../lib/libSeaDsaAnalysis.a(RemovePtrToInt.cc.o):(.data.rel.ro._ZTIN7sea_dsa14RemovePtrToIntE[_ZTIN7sea_dsa14RemovePtrToIntE]+0x10): undefined reference to typeinfo for llvm::FunctionPass' ../lib/libSeaDsaAnalysis.a(DsaGlobal.cc.o):(.data.rel.ro._ZTIN7sea_dsa13DsaGlobalPassE[_ZTIN7sea_dsa13DsaGlobalPassE]+0x10): undefined reference totypeinfo for llvm::ModulePass' ../lib/libSeaDsaAnalysis.a(DsaBottomUp.cc.o):(.data.rel.ro._ZTIN7sea_dsa8BottomUpE[_ZTIN7sea_dsa8BottomUpE]+0x10): undefined reference to typeinfo for llvm::ModulePass' ../lib/libSeaDsaAnalysis.a(DsaLocal.cc.o):(.data.rel.ro._ZTIN7sea_dsa5LocalE[_ZTIN7sea_dsa5LocalE]+0x10): undefined reference totypeinfo for llvm::ModulePass' collect2: error: ld returned 1 exit status tools/CMakeFiles/seadsa.dir/build.make:121: recipe for target 'tools/seadsa' failed make[2]: [tools/seadsa] Error 1 CMakeFiles/Makefile2:1213: recipe for target 'tools/CMakeFiles/seadsa.dir/all' failed make[1]: [tools/CMakeFiles/seadsa.dir/all] Error 2 Makefile:129: recipe for target 'all' failed make: *** [all] Error 2 Any suggestion will be appreciated.

caballa commented 6 years ago

I think it's related to RTTI. Take a look a the second answer here.

I think you compiled llvm sources with RTTI disabled that might be a problem.

Another solution is not to pass -DLLVM_DIR and sea-dsa will download/compile LLVM with the right options.

agurfinkel commented 6 years ago

sea-dsa is only tested with LLVM that is compiled with it. You can see the necessary switches in the main CMakeLists.txt. There isn't any particular reason why sea-dsa should not work with other builds of LLVM, but we currently don't have the cycles to investigate. We would be very happy to accept a PR that addresses this issue.

mustakimur commented 6 years ago

Thanks @caballa. I build the LLVM with RTTI, and sea-dsa build successfully.