Public bug reported:

I am using Kubuntu Raring 64-bit. I have recently started using Clang
for my C/C++ compilation work.

-O4 option in Clang means link-time optimization via LLVM, which
requires LLVMgold.so, which obviously requires gold. However, currently
llvm-dev which provides LLVMgold.so doesn't depend on binutils-gold.

Please observe the following session transcript:

----

[samjnaa:~/bn/c/llvmgold-test] cat increment.c
int increment ( int a ) { return a + 1 ; }

[samjnaa:~/bn/c/llvmgold-test] clang -O4 -c increment.c -fPIC -Wall
-Wextra

[samjnaa:~/bn/c/llvmgold-test] clang -O4 -shared -o increment.so increment.o 
-fPIC -Wall -Wextra
/usr/bin/ld: /usr/bin/../lib/LLVMgold.so: error loading plugin: 
/usr/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or 
directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

[samjnaa:~/bn/c/llvmgold-test] sudo apt-get install llvm-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  llvm-dev
0 upgraded, 1 newly installed, 0 to remove and 48 not upgraded.
Need to get 0 B/1,226 B of archives.
After this operation, 50.2 kB of additional disk space will be used.
Selecting previously unselected package llvm-dev.
(Reading database ... 178440 files and directories currently installed.)
Unpacking llvm-dev (from .../llvm-dev_3.2-16~exp1_amd64.deb) ...
Setting up llvm-dev (1:3.2-16~exp1) ...

[samjnaa:~/bn/c/llvmgold-test] clang -O4 -shared -o increment.so increment.o 
-fPIC -Wall -Wextra
increment.o: file not recognized: File format not recognized
clang: error: linker command failed with exit code 1 (use -v to see invocation)

[samjnaa:~/bn/c/llvmgold-test] sudo apt-get install binutils-gold
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  binutils-gold
0 upgraded, 1 newly installed, 0 to remove and 48 not upgraded.
Need to get 0 B/1,512 B of archives.
After this operation, 47.1 kB of additional disk space will be used.
Selecting previously unselected package binutils-gold.
(Reading database ... 178448 files and directories currently installed.)
Unpacking binutils-gold (from .../binutils-gold_2.23.2-2ubuntu1_amd64.deb) ...
Adding 'diversion of /usr/bin/ld to /usr/bin/ld.bfd-link by binutils-gold'
Adding 'diversion of /usr/share/man/man1/ld.1.gz to 
/usr/share/man/man1/ld.bfd-link.1.gz by binutils-gold'
Processing triggers for man-db ...
Setting up binutils-gold (2.23.2-2ubuntu1) ...

[samjnaa:~/bn/c/llvmgold-test] clang -O4 -shared -o increment.so -fPIC
-Wall -Wextra increment.o

[samjnaa:~/bn/c/llvmgold-test]

----

So evidently llvm-dev requires binutils-gold to be there for it to be
usable. Therefore please make it so that llvm-dev depends on binutils-
gold.

Two other points:

1. I'm not very clear about why LLVMgold.so is placed in llvm-dev
instead of something like llvm-gold-plugin -- but I'll leave the
decision to the maintainers.

2. This is probably an upstream Debian bug but since I don't use that
distro I am reporting it here. Please take it upstream if appropriate.

** Affects: llvm-defaults (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1186328

Title:
  llvm-dev should depend on binutils-gold

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1186328/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to