Skip to content

Ubuntu Jammy: fails to build with "--lto-CGO2: unknown option" #136822

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

Closed
sylvestre opened this issue Apr 23, 2025 · 5 comments · Fixed by #137246
Closed

Ubuntu Jammy: fails to build with "--lto-CGO2: unknown option" #136822

sylvestre opened this issue Apr 23, 2025 · 5 comments · Fixed by #137246
Labels
build-problem cmake Build system in general and CMake in particular offload

Comments

@sylvestre
Copy link
Collaborator

With gold as linker:


FAILED: /build/source/build-llvm/tools/clang/stage2-bins/lib/libomptarget-amdgpu.bc 
: && /build/source/build-llvm/tools/clang/stage2-bins/./bin/clang++ --target=x86_64-pc-linux-gnu -fstack-protector-strong -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -ffile-prefix-map=/build/source/build-llvm/tools/clang/stage2-bins/runtimes/runtimes-bins=../../../../../../ -ffile-prefix-map=/build/source/= -no-canonical-prefixes -O2 -DNDEBUG -g1 -Wl,-z,relro -Wl,--build-id -L/build/source/build-llvm/lib -fuse-ld=gold    --target=amdgcn-amd-amdhsa -r -nostdlib -flto -Wl,--lto-emit-llvm -march= offload/DeviceRTL/Allocator.cpp-amdgpu.o offload/DeviceRTL/Configuration.cpp-amdgpu.o offload/DeviceRTL/Debug.cpp-amdgpu.o offload/DeviceRTL/Kernel.cpp-amdgpu.o offload/DeviceRTL/LibC.cpp-amdgpu.o offload/DeviceRTL/Mapping.cpp-amdgpu.o offload/DeviceRTL/Misc.cpp-amdgpu.o offload/DeviceRTL/Parallelism.cpp-amdgpu.o offload/DeviceRTL/Profiling.cpp-amdgpu.o offload/DeviceRTL/Reduction.cpp-amdgpu.o offload/DeviceRTL/State.cpp-amdgpu.o offload/DeviceRTL/Synchronization.cpp-amdgpu.o offload/DeviceRTL/Tasking.cpp-amdgpu.o offload/DeviceRTL/DeviceUtils.cpp-amdgpu.o offload/DeviceRTL/Workshare.cpp-amdgpu.o -o /build/source/build-llvm/tools/clang/stage2-bins/lib/libomptarget-amdgpu.bc   && :
/usr/bin/ld.gold: --lto-CGO2: unknown option
/usr/bin/ld.gold: use the --help option for usage information
clang++: error: ld.lld command failed with exit code 1 (use -v to see invocation)

full log:
https://llvm-jenkins.debian.net/job/llvm-toolchain-jammy-binaries/architecture=amd64,distribution=jammy,label=amd64/2077/consoleFull

2b002d6 built fine
I guess it has been caused by #136197
cc @BertalanD @sbc100

@BertalanD
Copy link
Member

BertalanD commented Apr 23, 2025

I don't see how my change could have caused it. The change is a simple bug fix for wasm-ld, it should not impact the gold linker plugin. Can you bisect it please?

@sylvestre
Copy link
Collaborator Author

The range is:
2b002d6..7f41095

maybe it is #126143 from @jhuber6

@jhuber6
Copy link
Contributor

jhuber6 commented Apr 23, 2025

Yeah it's most likely that patch. I'm going to guess that passing -fuse-ld=gold is screwing with it, since AMDGPU can only use ld.lld. I could override that for a quick fix.

@sylvestre
Copy link
Collaborator Author

@jhuber6 yeah, it would be nice if you could fix it :) thanks

sylvestre pushed a commit that referenced this issue Apr 25, 2025
Summary:
Override the default linker in case the user is passing it separately.
This requires `lld` but it always did. This will be fixed *properly*
when #136729 lands.

Fixes #136822
@EugeneZelenko EugeneZelenko added cmake Build system in general and CMake in particular offload and removed openmp:libomptarget OpenMP offload runtime labels Apr 25, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 25, 2025

