Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when building with SVF support #338

Closed
vwvw opened this issue Jul 29, 2020 · 12 comments
Closed

Error when building with SVF support #338

vwvw opened this issue Jul 29, 2020 · 12 comments
Labels

Comments

@vwvw
Copy link
Contributor

vwvw commented Jul 29, 2020

When I tried to build dg with SVF support I got multiple errors.

Some where due to this commit while other are cause by a change in the namespace used by SVF.

I have my fixes here but still get an error:

make[2]: *** [tools/CMakeFiles/llvm-slicer.dir/build.make:132: tools/llvm-slicer] Error 1
make[1]: *** [CMakeFiles/Makefile2:1611: tools/CMakeFiles/llvm-slicer.dir/all] Error 2
/usr/bin/ld: CMakeFiles/llvm-cg-dump.dir/llvm-cg-dump.cpp.o: in function `dg::SVFPointerAnalysis::run()':
/home/me/dg/include/dg/llvm/PointerAnalysis/SVFPointerAnalysis.h:183: undefined reference to `SVF::LLVMModuleSet::buildSVFModule(llvm::Module&)'
/usr/bin/ld: CMakeFiles/llvm-cg-dump.dir/llvm-cg-dump.cpp.o: in function `SVF::PointerAnalysis::getPAG() const':
/home/me/SVF/include/MemoryModel/PointerAnalysis.h:196: undefined reference to `SVF::PointerAnalysis::pag'
/usr/bin/ld: CMakeFiles/llvm-cg-dump.dir/llvm-cg-dump.cpp.o: in function `SVF::SymbolTableInfo::getValSym(llvm::Value const*)':
/home/me/SVF/include/SVF-FE/SymbolTableInfo.h:267: undefined reference to `SVF::SymbolTableInfo::isNullPtrSym(llvm::Value const*)'
/usr/bin/ld: /home/me/SVF/include/SVF-FE/SymbolTableInfo.h:269: undefined reference to `SVF::SymbolTableInfo::isBlackholeSym(llvm::Value const*)'
/usr/bin/ld: CMakeFiles/llvm-cg-dump.dir/llvm-cg-dump.cpp.o: in function `SVF::LLVMModuleSet::getLLVMModuleSet()':
/home/me/SVF/include/SVF-FE/LLVMModule.h:69: undefined reference to `SVF::LLVMModuleSet::llvmModuleSet'
/usr/bin/ld: /home/me/SVF/include/SVF-FE/LLVMModule.h:70: undefined reference to `SVF::LLVMModuleSet::llvmModuleSet'
/usr/bin/ld: /home/me/SVF/include/SVF-FE/LLVMModule.h:71: undefined reference to `SVF::LLVMModuleSet::llvmModuleSet'
/usr/bin/ld: CMakeFiles/llvm-cg-dump.dir/llvm-cg-dump.cpp.o: in function `Andersen':
/home/me/SVF/include/WPA/Andersen.h:84: undefined reference to `SVF::BVDataPTAImpl::BVDataPTAImpl(SVF::PAG*, SVF::PointerAnalysis::PTATY, bool)'
/usr/bin/ld: /home/me/SVF/include/WPA/Andersen.h:85: undefined reference to `vtable for SVF::Andersen'
/usr/bin/ld: /home/me/SVF/include/WPA/Andersen.h:85: undefined reference to `vtable for SVF::Andersen'
/usr/bin/ld: CMakeFiles/llvm-cg-dump.dir/llvm-cg-dump.cpp.o: in function `~BVDataPTAImpl':
/home/me/SVF/include/MemoryModel/PointerAnalysisImpl.h:55: undefined reference to `vtable for SVF::BVDataPTAImpl'
/usr/bin/ld: /home/me/SVF/include/MemoryModel/PointerAnalysisImpl.h:57: undefined reference to `SVF::PointerAnalysis::~PointerAnalysis()'
/usr/bin/ld: /home/me/SVF/include/MemoryModel/PointerAnalysisImpl.h:57: undefined reference to `SVF::PointerAnalysis::~PointerAnalysis()'
/usr/bin/ld: CMakeFiles/llvm-cg-dump.dir/llvm-cg-dump.cpp.o: in function `SVF::LLVMModuleSet::releaseLLVMModuleSet()':
/home/me/SVF/include/SVF-FE/LLVMModule.h:76: undefined reference to `SVF::LLVMModuleSet::llvmModuleSet'
/usr/bin/ld: /home/me/SVF/include/SVF-FE/LLVMModule.h:77: undefined reference to `SVF::LLVMModuleSet::llvmModuleSet'
/usr/bin/ld: /home/me/SVF/include/SVF-FE/LLVMModule.h:78: undefined reference to `SVF::LLVMModuleSet::llvmModuleSet'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [tools/CMakeFiles/llvm-cg-dump.dir/build.make:110: tools/llvm-cg-dump] Error 1
make[1]: *** [CMakeFiles/Makefile2:1670: tools/CMakeFiles/llvm-cg-dump.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Any help would be appreciated!

@mchalupa
Copy link
Owner

Thanks for the report and the PR draft. I'll check it out.

@mchalupa
Copy link
Owner

It would be helpful to know what cmake command did you use, its output and where do you have the libSvf.a file?

@mchalupa
Copy link
Owner

mchalupa commented Jul 29, 2020

This is not going to work: vwvw@d68d4c4#r41014072 because _pta is not initialized at that point.

I have fixed the SVF support based on your PR draft (https://github.com/mchalupa/dg/tree/svf-fixes). Do you mind if I push the fixes, or you want to build the fix on your changes?

Just to be more precise: I have fixed the compilation (I am not getting the linking error as you do, we need to look into that), but DG crashes in runtime. Still need to fix that.

@vwvw
Copy link
Contributor Author

vwvw commented Jul 29, 2020

Push as much as you want, I'm just happy when it resolves ;-) Thanks for the amazing project btw!

@vwvw
Copy link
Contributor Author

vwvw commented Jul 29, 2020

The command used for cmake is
cmake .. -DSVF_DIR=/home/me/SVF/Release-build .
I also tried with -DSVF_INCLUDE) without more success.

My SVF copy is the lastest commit and compiled with cmake.

Thanks again!

@mchalupa
Copy link
Owner

mchalupa commented Aug 3, 2020

Do you have the file libSvf.a in /home/me/SVF/Release-build/lib ?

@vwvw
Copy link
Contributor Author

vwvw commented Aug 3, 2020

Yes I do!

@mchalupa mchalupa reopened this Aug 3, 2020
@mchalupa
Copy link
Owner

mchalupa commented Aug 3, 2020

Good. Could you please try pulling and compiling DG again?

@vwvw
Copy link
Contributor Author

vwvw commented Aug 3, 2020

It worked! Thanks for the fix!

@vwvw vwvw closed this as completed Aug 3, 2020
@wliuxingxiangyu
Copy link

wliuxingxiangyu commented Aug 1, 2022

@mchalupa
Hi, thanks for the nice tool!

I used the tool with SVF to pointer analysis.
I noticed the SVF had been updated.
[include/SVF-FE/PAGBuilder.h → include/SVF-FE/SVFIRBuilder.h]

I have tried some patched to update my local dg code, but failed.
So could you help me to update the SVFPointerAnalysis.h in dg ?
#include <SVF-FE/PAGBuilder.h> // PAGBuilder

@mchalupa
Copy link
Owner

mchalupa commented Aug 1, 2022

@wliuxingxiangyu File a new issue on that, please. I'm not sure how much time I will have to work on this right now, though.

@wliuxingxiangyu
Copy link

@mchalupa
Thanks, please go to check the new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants