Guoliang Jin
2010-Jun-28 03:23 UTC
[LLVMdev] libLLVMgold.so: could not load plugin library
On 6/26/2010 10:30 AM, Rafael Espindola wrote:>> So the gold and the LLVMgold are linked against the same libstdc++. I am >> using the gcc at /s/gcc-4.3.1/i386_rhel5/bin to compile the LLVM chain. > Can you run llvm-gcc again with -Wl,-debug? This will show the linker > line being used. You can then run gdb on it. Try to find what error is > dlopen reporting. I wonder if gold is calling perror or not when > dlopen fails (assuming it is dlopen that is failing).The -Wl,-debug result is like this: $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld -plugin $LLVMGCCPREFIX/libexec/gcc/i686-pc-linux-gnu/4.2.1/libLLVMgold.so -plugin-opt=as=as --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/crtbegin.o -L$LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1 -L$LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../.. /tmp/ccnyauaa.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/crtend.o /usr/lib/crtn.o $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: error: $LLVMGCCPREFIX/libexec/gcc/i686-pc-linux-gnu/4.2.1/libLLVMgold.so: could not load plugin library $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: error: /tmp/ccnyauaa.o:1:3: invalid character $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: error: /tmp/ccnyauaa.o:1:3: syntax error, unexpected $end $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: error: /tmp/ccnyauaa.o: not an object or archive $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: /usr/lib/crt1.o:(.text+0x18): error: undefined reference to 'main' What should I do on gdb?
Rafael Espindola
2010-Jun-28 03:35 UTC
[LLVMdev] libLLVMgold.so: could not load plugin library
> The -Wl,-debug result is like this: > $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld > -plugin $LLVMGCCPREFIX/libexec/gcc/i686-pc-linux-gnu/4.2.1/libLLVMgold.so > -plugin-opt=as=as --eh-frame-hdr -m elf_i386 -dynamic-linker > /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o > $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/crtbegin.o > -L$LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1 > -L$LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../.. /tmp/ccnyauaa.o > -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s > --no-as-needed $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/crtend.o > /usr/lib/crtn.o > $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: > error: $LLVMGCCPREFIX/libexec/gcc/i686-pc-linux-gnu/4.2.1/libLLVMgold.so: > could not load plugin library > $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: > error: /tmp/ccnyauaa.o:1:3: invalid character > $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: > error: /tmp/ccnyauaa.o:1:3: syntax error, unexpected $end > $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: > error: /tmp/ccnyauaa.o: not an object or archive > $LLVMGCCPREFIX/lib/gcc/i686-pc-linux-gnu/4.2.1/../../../../i686-pc-linux-gnu/bin/ld: > /usr/lib/crt1.o:(.text+0x18): error: undefined reference to 'main' > > What should I do on gdb? >Try to run just that ld command first. Same error message? Run in in gdb and set a breakpoint just before gold tries to load the plugin. Sorry, I am really out of ideas on what is going wrong here... Cheers, -- Rafael Ávila de Espíndola
Guoliang Jin
2010-Jun-28 18:46 UTC
[LLVMdev] libLLVMgold.so: could not load plugin library
On 6/27/2010 10:35 PM, Rafael Espindola wrote:> Try to run just that ld command first. Same error message? Run in in > gdb and set a breakpoint just before gold tries to load the plugin. > Sorry, I am really out of ideas on what is going wrong here...It is the same error message . Can you tell me which gcc version are you using to compile the llvm chain, and also the binutils svn version number? I noticed the dlopen is inside /lib/ld-linux.so.2, and my version of glibc is 2.5, is this too old? Thanks.