@llvm/issue-subscribers-offload

Author: Sylvestre Ledru (sylvestre)

With gold as linker: ```

FAILED: /build/source/build-llvm/tools/clang/stage2-bins/lib/libomptarget-amdgpu.bc
: && /build/source/build-llvm/tools/clang/stage2-bins/./bin/clang++ --target=x86_64-pc-linux-gnu -fstack-protector-strong -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -ffile-prefix-map=/build/source/build-llvm/tools/clang/stage2-bins/runtimes/runtimes-bins=../../../../../../ -ffile-prefix-map=/build/source/= -no-canonical-prefixes -O2 -DNDEBUG -g1 -Wl,-z,relro -Wl,--build-id -L/build/source/build-llvm/lib -fuse-ld=gold --target=amdgcn-amd-amdhsa -r -nostdlib -flto -Wl,--lto-emit-llvm -march= offload/DeviceRTL/Allocator.cpp-amdgpu.o offload/DeviceRTL/Configuration.cpp-amdgpu.o offload/DeviceRTL/Debug.cpp-amdgpu.o offload/DeviceRTL/Kernel.cpp-amdgpu.o offload/DeviceRTL/LibC.cpp-amdgpu.o offload/DeviceRTL/Mapping.cpp-amdgpu.o offload/DeviceRTL/Misc.cpp-amdgpu.o offload/DeviceRTL/Parallelism.cpp-amdgpu.o offload/DeviceRTL/Profiling.cpp-amdgpu.o offload/DeviceRTL/Reduction.cpp-amdgpu.o offload/DeviceRTL/State.cpp-amdgpu.o offload/DeviceRTL/Synchronization.cpp-amdgpu.o offload/DeviceRTL/Tasking.cpp-amdgpu.o offload/DeviceRTL/DeviceUtils.cpp-amdgpu.o offload/DeviceRTL/Workshare.cpp-amdgpu.o -o /build/source/build-llvm/tools/clang/stage2-bins/lib/libomptarget-amdgpu.bc && :
/usr/bin/ld.gold: --lto-CGO2: unknown option
/usr/bin/ld.gold: use the --help option for usage information
clang++: error: ld.lld command failed with exit code 1 (use -v to see invocation)


full log:
https://llvm-jenkins.debian.net/job/llvm-toolchain-jammy-binaries/architecture=amd64,distribution=jammy,label=amd64/2077/consoleFull

2b002d68044e built fine
I guess it has been caused by https://github.com/llvm/llvm-project/pull/136197
cc @<!-- -->BertalanD @<!-- -->sbc100 

</details>

jyli0116 pushed a commit to jyli0116/llvm-project that referenced this issue Apr 28, 2025
Summary:
Override the default linker in case the user is passing it separately.
This requires `lld` but it always did. This will be fixed *properly*
when llvm#136729 lands.

Fixes llvm#136822
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this issue May 6, 2025
Summary:
Override the default linker in case the user is passing it separately.
This requires `lld` but it always did. This will be fixed *properly*
when llvm/llvm-project#136729 lands.

Fixes llvm/llvm-project#136822
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
Summary:
Override the default linker in case the user is passing it separately.
This requires `lld` but it always did. This will be fixed *properly*
when llvm#136729 lands.

Fixes llvm#136822
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
Summary:
Override the default linker in case the user is passing it separately.
This requires `lld` but it always did. This will be fixed *properly*
when llvm#136729 lands.

Fixes llvm#136822
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this issue May 6, 2025
Summary:
Override the default linker in case the user is passing it separately.
This requires `lld` but it always did. This will be fixed *properly*
when llvm#136729 lands.

Fixes llvm#136822
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this issue May 9, 2025
Summary:
Override the default linker in case the user is passing it separately.
This requires `lld` but it always did. This will be fixed *properly*
when llvm#136729 lands.

Fixes llvm#136822
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-problem cmake Build system in general and CMake in particular offload
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants