AngoraFuzzer / Angora

Angora is a mutation-based fuzzer. The main goal of Angora is to increase branch coverage by solving path constraints without symbolic execution.
Apache License 2.0
916 stars 166 forks source link

Fix build on Linux #58

Closed EliaGeretto closed 5 years ago

EliaGeretto commented 5 years ago

The generation of version.config does not work on Linux since, by default, echo does not interpret backslash escapes. The same file should also not be recorded by the VCS, since it is generated during the build process.

The compilation of an LLVM pass should be made with the same compiler used to build LLVM itself. The build system should not force clang since most Linux distribution build LLVM using g++ and thus llvm-config --cxxflags may be incompatible with clang. In that case, g++ should be used for the pass as well.

The last commit adds stdarg.h since va_list is used without including the correct header.

EliaGeretto commented 5 years ago

Apparently the fix for my local machine does not pass CI. I will figure it out.

EliaGeretto commented 5 years ago

The last commit specifies that the compiler should be clang when using the pre-compiled version of LLVM. In this way, the CI build is fixed.

spinpx commented 5 years ago

Thanks for your contribution, EliaGeretto.

The compilation of an LLVM pass should be made with the same compiler used to build LLVM itself. The build system should not force clang since most Linux distribution build LLVM using g++ and thus llvm-config --cxxflags may be incompatible with clang. In that case, g++ should be used for the pass as well.

Agree.

The last commit specifies that the compiler should be clang when using the pre-compiled version of LLVM. In this way, the CI build is fixed.

However, if we export CC to clang by committing https://github.com/AngoraFuzzer/Angora/pull/58/commits/c8521266403d3f506d981a3e5f96788f7fc2b427 , it becomes using clang to compile the passes the same as before.

I merged it to dev branches now. And I will try to fix the CI in another way.

EliaGeretto commented 5 years ago

What you said is true, but c852126 sets the default compiler only when llvm-config is not found in PATH, which is true for CI but not true if one is using a precompiled version of LLVM. In that case, the compiler will remain g++. If instead one is using the version downloaded from the LLVM website, he needs to use clang anyway, because that is the compiler used to compile that one.

This solution, however, is really fragile since the compiler can be changed in a subsequent build. Have you ever considered switching the build system for the LLVM passes to CMake? That would probably make things a little bit more robust.

spinpx commented 5 years ago

Cmake is a better choice. I plan to migrate to it from makefile in the future.