golang version < 1.5 - there are plenty of static linking examples, posts and recipes. What about >= 1.5? (google search has returned no useful results for my search terms.) Anyone have any recommendations on how to produce a statically linked binary that can be executed inside a basic rkt (from CoreOS) container?
my go:
$go version
go version go1.5 linux/amd64
when I try to run my container:
sudo rkt --insecure-skip-verify run /tmp/FastBonusReport.aci
I get:
[38049.477658] FastBonusReport[4]: Error: Unable to open "/lib64/ld-linux-x86-64.so.2": No such file or directory
suggesting that the executable in the container is depending on this lib and hence not static.
my manifest looks like:
cat <<EOF > /tmp/${myapp}/manifest
{
"acKind": "ImageManifest",
"acVersion": "0.9.0",
"name": "${lowermyapp}",
"labels": [
{"name": "os", "value": "linux"},
{"name": "arch", "value": "amd64"}
],
"app": {
"exec": [
"/bin/${myapp}"
],
"user": "0",
"group": "0"
}
}
EOF
my command line to build the binary looks like:
go build ${myapp}.go
This article has a few examples golang < 1.5. And then there is this getting started article on the CoreOS site.
CGO_ENABLED=0
? – Calyptrogenrkt
? Yours is the first use of the tag and I at least am not familiar with it. – MeteoriteCGO_ENABLED=0
turns that off. – Plunk