fix: link linux/arm64 Go builds without gold - #372
Open
imposecost wants to merge 1 commit into
Open
imposecost wants to merge 1 commit into
imposecost wants to merge 1 commit into
Conversation
Go's linux/arm64 external linker injects -fuse-ld=gold. When gold is missing, gcc fails with "cannot find 'ld'" while linking AdaptixServer (cgo/sqlite3) and plugin extenders. Pass -extldflags=-fuse-ld=bfd when gold is not on PATH, and set the same via CGO_LDFLAGS in axtool's build runner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #371
Summary
-fuse-ld=gold. Gold is deprecated and often missing; gcc then dies withcollect2: fatal error: cannot find ‘ld’while linking AdaptixServer (cgo/sqlite3) and-buildmode=pluginextenders.go_ldflags.mkappends-extldflags=-fuse-ld=bfdwhenld.goldis not on PATH. Used by the root Makefile, extender Makefiles, and axtool's own Makefile.server builduses the same extra ldflags. The build runner also setsCGO_LDFLAGS=-fuse-ld=bfdso pluginmakeinvocations pick it up.axtool init) get the same gold fallback.Related: #370 (wrong-arch Go tarball on aarch64). This is the next failure after a working arm64
gois installed.CGO_ENABLED=0is not a workaround: AdaptixServer usesmattn/go-sqlite3, and plugins require cgo.Test plan
make serverstill links as before (GO_LDFLAGSis-s -w)ld.gold: unchanged; gold still usedld.gold, Go < 1.26.3:make serverandmake extenderssucceed; gcc command line has-fuse-ld=bfdafter-fuse-ld=gold./dist/axtool adaptix.spec server buildon linux/arm64 without gold succeedsgo test ./internal/build/in AdaptixTools