[LLVMdev] How to compile apps to bc files with the new llvm-gcc4?

Domagoj Babic babic.domagoj at gmail.com
Sat Dec 9 22:42:28 PST 2006


Hi,

I'm trying to compile some apps with the new llvm-gcc4 on amd64 linux
to .bc files, rather than to the native code. The same process I used to
build those apps before with llvm-gcc3 doesn't work:

1)
export CC=llvm-gcc CXX=llvm-g++ CFLAGS="-g -fno-inline" CXXFLAGS="-g
-fno-inline"
2) cd <whatever-app>; ./configure
3) make CFLAGS+=-emit-llvm CXXFLAGS+=-emit-llvm
[Reid told me not to pass -emit-llvm to configure scripts.]

The process fails for the same reason on several apps I tried:

--------------------------------------------------------------
$ llvm-gcc -shared  .libs/libdspam.o .libs/heap.o .libs/diction.o
.libs/base64.o .libs/buffer.o .libs/util.o .libs/nodetree.o
.libs/error.o .libs/decode.o .libs/pref.o .libs/config_shared.o
.libs/bnr.o .libs/hash.o .libs/list.o .libs/ldap_client.o
.libs/tokenizer.o .libs/hash_drv.o  -lm -ldl  -Wl,-soname
-Wl,libdspam.so.7 -o .libs/libdspam.so.7.0.0 -v

Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../dst-directory/configure --disable-shared
--prefix=/usr/local/devapps/llvm --enable-languages=c,c++
--enable-llvm=/work/projects/llvm-obj --program-prefix=llvm-
--enable-checking --disable-multilib
Thread model: posix
gcc version 4.0.1 LLVM (Apple Computer, Inc. build 5421)
 /usr/local/devapps/llvm/libexec/gcc/x86_64-unknown-linux-gnu/4.0.1/collect2
--eh-frame-hdr -m elf_x86_64 -shared -o .libs/libdspam.so.7.0.0
/usr/lib/../lib64/crti.o
/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1/crtbeginS.o
-L/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1
-L/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1/../../../../lib64
-L/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1/../../..
-L/lib/../lib64 -L/usr/lib/../lib64 .libs/libdspam.o .libs/heap.o
.libs/diction.o .libs/base64.o .libs/buffer.o .libs/util.o
.libs/nodetree.o .libs/error.o .libs/decode.o .libs/pref.o
.libs/config_shared.o .libs/bnr.o .libs/hash.o .libs/list.o
.libs/ldap_client.o .libs/tokenizer.o .libs/hash_drv.o -lm -ldl
-soname libdspam.so.7 -lgcc -lc -lgcc
/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1/crtendS.o
/usr/lib/../lib64/crtn.o
/usr/bin/ld:.libs/libdspam.o: file format not recognized; treating as
linker script
/usr/bin/ld:.libs/libdspam.o:1: syntax error
collect2: ld returned 1 exit status
--------------------------------------------------------------

If I execute the last command manually with llvm-ld, removing -shared
and -Wl, it goes through.


So, obviously I'm doing something wrong.

What do I need to change in the build process to compile the same apps
I could compile before with llvm-gcc3 to bc files?


Thx in advance,
            Domagoj



More information about the llvm-dev mailing list