Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LLVMgold.so doesn't be copied to lib directory when make-install #84271

Closed
emelife opened this issue Mar 7, 2024 · 9 comments · Fixed by #87567
Closed

LLVMgold.so doesn't be copied to lib directory when make-install #84271

emelife opened this issue Mar 7, 2024 · 9 comments · Fixed by #87567
Labels
cmake Build system in general and CMake in particular llvm-tools All llvm tools that do not have corresponding tag

Comments

@emelife
Copy link

emelife commented Mar 7, 2024

llvm/tools/gold/CMakeLists.txt

image

I think here add_llvm_library should add INSTALL_WITH_TOOLCHAIN parameter.

@emelife emelife changed the title LLVMgold.so doesn't work when make-install LLVMgold.so doesn't be copied to lib directory when make-install Mar 7, 2024
@EugeneZelenko EugeneZelenko added cmake Build system in general and CMake in particular llvm-tools All llvm tools that do not have corresponding tag and removed new issue labels Mar 7, 2024
@l2dy
Copy link

l2dy commented Mar 23, 2024

Is this related to LLVMgold.so missing from llvm-18-linker-tools on https://apt.llvm.org/?

$ curl -s 'https://apt.llvm.org/jammy/pool/main/l/llvm-toolchain-18/llvm-18-linker-tools_18.1.2~%2B%2B20240319123516%2B7fd9979eb9cf-1~exp1~20240319003547.83_amd64.deb' | bsdtar -xOvf - data.tar.zst 2>/dev/null | bsdtar -tvf -
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/bfd-plugins/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/llvm-18/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/llvm-18/lib/
-rw-r--r--  0 root   root  3944048 Mar 19 08:35 ./usr/lib/llvm-18/lib/LLVMPolly.so
-rw-r--r--  0 root   root    74128 Mar 19 08:35 ./usr/lib/llvm-18/lib/libLTO.so.18.1
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/share/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/share/doc/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/share/doc/llvm-18-linker-tools/
-rw-r--r--  0 root   root    64358 Mar 19 08:35 ./usr/share/doc/llvm-18-linker-tools/changelog.Debian.gz
-rw-r--r--  0 root   root     6897 Mar 19 08:34 ./usr/share/doc/llvm-18-linker-tools/copyright
lrwxrwxrwx  0 root   root        0 Mar 19 08:35 ./usr/lib/bfd-plugins/LLVMgold-18.so -> ../llvm-18/lib/LLVMgold.so
$ curl -s 'https://apt.llvm.org/jammy/pool/main/l/llvm-toolchain-17/llvm-17-linker-tools_17.0.6~%2B%2B20231209124227%2B6009708b4367-1~exp1~20231209124336.77_amd64.deb' | bsdtar -xOvf - data.tar.zst 2>/dev/null | bsdtar -tvf -
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/bfd-plugins/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/llvm-17/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/llvm-17/lib/
-rw-r--r--  0 root   root  3980856 Dec  9 20:43 ./usr/lib/llvm-17/lib/LLVMPolly.so
-rw-r--r--  0 root   root    85648 Dec  9 20:43 ./usr/lib/llvm-17/lib/LLVMgold.so
-rw-r--r--  0 root   root    61296 Dec  9 20:43 ./usr/lib/llvm-17/lib/libLTO.so.17
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/share/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/share/doc/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/share/doc/llvm-17-linker-tools/
-rw-r--r--  0 root   root    62292 Dec  9 20:43 ./usr/share/doc/llvm-17-linker-tools/changelog.Debian.gz
-rw-r--r--  0 root   root     6897 Dec  9 20:41 ./usr/share/doc/llvm-17-linker-tools/copyright
lrwxrwxrwx  0 root   root        0 Dec  9 20:43 ./usr/lib/bfd-plugins/LLVMgold-17.so -> ../llvm-17/lib/LLVMgold.so

@0vercl0k
Copy link

0vercl0k commented Mar 28, 2024

I'm also noticing some of my CI failing on ubuntu-latest because of this I think (latest llvm installed w/ sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"):

/usr/bin/ld: /usr/lib/llvm-18/bin/../lib/LLVMgold.so: error loading plugin: /usr/lib/llvm-18/bin/../lib/LLVMgold.so: cannot open shared object file: No such file or directory

@emelife
Copy link
Author

emelife commented Mar 28, 2024

Is this related to LLVMgold.so missing from llvm-18-linker-tools on https://apt.llvm.org/?

