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

llvm_mode/libcxx/compile.sh fails #65

Closed adrianherrera closed 5 years ago

adrianherrera commented 5 years ago

Hi there,

I am trying to compile a C++ driver similar to afl_driver.cpp so that I can use Angora on Google's test suite, but I am getting issues regarding C++ header files not being found (e.g., when compiling target libjpegturbo it complains that the memory header file cannot be found). I am using LLVM 7.0.0.

After a bit of digging, I think it's because I am not using the LLVM C++ stdlib ( as described in this doc).

I tried to run the compile.sh script and received the following error:

-- Check for working C compiler: /home/anngora/bin/angora-clang
-- Check for working C compiler: /home/angora/bin/angora-clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/angora/bin/angora-clang++
-- Check for working CXX compiler: /home/angora/bin/angora-clang++ -- broken
CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "/home/angora/bin/angora-clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/angora/build_track/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/ninja" "cmTC_8f865"
    [1/2] Building CXX object CMakeFiles/cmTC_8f865.dir/testCXXCompiler.cxx.o
    angora-llvm-pass
    [+] Fast Mode.
    ModName: testCXXCompiler.cxx -- 2709996875
    [2/2] Linking CXX executable cmTC_8f865
    FAILED: cmTC_8f865 
    : && /home/angora/bin/angora-clang++     CMakeFiles/cmTC_8f865.dir/testCXXCompiler.cxx.o  -o cmTC_8f865   && :
    ld: error: cannot find -lc++abi
    clang-7: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.

Am I misunderstanding how to compile C++ programs?

spinpx commented 5 years ago

Hi adrianherrera , Have you set

export LD_LIBRARY_PATH=/path-to-clang/lib:$LD_LIBRARY_PATH
adrianherrera commented 5 years ago

Ah right, when I use your LLVM install script it works fine. It just wasn't working with my system LLVM. Thanks!