go: cmd/link: regression for supporting PIE on Alpine X86_64 platform
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (go version
)?
go version go1.8beta1 linux/amd64
What operating system and processor architecture are you using (go env
)?
Alpine X86_64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build585116893=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
What did you do?
# go build -buildmode=pie test/helloworld.go
# ./helloworld
What did you expect to see?
hello, world
What did you see instead?
sh: ./helloworld: not found
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 32 (18 by maintainers)
Commits related to this issue
- community/go: upgrade to 1.8 default-buildmode-pie.patch has been removed since is addressed upstream by https://github.com/golang/go/commit/53aec79ce05cd5eff1c8f5576b553d3c429227c3 set-external-lin... — committed to errm/aports by errm 7 years ago
- community/go: upgrade to 1.8.1 default-buildmode-pie.patch has been removed since is addressed upstream by https://github.com/golang/go/commit/53aec79ce05cd5eff1c8f5576b553d3c429227c3 set-external-l... — committed to errm/aports by errm 7 years ago
- runtime: ignore TestCgoPprofPIE test failures on Alpine Updates #19938 Updates #18243 Change-Id: Ib6e704c0a5d596bdfaa6493902d2528bec55bf16 Reviewed-on: https://go-review.googlesource.com/41628 Revie... — committed to golang/go by bradfitz 7 years ago
- runtime: ignore TestCgoPprofPIE test failures on Alpine (take 2) s/arm64/amd64/ in previous typo CL 41628 Updates #19938 Updates #18243 Change-Id: I282244ee3c94535f229a87b6246382385ff64428 Reviewed... — committed to golang/go by bradfitz 7 years ago
- cmd/go, cmd/dist: temporarily disable race and PIE internal link tests on Alpine In an effort to at least understand the complete set of things not working on Alpine Linux, I've been trying to get th... — committed to golang/go by bradfitz 7 years ago
- cmd/dist: disable internal linking tests on Alpine Updates #18243 Change-Id: I1fe0af65dbd52c3e8e0a245e4cbbdfca100971b4 Reviewed-on: https://go-review.googlesource.com/41759 Run-TryBot: Brad Fitzpatr... — committed to golang/go by bradfitz 7 years ago
- dashboard: set GO_EXTLINK_ENABLED=1 for Alpine builder for now Updates golang/go#18243 Change-Id: I76989c3f6b592fb2b68df86c853896f7a2ff7a25 Reviewed-on: https://go-review.googlesource.com/41798 Revi... — committed to golang/build by bradfitz 7 years ago
- community/go: upgrade to 1.8.1 set-external-linker.patch adresses golang/go#18243 — committed to errm/aports by errm 7 years ago
- community/go: upgrade to 1.8.1 set-external-linker.patch adresses golang/go#18243 — committed to errm/aports by errm 7 years ago
- community/go: upgrade to 1.8.1 set-external-linker.patch adresses golang/go#18243 — committed to alpinelinux/aports by errm 7 years ago
- cmd/dist, cmd/link: allow passing default dynamic linker/loader Add an environment variable to make.bash to allow setting the default dynamic linker/loader. This fixes alpine builds to use /lib/ld-mu... — committed to tklauser/go by tklauser 6 years ago
- cmd/dist, cmd/link: allow passing default dynamic linker/loader Add an environment variable to make.bash to allow setting the default dynamic linker/loader. This fixes alpine builds to use /lib/ld-mu... — committed to tklauser/go by tklauser 6 years ago
- community/go: remove set-external-linker.patch It was pointed out on IRC by kaey that this patch is no longer needed, make.bash has special handling for Alpine nowadays. Just a cleanup change, thus ... — committed to alpinelinux/aports by nmeum 4 years ago
Thinking more the issue, if cross-building in Go is to be supported, you really need to know the target specific dynamic linker name. In alpine we patch it currently like: https://git.alpinelinux.org/cgit/aports/tree/community/go/set-external-linker.patch
However, it would probably make sense to add a new
ld.Thearch.Musldyndl
variable (or similar). And figure out whether to use musl or glibc by a build time or run-time automatically set option.The default interpreter path is supported via compatibility package
libc6-compat
in Alpine (but probably not in other musl based distributions). However, the musl interpreter is preferred for natively built software. Alpine Linux uses the musl default interpreter name. To me the following reasons make sense: