Error while compiling mysql using LLVM-gold

Hello,

I am trying to compile mysql using LLVM and I am found the following
"If you just want to use *LLVM*'s link-time optimizations, you will need to
use the libLTO library with your linker. Your linker, in turn, must be
able to support plugins (like the gold linker, for example). For
directions on how to set up libLTO, see
http://*llvm*.org/docs/LinkTimeOptimization.html <http://llvm.org/docs/LinkTimeOptimization.html> and
http://*llvm*.org/docs/GoldPlugin.html <http://llvm.org/docs/GoldPlugin.html>. "
at http://old.nabble.com/Compile-a-large-project-with-llvm--td27793811.html

However, I got
"...
checking for gcc... llvm-gcc -use-gold-plugin
checking for C compiler default output file name...
...
configure: error: C compiler cannot create executables
..."
when I following those instructions.

Any experience on compiling autotooled projects using LLVM is welcome. Some online resource on this topic will be great. I am new to this list, and I guess this topic may be discussed before.

Thanks,
Guoliang

However, I got
"...
checking for gcc... llvm-gcc -use-gold-plugin
checking for C compiler default output file name...
...
configure: error: C compiler cannot create executables
..."
when I following those instructions.

Any experience on compiling autotooled projects using LLVM is welcome.
Some online resource on this topic will be great. I am new to this list,
and I guess this topic may be discussed before.

Can you look in the config.log to see what the error was? Can you use
llvm-gcc -use-gold-plugin in the command line?

Thanks,
Guoliang

Cheers,

The errors are
/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found
/lib/libc.so.6: version `GLIBC_2.7' not found

I can not use it in the command line...

Rafael Espindola wrote:

Some things to check:

Run llvm-gcc a.c -emit-llvm -use-gold-plugin -Wl,debug

This will print the link command line. What is it? Do you get the same error messages if you run just that?

Are gold and the plugin linked with the same libstdc++?

Cheers

Thanks Rafael.

I compiled llvm-gcc by myself, and I can compile mysql now.

Right now, when I run llvm-gcc a.c -emit-llvm -use-gold-plugin -Wl,debug
I got
ld: error: cannot open debug: No such file or directory
collect2: ld returned 1 exit status

I do not know why this is happening.

Rafael Espindola wrote:

It Is -Wl,-debug. Sorry about that.

Cheers,

Rafael Espindola wrote:

Thanks Rafael. With the local compiled llvm-gcc, it compiles now, and
"-Wl,-debug" gives reasonable output. However, I still do not see the
bitcode file for those large software like apache while complied using the
gold plugin...

Normally it is all done in the plugin. Are you passing -emit-llvm to
llvm-gcc? If so, running file in one of the .o should show "data" and
you can get a combined bitcode file by passing
-Wl,-plugin-opt=also-emit-llvm to the final link line. So if you do

gcc a.o b.o -o foo -Wl,-plugin-opt=also-emit-llvm

you will get two files, foo and foo.bc. The first one is an elf file,
the second one is bitcode.

Cheers,