On 13 April 2017 at 13:11, Zhiyi Zhang <xianlingzibiy...@gmail.com> wrote:
>
> Hi,
>
> I tried building KLEE on Ubuntu 16.04 LTS. I have built LLVM-3.4.2 (put Clang 
> into /llvm/tools,then cmake llvm )and STP-2.1.2. After I configured KLEE with 
> "cmake",
>
> cmake -DENABLE_SOLVER_STP=ON  -DENABLE_POSIX_RUNTIME=ON 
> -DENABLE_KLEE_UCLIBC=ON -DKLEE_UCLIBC_PATH=../klee-uclibc  
> -DENABLE_SYSTEM_TESTS=ON  -DENABLE_UNIT_TESTS=OFF  ../klee
>
>
>  I built KLEE with "make", but there were some errors about "kleaver".
>
> "Linking CXX executable ../../bin/kleaver
>
> ...............................
>
> ../../lib/libkleeSupport.a(CompressionStream.cpp.o):(.rodata._ZTIN4klee21compressed_fd_ostreamE[_ZTIN4klee21compressed_fd_ostreamE]+0x10):
>  undefined reference to `typeinfo for llvm::raw_ostream'
>
> collect2: error: ld returned 1 exit status
>
> tools/kleaver/CMakeFiles/kleaver.dir/build.make:105: recipe for target 
> 'bin/kleaver' failed
>
> make[2]: *** [bin/kleaver] Error 1
>
> CMakeFiles/Makefile2:688: recipe for target 
> 'tools/kleaver/CMakeFiles/kleaver.dir/all' failed
>
> make[1]: *** [tools/kleaver/CMakeFiles/kleaver.dir/all] Error 2
>
> Makefile:127: recipe for target 'all' failed
>
> make: *** [all] Error 2"
>

The linking errors are related to RTTI (run time type information).
This is because you built LLVM 3.4 CMake and the built `llvm-config`
binary has a bug where it doesn't
show the `-fno-rtti` flag.

You have two options to fix this

1. Use the LLVM build that you produced using CMake but reconfigure
KLEE by forcing the `-fno-rtti` flag. You will need to make a new
build directory when you do this. Something like this

```
CFLAGS="-fno-rtti" CXXFLAGS="-fno-rtti" cmake -DENABLE_SOLVER_STP=ON
-DENABLE_POSIX_RUNTIME=ON -DENABLE_KLEE_UCLIBC=ON
-DKLEE_UCLIBC_PATH=../klee-uclibc  -DENABLE_SYSTEM_TESTS=ON
-DENABLE_UNIT_TESTS=OFF  ../klee
```

2. Rebuild LLVM using its autoconf/Makefile build system.

This issue seem to keep appearing so we should improve our
documentation to make it explicit that people should avoid building
LLVM 3.4 using CMake.

HTH,
Dan.

_______________________________________________
klee-dev mailing list
klee-dev@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/klee-dev

Reply via email to