[LLVMdev] Replace gcc with llvm-gcc???

Óscar Fuentes ofv at wanadoo.es
Mon Sep 14 18:16:10 PDT 2009


zhunan <zhunansjtu at gmail.com> writes:

> Recently I met a question when I want to replace gcc with llvm-gcc
> through configure script(command).
>
> For simply,described like that
>
> I typed as following
>
> 1.zhunan at sjtu:~/workplace/$ ./configure CC=llvm-gcc CFLAGS="-S
> -emit-llvm"
>
> configure will failed when it checks whether C compiler is working
>
> 2.zhunan at sjtu:~/workplace/$ ./configure CC=llvm-gcc CFLAGS="-c
> -emit-llvm"
>
> configure will failed when it checks the default output filename,just
> means the C compiler cannot create executables.
>
>
> I would like to know what's the matter with this replacing attempt?and
> any possibility to overcome the trouble?

Your CFLAGS is telling llvm-gcc that it must not produce an object code
file nor an executable file, but something else (llvm assembler on your
first attempt and llvm bitcode on your second attempt).

`configure' needs a fully working compiler toolset, which means that the
compiler must be able to produce executable files. Your CFLAGS setting
is preventing this.

Execute `configure' with just CC=llvm-gcc and then try

make CFLAGS="-emit-llvm"

if you want LLVM bitcode or

make CFLAGS="-S -emit-llvm"

if you want LLVM assembler.

`make' will fail at the linking phase, but you will have a set of LLVM
bitcode/assembler files for each of your C source files.

If you simply want to replace gcc with llvm-gcc for building your
software, forget about CFLAGS and just do

./configure CC=llvm-gcc && make

-- 
Óscar




More information about the llvm-dev mailing list