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

ARM external linker must be gold (issue #15696), but is not: zig ld 0.11.0 #122

Open
farcop opened this issue Sep 30, 2023 · 9 comments
Open
Labels
upstream this is caused by an upstream issue

Comments

@farcop
Copy link

farcop commented Sep 30, 2023

After upgrade on https://github.com/uber/hermetic_cc_toolchain/releases/tag/v2.1.2
On linux/amd64 VM I get error when trying to build go_binary.

2023/09/30 07:07:20 ARM external linker must be gold (issue #15696), but is not: zig ld 0.11.0
link: error running subcommand external/go_sdk/pkg/tool/linux_amd64/link: exit status 1

golang/go#15696

Rolled back to the 2.0.0 to workaround this issue.

@farcop
Copy link
Author

farcop commented Oct 2, 2023

Tested with

register_toolchains(
    "@zig_sdk//toolchain:linux_amd64_gnu.2.31",
    "@zig_sdk//toolchain:linux_arm64_gnu.2.31",
)

and with 2.34.

Debug output:

ERROR: /home/kublr/kublr/cluster-controller/BUILD.bazel:27:10: GoLink cluster-controller/cluster-controller failed: (Exit 1): linux-sandbox failed: error executing command 
  (cd /home/kublr/.cache/bazel/_bazel_kublr/69fb4c52c15303cc4e23e5352527edec/sandbox/linux-sandbox/1/execroot/kublr && \
  exec env - \
    CGO_ENABLED=1 \
    GOARCH=arm64 \
    GOEXPERIMENT=nocoverageredesign \
    GOOS=linux \
    GOPATH='' \
    GOROOT=bazel-out/k8-fastbuild-ST-29c7f66a8f11/bin/external/io_bazel_rules_go/stdlib_ \
    GOROOT_FINAL=GOROOT \
    PATH=external/zig_sdk/tools:external/zig_sdk/tools/aarch64-linux-gnu.2.34:/bin:/usr/bin \
    TMPDIR=/tmp \
  /home/kublr/.cache/bazel/_bazel_kublr/install/a09dbb90c658248f08f9aa0eba11997d/linux-sandbox -t 15 -w /home/kublr/.cache/bazel/_bazel_kublr/69fb4c52c15303cc4e23e5352527edec/sandbox/linux-sandbox/1/execroot/kublr -w /tmp -w /dev/shm -S /home/kublr/.cache/bazel/_bazel_kublr/69fb4c52c15303cc4e23e5352527edec/sandbox/linux-sandbox/1/stats.out -D -- bazel-out/k8-opt-exec-2B5CBBC6-ST-e846b08c7501/bin/external/go_sdk/builder_reset/builder '-param=bazel-out/k8-fastbuild-ST-49c02b6fcfac/bin/cluster-controller/cluster-controller-0.params' -- -extld external/zig_sdk/tools/aarch64-linux-gnu.2.34/c++ -X 'src.kublr.io/kublr/common/pkg/version.version=1.28.0-alpha.0' '-buildid=redacted' -s -w -extldflags '-fno-lto -fsanitize-undefined-strip-path-components=-1')

@motiejus
Copy link
Collaborator

Which Go/Zig version do you use with this? Can this be reproduced with tests of hermetic_cc_toolchain?

@farcop
Copy link
Author

farcop commented Oct 10, 2023

@motiejus
go 1.20
zig is default toolchain version in v2.1.2

which test I should run?

@motiejus
Copy link
Collaborator

@motiejus go 1.20 zig is default toolchain version in v2.1.2

which test I should run?

The point is we need to be able to reproduce the failure. Your report does not include a test case, so let's come up with one.

We have a bunch of tests in hermetic_cc_toolchain, which are currently green. Perhaps it would be easy to change one that reproduces this failure?

@farcop
Copy link
Author

farcop commented Oct 24, 2023

I can only confirm that error is in multi architecture image transformation written just like https://github.com/bazel-contrib/rules_oci/blob/main/examples/multi_arch/BUILD.bazel#L19-L26
I cant publish whole code example but the same code works well with 2.0.0 release of hermetic_cc_toolchain.

@ghost
Copy link

ghost commented Oct 27, 2023

I've just added a test to reproduce this failure in #129

@farcop
Copy link
Author

farcop commented Oct 27, 2023

@lbcjbb Thank you. Much appreciated.

@ghost
Copy link

ghost commented Oct 27, 2023

56c4e1e should fix this issue now.

@linzhp
Copy link
Contributor

linzhp commented Nov 30, 2023

I think this is due to a hack in Go linker.

Either this or this will fix it. I would prefer patching Go linker with one of these patches and report the success or failure on golang/go#22040, instead of putting another hack on hermetic_cc_toolchain to cheat Go linker.

@motiejus motiejus added the upstream this is caused by an upstream issue label Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream this is caused by an upstream issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants