facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.97k stars 2.02k forks source link

question about make ./configure? #1044

Closed b0207191 closed 5 years ago

b0207191 commented 5 years ago

when i run ./configure, it occurs as following

checking for ocamlmklib... /usr/local/bin/ocamlmklib checking for ocamldoc... /usr/local/bin/ocamldoc checking for ocamlbuild... no checking if OCaml version is >= 4.06.1... yes checking for ocamlbuild... no configure: error: ocamlbuild not found.

root@OptiPlex-390:/toolsrc/infer-master# ocaml --version The OCaml toplevel, version 4.06.1

i think i have installed ocaml with version 4.06.1

jvillard commented 5 years ago

The simplest way to build infer is with ./build-infer.sh. It will install the opam dependencies for you, such as ocamlbuild. After that you can rebuild infer as you like with ./configure && make.

b0207191 commented 5 years ago

thanks to jvllard, and i want to parse C code, but i met a question as following: ...... configure: creating ./config.status config.status: creating Makefile.autoconf ./build-infer.sh: 行 165: facebook-clang-plugins/clang/setup.sh: no such file or dir

Warning: you are not using a release of Infer. The C and Objective-C analyses require a custom clang to be compiled now. This step takes ~30-60 minutes, possibly more.

To speed this along, you are encouraged to use a release of Infer instead:

http://fbinfer.com/docs/getting-started.html

If you are only interested in analyzing Java programs, simply run this script with only the "java" argument:

./build-infer.sh java

Are you sure you want to compile clang? (y/N) y bash: 行 3: /toolsrc/infer-master/facebook-clang-plugins/clang/setup.sh: no such file or dir bash: 行 4: /toolsrc/infer-master/facebook-clang-plugins/clang/setup.sh: no such file or dir Makefile:307: recipe for target 'clang_setup' failed make: *** [clang_setup] Error 127

compilation failure; you can try running

make clean './build-infer.sh' clang

b0207191 commented 5 years ago

and i have installed clang on this env

infer-master# clang --version clang version 7.0.0 (tags/RELEASE_700/final) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/bin

jvillard commented 5 years ago

@b0207191 How did you get the sources of infer? You should get them by cloning the github repo.

GitHub generates .zip and .tar.gz or the sources but they are unusable because they do not contain the submodule in facebook-clang-plugins.

b0207191 commented 5 years ago

@jvllard, thanks, i add clang-plugin so that can continue to complie, but then it happens , i wonder how many memory it need?

[ 94%] Building CXX object tools/llvm-isel-fuzzer/CMakeFiles/llvm-isel-fuzzer.dir/DummyISelFuzzer.cpp.o [ 94%] Building CXX object tools/llvm-isel-fuzzer/CMakeFiles/llvm-isel-fuzzer.dir/llvm-isel-fuzzer.cpp.o [ 94%] Linking CXX executable ../../bin/llvm-isel-fuzzer clang-7: error: unable to execute command: Killed clang-7: error: linker command failed due to signal (use -v to see invocation) tools/llvm-isel-fuzzer/CMakeFiles/llvm-isel-fuzzer.dir/build.make:271: recipe for target 'bin/llvm-isel-fuzzer' failed make[3]: *** [bin/llvm-isel-fuzzer] Error 254 make[3]: leave directory “/tmp/clang-setup.L8anPk/build”

jvillard commented 5 years ago

Compiling clang is very memory-hungry. We limit the number of parallel jobs to try and avoid running out of memory, but you can also override it yourself by running JOBS=1 ./facebook-clang-plugins/clang/setup.sh.

https://github.com/facebook/facebook-clang-plugins/blob/81d8438a4e415c6f56ed317f86193a1acc56bfcd/clang/setup.sh#L18

jvillard commented 5 years ago

Hopefully this is resolved, closing the issue optimistically. Feel free to reopen if you have more questions.