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

go1.18: Dynamic linker path is hardcoded to glibc's dynamic linker #51790

Closed
berolinux opened this issue Mar 18, 2022 · 2 comments
Closed

go1.18: Dynamic linker path is hardcoded to glibc's dynamic linker #51790

berolinux opened this issue Mar 18, 2022 · 2 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@berolinux
Copy link

What version of Go are you using (go version)?

1.18

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

Linux, any processor architecture

What did you do?

Tried to build a dynamically linked go application on a Linux system using a libc other than glibc (musl, uClibc-ng)

What did you expect to see?

Working application

What did you see instead?

"No such file or directory"

The cause is that go hardcodes the filename of glibc's dynamic linker, and puts that into the ELF header, e.g.
https://github.com/golang/go/blob/master/src/cmd/link/internal/x86/obj.go#L64
https://github.com/golang/go/blob/master/src/cmd/link/internal/amd64/obj.go#L67
when it should be using ld-musl-x86_64.so.1 etc. on a linux-musl system.

There is some handling for the similar case of Linux-but-not-glibc Android at
https://github.com/golang/go/blob/master/src/cmd/link/internal/ld/elf.go#L1769

Probably an equivalent fix is the easiest way to support other non-glibc linux systems.

@cherrymui
Copy link
Member

This is just the default path. You can pass a flag to change it: go build -ldflags=-I=/path/to/ld.so. Does it work for you?

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 18, 2022
@gopherbot
Copy link
Contributor

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@golang golang locked and limited conversation to collaborators Apr 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants