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

binaries with cgo keep references to $GOROOT #5076

Closed
gopherbot opened this issue Mar 18, 2013 · 1 comment
Closed

binaries with cgo keep references to $GOROOT #5076

gopherbot opened this issue Mar 18, 2013 · 1 comment

Comments

@gopherbot
Copy link
Contributor

by viriketo:

With go 1.0.3 in linux-amd64, if I build my program with cgo (linking with sqlite), it
keeps strings pointing to the $GOROOT.

This is important in the nix package manager [1], because packages are 'grepped' for
references to other paths, to infer the runtime dependencies.

Having GOROOT=/nix/store/wzkcdbnqhgvirmxxv9lyarvfqcpm8gl3-go-1.0.3/share/go,
specifically, for my program "storebrowse" [2] that links with sqlite, I get:
[viric@bergamota:~/storebrowse]$ strings storebrowse | grep go-1.0
/nix/store/wzkcdbnqhgvirmxxv9lyarvfqcpm8gl3-go-1.0.3/share/go
/nix/store/wzkcdbnqhgvirmxxv9lyarvfqcpm8gl3-go-1.0.3/share/go/pkg/linux_amd64/runtime/cgo.a(gcc_util.o)(.data.rel.local)
/nix/store/wzkcdbnqhgvirmxxv9lyarvfqcpm8gl3-go-1.0.3/share/go/pkg/linux_amd64/runtime/cgo.a(gcc_util.o)(.rodata.str1.8)
/nix/store/wzkcdbnqhgvirmxxv9lyarvfqcpm8gl3-go-1.0.3/share/go/pkg/linux_amd64/runtime/cgo.a(gcc_linux_amd64.)(.data.rel)
/nix/store/wzkcdbnqhgvirmxxv9lyarvfqcpm8gl3-go-1.0.3/share/go/pkg/linux_amd64/runtime/cgo.a(gcc_linux_amd64.)(.rodata.str1.8)
wzkcdbnqhgvirmxxv9lyarvfqcpm8gl3-go-1.0.3

Are the files there referred used for anything? binutils strip -s didn't help.

[1] http://nixos.org/nix
[2] http://viric.name/cgi-bin/storebrowse
@rsc
Copy link
Contributor

rsc commented Mar 19, 2013

Comment 1:

Those are symbol names. The full path was being used to disambiguate
different object files. The running binary will never look for those files.
The names are much shorter at tip and omit the full paths. This will be
part of Go 1.1.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants