[klee-dev] using klee without llvm-gcc?
Daniel Liew
daniel.liew at imperial.ac.uk
Sun Mar 17 14:18:47 GMT 2013
On 17 March 2013 03:20, Hongxu Chen <leftcopy.chx at gmail.com> wrote:
> Dear all,
>
> It seems that
> llvm-gcc-4.2-2.9(http://llvm.org/releases/2.9/llvm-gcc-4.2-2.9.source.tgz)
> suggested by the getting started page of klee has many problems and is
> treated as obsolete by the llvm community. For me, an internal error
> occurred when I built it with an debug version of llvm-2.9. So I have some
> questions about klee:
It is indeed the case that llvm-gcc is obsolete. I found this when I
first started working on KLEE but I ignored the issue as I needed to
work with something that was stable.
> Is it possible to build llvm without llvm-gcc when I have to use klee and
> uclibc? This page(http://klee.llvm.org/GetStarted.html) says that llvm-gcc
> has to be added into $PATH so that llvm would choose llvm-gcc other than gcc
> or clang to build llvm. The key difference is that llvm-gcc generates
> libkleeRuntimeIntrinsic.bca(and the related posix,uclibc runtime .bca
> library; this thread tells the details ). I took a glance at the configure
> file of llvm but didn't figure out how it is done. So I am wondering whether
> clang-compiled llvm also has libkleeRuntimeIntrinsic.bca and the like. I
> came across another project called klee-fp, which uses clang and llvm-3.0;
> additionally they also use uclibc, But there is a compilation error when I
> built klee-fp(actually the error is in the compilation of stp, which is
> inside klee-fp source code folder).
> If those .bca files can only be generated by llvm-gcc, then is there any
> trick when I use llvm-gcc
> binary(http://llvm.org/releases/2.9/llvm-gcc4.2-2.9-x86_64-linux.tar.bz2)
> (instead of building llvm-gcc from souce) to compile llvm? There are still
> some compilation errors for me.
I tried compiling llvm-gcc from source about a year ago I couldn't get
anywhere with it so I just used the llvm-gcc binaries and KLEE will
build fine. There is nothing really stopping you as far as I know from
using clang instead of llvm-gcc to build libkleeRuntimeIntrinsic.bca
and other KLEE bitcode libraries. You should use a version of clang
though that uses the same version of LLVM that you intend to use with
KLEE. KLEE relies on LLVM's build system so for things to work in KLEE
so a LLVM compiler (either llvm-gcc or clang) needs to be detected
(i.e. in PATH) when you configure llvm for building.
This will probably cause you a little bit of hassle if you build llvm
and clang from scratch as you'll probably need to build llvm and clang
using gcc and then build llvm again using your newly built clang
compiler.
If you use your distribution's version of clang and build llvm from
source so that it matches your clang version you will make life easier
for yourself.
Having said that, I don't believe KLEE supports LLVM 3.1 properly (the
IR has changed since llvm 2.9) so expect some issues to appear if you
use clang. I'm also not sure if KLEE's testframe work will behave if
you use clang instead.
KLEE being stuck using llvm-gcc and llvm 2.9 is definitely an issue
which we need to address at some point. It's something that personally
I'd like to address as well.
Regards,
Dan Liew.
More information about the klee-dev
mailing list