Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#50433 - [go] provide alternative CGO_ENABLED=0 package
Attached to Project:
Community Packages
Opened by c (c) - Thursday, 18 August 2016, 10:30 GMT
Last edited by Alexander F. Rødseth (xyproto) - Monday, 28 November 2016, 23:04 GMT
Opened by c (c) - Thursday, 18 August 2016, 10:30 GMT
Last edited by Alexander F. Rødseth (xyproto) - Monday, 28 November 2016, 23:04 GMT
|
DetailsDescription:
On Linux and OS X go will not produce fully statically linked binaries if CGO_ENABLED hasn't been set 0 when building go's stdlib. Any time one would like to build a random go project with CGO_ENABLED=0, it will complain because it will try to rebuild net.a, which obviously is in /usr and r/o. Because statically linked binaries are one major advantage of go and this currently doesn't quite work, I request the following feature: Provide an optional package which was built with CGO_ENABLED=0. Such a go package would produce binaries that are fully static and don't even depend on libc. |
This task depends upon
Closed by Alexander F. Rødseth (xyproto)
Monday, 28 November 2016, 23:04 GMT
Reason for closing: None
Monday, 28 November 2016, 23:04 GMT
Reason for closing: None
libx264 has nothing at all to do with this.
http://port70.net/~nsz/32_dynlink.html
http://harmful.cat-v.org/software/dynamic-linking/
The issue does not seem to have an easy fix however, see:
https://dominik.honnef.co/posts/2015/06/go-musl/
The user can install 2 stdlibs by changing the GOROOT. Can the OP see if that is a satisfactory solution?
To embed the C 'm' library (math):
go build -ldflags '-extldflags "-static -lm"'
Add as many -l flags as you need.
Anyways, let's not drift off too much and try to answer the OP's need.
I've also needed CGO_ENABLED=0 when packaging a Go application for Alpine Linux within a docker container.
For the two above scenarios, it could be handy to have an easy way to test with CGO_ENABLED=0, while running Arch Linux.
Not strictly needed, but nice to have, as a debugging/testing tool. It might be best if it starts out on a package on AUR, though, just to measure the popularity before moving it over.
If an AUR package for this becomes popular enough, I'll move it to [community].