compiling llvm-gcc4 on ubuntu

hello,

i am new to llvm and can't manage to compile the gcc backend.

my steps:
i compile the llvm-source first as suggested in "README.LLVM"
that works fine and without any issues.

then i make a new dir called build. from there i do the following:

stefan@ubuntu:~/programs/llvm/build$ ../llvm-gcc4-1.9.source/configure --enable-languages=c,c++ --prefix=/usr/local/ --disable-shared
then after some time i get the follwing error:

make[2]: Entering directory '/home/stefan/programs/llvm/build/gcc'
/home/stefan/programs/llvm/build/gcc/xgcc -B/home/stefan/programs/llvm/build/gcc/ -B/usr/local//i686-pc-linux-gnu/bin/ -B/usr/local//i686-pc-linux-gnu/lib/ -isystem /usr/local//i686-pc-linux-gnu/include -isystem /usr/local//i686-pc-linux-gnu/sys-include -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../llvm-gcc4-1.9.source/gcc -I../../llvm-gcc4-1.9.source/gcc/. -I../../llvm-gcc4-1.9.source/gcc/../include -I../../llvm-gcc4-1.9.source/gcc/../libcpp/include -DL_mulvdi3 -c ../../llvm-gcc4-1.9.source/gcc/libgcc2.c -o
libgcc/./_mulvdi3.o
../../llvm-gcc4-1.9.source/gcc/libgcc2.c:403: internal compiler error: in
prune_unused_types_update_strings, at dwarf2out.c:14372
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://llvm.org/bugs&gt; for instructions.
make[2]: *** [libgcc/./_mulvdi3.o] Error 1
make[2]: Leaving directory '/home/stefan/programs/llvm/build/gcc'
make[1]: *** [libgcc.a] Error 2
make[1]: Leaving directory '/home/stefan/programs/llvm/build/gcc'
make: *** [all-gcc] Error 2

if you need more information - just ask me :slight_smile:

thanks a lot for your help.

Hi Stefan,

hello,

i am new to llvm and can't manage to compile the gcc backend.

Okay. Did you read: http://llvm.org/docs/GettingStartedGuide.html ?

my steps:
i compile the llvm-source first as suggested in "README.LLVM"
that works fine and without any issues.

Okay.

then i make a new dir called build. from there i do the following:

stefan@ubuntu:~/programs/llvm/build$ ../llvm-gcc4-1.9.source/configure --enable-languages=c,c++ --prefix=/usr/local/ --disable-shared

A few issues here:
     1. This looks like the 1.9 version of llvm-gcc. Is your LLVM also
        the 1.9 version? If not, it definitely won't work (llvm-gcc4 and
        llvm must stay closely in sync).
     2. This configure line is not correct for llvm-gcc4. At the very
        least you need --enable-llvm=/path/to/llvm/build/root. You might
        also consider --disable-nls if you don't care about national
        language support (makes build faster). Finally, if you built
        llvm debug (the default if you checked it out from CVS), then
        you should also have --enable-checking (to build llvm-gcc debug
        as well).

then after some time i get the follwing error:

I think you also did "make"

make[2]: Entering directory '/home/stefan/programs/llvm/build/gcc'
/home/stefan/programs/llvm/build/gcc/xgcc -B/home/stefan/programs/llvm/build/gcc/ -B/usr/local//i686-pc-linux-gnu/bin/ -B/usr/local//i686-pc-linux-gnu/lib/ -isystem /usr/local//i686-pc-linux-gnu/include -isystem /usr/local//i686-pc-linux-gnu/sys-include -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../llvm-gcc4-1.9.source/gcc -I../../llvm-gcc4-1.9.source/gcc/. -I../../llvm-gcc4-1.9.source/gcc/../include -I../../llvm-gcc4-1.9.source/gcc/../libcpp/include -DL_mulvdi3 -c ../../llvm-gcc4-1.9.source/gcc/libgcc2.c -o
libgcc/./_mulvdi3.o
../../llvm-gcc4-1.9.source/gcc/libgcc2.c:403: internal compiler error: in
prune_unused_types_update_strings, at dwarf2out.c:14372
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://llvm.org/bugs&gt; for instructions.

I'm not sure what this is about. Likely its related to one of the issues
above.

make[2]: *** [libgcc/./_mulvdi3.o] Error 1
make[2]: Leaving directory '/home/stefan/programs/llvm/build/gcc'
make[1]: *** [libgcc.a] Error 2
make[1]: Leaving directory '/home/stefan/programs/llvm/build/gcc'
make: *** [all-gcc] Error 2

if you need more information - just ask me :slight_smile:

Versions, platform, etc. of everything would help.

Reid.

ok thanks a lot. i think the "--enable-llvm=..." command did it for me. in
fact i have to admit that i got confused because when i started i followed
the instaructions in README.LLVM step by step. that braught me an error
somewhere with the problem that "libstdc++.so.6" was searching for GCC4.2.0
which doesn't exist on my system ("libstdc++.so.6" is of version 4.1.0?!)

then i found the script with which the 1.8 - versions included in the package
list of ubuntu were built - here i also found the "--disable-shared" switch.
so i took the configure syntax of the script and ran into the other error. it
was a bit silly of me not to try to merge both :wink:

my suggestion:
add in README.LLVM for the linux-section that in the case one sees the error
with GCC4.2.0 the switch "--disable-shared" should be added to the configure
command.

nevertheless thanks a lot for your help!!

Hello, Stefan

my suggestion:
add in README.LLVM for the linux-section that in the case one sees the error
with GCC4.2.0 the switch "--disable-shared" should be added to the configure
command.

It's already there. At least on HEAD. Probably, it was missed in 1.9
release, sorry. It's PR1017.