$ curl -s 'https://apt.llvm.org/jammy/pool/main/l/llvm-toolchain-18/llvm-18-linker-tools_18.1.2~%2B%2B20240319123516%2B7fd9979eb9cf-1~exp1~20240319003547.83_amd64.deb' | bsdtar -xOvf - data.tar.zst 2>/dev/null | bsdtar -tvf -
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/bfd-plugins/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/llvm-18/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/lib/llvm-18/lib/
-rw-r--r--  0 root   root  3944048 Mar 19 08:35 ./usr/lib/llvm-18/lib/LLVMPolly.so
-rw-r--r--  0 root   root    74128 Mar 19 08:35 ./usr/lib/llvm-18/lib/libLTO.so.18.1
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/share/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/share/doc/
drwxr-xr-x  0 root   root        0 Mar 19 08:35 ./usr/share/doc/llvm-18-linker-tools/
-rw-r--r--  0 root   root    64358 Mar 19 08:35 ./usr/share/doc/llvm-18-linker-tools/changelog.Debian.gz
-rw-r--r--  0 root   root     6897 Mar 19 08:34 ./usr/share/doc/llvm-18-linker-tools/copyright
lrwxrwxrwx  0 root   root        0 Mar 19 08:35 ./usr/lib/bfd-plugins/LLVMgold-18.so -> ../llvm-18/lib/LLVMgold.so
$ curl -s 'https://apt.llvm.org/jammy/pool/main/l/llvm-toolchain-17/llvm-17-linker-tools_17.0.6~%2B%2B20231209124227%2B6009708b4367-1~exp1~20231209124336.77_amd64.deb' | bsdtar -xOvf - data.tar.zst 2>/dev/null | bsdtar -tvf -
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/bfd-plugins/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/llvm-17/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/lib/llvm-17/lib/
-rw-r--r--  0 root   root  3980856 Dec  9 20:43 ./usr/lib/llvm-17/lib/LLVMPolly.so
-rw-r--r--  0 root   root    85648 Dec  9 20:43 ./usr/lib/llvm-17/lib/LLVMgold.so
-rw-r--r--  0 root   root    61296 Dec  9 20:43 ./usr/lib/llvm-17/lib/libLTO.so.17
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/share/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/share/doc/
drwxr-xr-x  0 root   root        0 Dec  9 20:43 ./usr/share/doc/llvm-17-linker-tools/
-rw-r--r--  0 root   root    62292 Dec  9 20:43 ./usr/share/doc/llvm-17-linker-tools/changelog.Debian.gz
-rw-r--r--  0 root   root     6897 Dec  9 20:41 ./usr/share/doc/llvm-17-linker-tools/copyright
lrwxrwxrwx  0 root   root        0 Dec  9 20:43 ./usr/lib/bfd-plugins/LLVMgold-17.so -> ../llvm-17/lib/LLVMgold.so

my clang is 16.x
When build LLVM with -DLLVM_BINUTILS_INCDIR it can generate LLVMgold.so.

@emelife
Copy link
Author

emelife commented Mar 28, 2024

@dtcxzyw @MaskRay Does llvm gold/CMakeLists.txt need add this change?

@MaskRay
Copy link
Member

MaskRay commented Apr 3, 2024

@dtcxzyw @MaskRay Does llvm gold/CMakeLists.txt need add this change?

Thanks for the report. This seems related to LLVM_INSTALL_TOOLCHAIN_ONLY=on. I am testing

cmake -GNinja -Sllvm -B/tmp/out/play -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/tmp/install -DLLVM_BINUTILS_INCDIR=$HOME/Dev/binutils-gdb/include -DLLVM_INSTALL_TOOLCHAIN_ONLY=on -DLLVM_TARGETS_TO_BUILD=host
ninja install

MaskRay added a commit to MaskRay/llvm-project that referenced this issue Apr 3, 2024
LLVMgold.so can be used with GNU ar, gold, ld, and nm to process LLVM
bitcode files. Install it in LLVM_INSTALL_TOOLCHAIN_ONLY=on builds like
we install libLTO.so.

Suggested by @emelife

Fix llvm#84271
MaskRay added a commit that referenced this issue Apr 4, 2024
LLVMgold.so can be used with GNU ar, gold, ld, and nm to process LLVM
bitcode files. Install it in LLVM_INSTALL_TOOLCHAIN_ONLY=on builds like
we install libLTO.so.

Suggested by @emelife

Fix #84271
@0vercl0k
Copy link

0vercl0k commented Apr 5, 2024

Thanks for fixing the issue @MaskRay! Do you know if / how / ~when this fix will trickle down to updated package in the Debian/Ubuntu APT packages?

Cheers

@emelife
Copy link
Author

emelife commented Apr 7, 2024

Thanks a lot. @MaskRay

@0xricksanchez
Copy link

Thanks! Looks like Ubuntu 22.04 has a fixed package already again :)

curl -s https://apt.llvm.org/mantic/pool/main/l/llvm-toolchain-18/llvm-18-linker-tools_18.1.6\~%2B%2B20240509090256%2Bd9a7e5179a89-1\~exp1\~20240509210309.131_s390x.deb | bsdtar -xOvf - data.tar.zst 2>/dev/null | bsdtar -tvf - | rg gold
-rw-r--r--  0 root   root    93904 May  9 23:03 ./usr/lib/llvm-18/lib/LLVMgold.so
lrwxrwxrwx  0 root   root        0 May  9 23:03 ./usr/lib/bfd-plugins/LLVMgold-18.so -> ../llvm-18/lib/LLVMgold.so

cc: @0vercl0k

@0vercl0k
Copy link

0vercl0k commented May 13, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmake Build system in general and CMake in particular llvm-tools All llvm tools that do not have corresponding tag
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants