Giter Site home page Giter Site logo

svf-example's Introduction

0. Install npm, zlib, unzip, cmake, gcc, nodejs wget (skip this step if you machine has these libs)

sudo apt-get install zlib1g-dev unzip cmake gcc g++ libtinfo5 nodejs wget libncurses5-dev

1. Install SVF and its dependence (LLVM pre-built binary) via npm

npm i --silent svf-lib --prefix ${HOME}

2. Clone repository

git clone https://github.com/SVF-tools/SVF-example.git

3. Setup SVF environment and build your project

source ./env.sh

cmake the project (cmake -DCMAKE_BUILD_TYPE=Debug . for debug build)

cmake . && make

4. Analyze a bc file using svf-ex executable

clang -S -c -g -fno-discard-value-names -emit-llvm example.c -o example.ll
./bin/svf-ex example.ll

svf-example's People

Contributors

bjjwwang avatar charles32110 avatar guanqin-123 avatar hongxuchen avatar jasonzhongzexin avatar jmp0x7c00 avatar johanmyst avatar jumormt avatar sherlly avatar svf-tools avatar vhertz avatar xudon9 avatar yingchuan-d avatar yuleisui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

svf-example's Issues

not an external IR file: /home/runner/work/SVF/SVF/Release-build/svf-llvm/extapi.bc

I have followed the instructions in the tutorial to configure and build the project. However, when executing ./bin/svf-ex example.ll, I encountered the error message "not an external IR file: /home/runner/work/SVF/SVF/Release-build/svf-llvm/extapi.bc Aborted (core dumped)". The problem is that I don't have a runner user on my local machine, and that path doesn't even exist. So I want to know how can I do something to resolve it, thk.

error when using traverseOnVFG to collect all LLVM Values

Hi,

I tried to use traverseOnVFG to collect all LLVM values with regard to one specific VFG node.
I kept getting this error "svf-ex: /home/travis/build/SVF-tools/SVF/lib/Graphs/VFG.cpp:868: const SVF::PAGNode* SVF::VFG::getLHSTopLevPtr(const SVF::VFGNode*) const: Assertion `false && "unexpected node kind!"' failed.", I am wondering whether you could provide any hint on it.

Thanks

[Build failed] Building for macOS-arm64 but attempting to link with file built for macOS-x86_64

Hello everyone, I'm new to SVF. I attempted to utilize SVF as an external library in CLion on macOS Monterey, but encountered a cmake failure along with the following log:

It appears that the SVF library is currently available for x86_64 architecture but not for arm64. Would it be possible to provide an arm64 version for macOS? Your assistance would be greatly appreciated! Thank you very much!

====================[ 构建 | svf-ex | Release-Clang-14 ]==========================
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/xxx/Repositories/git_repos/SVF-example/cmake-build-release-clang-14 --target svf-ex -- -j 6
[ 50%] Linking CXX executable ../bin/svf-ex
ld: warning: ignoring file /Users/xxx/node_modules/svf-lib/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
  "SVF::LLVMModuleSet::getSVFValue(llvm::Value const*)", referenced from:
      aliasQuery(SVF::PointerAnalysis*, llvm::Value*, llvm::Value*) in svf-ex.cpp.o
  "SVF::LLVMModuleSet::llvmModuleSet", referenced from:
      aliasQuery(SVF::PointerAnalysis*, llvm::Value*, llvm::Value*) in svf-ex.cpp.o
  "SVF::LLVMModuleSet::LLVMModuleSet()", referenced from:
      aliasQuery(SVF::PointerAnalysis*, llvm::Value*, llvm::Value*) in svf-ex.cpp.o
ld: symbol(s) not found for architecture arm64
clang-14: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [bin/svf-ex] Error 1
make[2]: *** [src/CMakeFiles/svf-ex.dir/all] Error 2
make[1]: *** [src/CMakeFiles/svf-ex.dir/rule] Error 2
make: *** [svf-ex] Error 2

Error happens when compiling SVF-example

when I compile SVF-example in CLion, an error occured, The error message is

/home/xxx/xxx/xxx/SVF-2.2/Release-build/lib/libSvf.a(LLVMModule.cpp.o):在函数‘SVF::LLVMModuleSet::loadModules(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)’中:
LLVMModule.cpp:(.text+0xfbe):对‘llvm::parseIRFile(llvm::StringRef, llvm::SMDiagnostic&, llvm::LLVMContext&, llvm::function_ref<llvm::Optional<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > (llvm::StringRef)>)’未定义的引用

LLVM version I use is 12.0.0
SVF version I use is SVF-2.2
z3 version I use is 4.8.8

How could I fix this?

Refining dependency requirement in Step 0 in README

Without libncurses5-dev, executing the steps described in README would cause a cmake failure:

CMake Error at src/CMakeLists.txt:1 (add_executable):
  Target "svf-example" links to target "Terminfo::terminfo" but the target
  was not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

However, libncurses5-dev is only required in the setup guide of SVF.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.