[LLVMdev] Compile a project into LLVM Bitcode

Julien Henry Julien.Henry at imag.fr
Fri May 20 08:25:47 PDT 2011


> You can use Clang to compile source to bitcode:
>
> clang -c hello.c -emit-llvm -o hello.bc
>

Yes.
My problem is to automatically create .bc files with ./configure && 
make. Ideally, when compiling a project like "grep", I'd like to obtain 
a single .bc file containing all the project's functions, instead of the 
grep binary executable.

I already tried things like
CC=clang CFLAGS=-emit-llvm ./configure

But the ./configure fails (indeed, .bc files are not executable, so 
configure says the C compiler doesn't work)

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for gawk... (cached) gawk
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/local/jhenry/examples/grep-2.8':
configure: error: C compiler cannot create executables
See `config.log' for more details



More information about the llvm-dev mailing list