[LLVMdev] clang looking for gold plugin when used with '-emit-llvm' option

Jim Grosbach grosbach at apple.com
Wed May 16 18:11:23 PDT 2012


No worries. That's a much easier thing to fix than a bug in the tools!

FWIW, the error message is effectively saying that your system linker isn't set up to do LLVM link-time-optimization (which uses bitcode object files). That's probably normal, just a horrid error message.

-Jim
On May 16, 2012, at 6:08 PM, Ashok Nalkund <ashoknn at qualcomm.com> wrote:

> MY BAD (in caps)...really sorry to have bothered. I was thinking of -S -E options but forgot the -c option.
> 
> clang -c -emit-llvm test.c
> lli test.o
> 
> both work fine :).
> 
> Thanks,
> ashok
> 
> On 5/16/2012 5:45 PM, Jim Grosbach wrote:
>> Are you intending to try to link? That error message isn't coming from clang, but from /usr/bin/ld. If you just want the bitcode for the one source file, you need to pass "-c" as well, just like if you want an object file.
>> 
>> -Jim
>> On May 16, 2012, at 5:39 PM, Ashok Nalkund<ashoknn at qualcomm.com>  wrote:
>> 
>>> Resending, can somebody please help?
>>> 
>>> On 5/16/2012 2:47 PM, Ashok Nalkund wrote:
>>>> Hi All,
>>>>    I built the binaries from the 3.1 final tag
>>>> (http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_31/final/ etc) as below:
>>>> 
>>>>> ../llvm/configure --enable-targets=host-only --prefix=/local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin
>>>>> make install
>>>> 
>>>>   I notice that I can compile a program using clang as below:
>>>> 
>>>>> ashoknn at ashoknn-vm:/local/mnt/workspace/ashoknn/crd/neo/temp/jit$clang test.c
>>>>> ashoknn at ashoknn-vm:/local/mnt/workspace/ashoknn/crd/neo/temp/jit$
>>>> 
>>>>   If I try to generate the bitcode only, it gives an error:
>>>>> ashoknn at ashoknn-vm:/local/mnt/workspace/ashoknn/crd/neo/temp/jit$clang -emit-llvm test.c
>>>>> /usr/bin/ld: /local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin/bin/../lib/LLVMgold.so: error loading plugin
>>>>> /usr/bin/ld: /local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin/bin/../lib/LLVMgold.so: error in plugin cleanup (ignored)
>>>>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>>>>> ashoknn at ashoknn-vm:/local/mnt/workspace/ashoknn/crd/neo/temp/jit$
>>>> 
>>>> I then ran it with -v option and it produces:
>>>>> ashoknn at ashoknn-vm:/local/mnt/workspace/ashoknn/crd/neo/temp/jit$clang -emit-llvm test.c -v
>>>>> clang version 3.1 (tags/RELEASE_31/final 156878)
>>>>> Target: x86_64-unknown-linux-gnu
>>>>> Thread model: posix
>>>>>  "/local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -disable-free -main-file-name test.c -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 2.21.0.20110327 -momit-leaf-frame-pointer -v -resource-dir /local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin/bin/../lib/clang/3.1 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/local/include -internal-isystem /local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin/bin/../lib/clang/3.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /local/mnt/workspace/ashoknn/crd/neo/temp/jit -ferror-limit 19 -fmessage-length 177 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor!
 -d!
>>> ia!
>>>>  gnostics
>>>>  -o /tmp/test-LU0kNI.o -x c test.c
>>>>> clang -cc1 version 3.1 based upon LLVM 3.1 default target x86_64-unknown-linux-gnu
>>>>> ignoring nonexistent directory "/include"
>>>>> #include "..." search starts here:
>>>>> #include<...>   search starts here:
>>>>>  /usr/local/include
>>>>>  /local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin/bin/../lib/clang/3.1/include
>>>>>  /usr/include/x86_64-linux-gnu
>>>>>  /usr/include
>>>>> End of search list.
>>>>>  "/usr/bin/ld" -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o a.out /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/../../../../x86_64-linux-gnu/crt1.o /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/../../../../x86_64-linux-gnu/crti.o /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/crtbegin.o -L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5 -L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/../../../../x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/../../../../../lib64 -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64 -L/usr/lib/x86_64-linux-gnu/../../lib64 -L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/../../../.. -L/lib -L/usr/lib -plugin /local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin/bin/../lib/LLVMgold.so /tmp/test-LU0kNI.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /u!
 sr!
>>> /l!
>>>>  ib/x86_6
>>>> 4-linux-gnu/gcc/x86_64-linux-gnu/4.5/crtend.o /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5/../../../../x86_64-linux-gnu/crtn.o
>>>>> /usr/bin/ld: /local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin/bin/../lib/LLVMgold.so: error loading plugin
>>>>> /usr/bin/ld: /local/mnt/workspace/ashoknn/crd/neo/llvmsvn/build/bin/bin/../lib/LLVMgold.so: error in plugin cleanup (ignored)
>>>>> clang: error: linker command failed with exit code 1 (use -v to see invocation)
>>>>> ashoknn at ashoknn-vm:/local/mnt/workspace/ashoknn/crd/neo/temp/jit$
>>>> 
>>>> Any clues?
>>>> 
>>>> TIA,
>>>> Ashok
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list