Open utrack opened 9 years ago
Not sure what might be going on here, we don't seem to have any problems creating statically linked binaries. Compare this:
bdehamer:watchtower $ go build
bdehamer:watchtower $ ldd watchtower
linux-vdso.so.1 => (0x00007fff325ce000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fcfad358000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcfacf93000)
/lib64/ld-linux-x86-64.so.2 (0x00007fcfad57f000)
with this:
bdehamer:watchtower $ docker run --rm -v $(pwd):/src centurylink/golang-builder
Building github.com/CenturyLinkLabs/watchtower
bdehamer:watchtower $ ldd watchtower
not a dynamic executable
@bdehamer I read some stuff on the matter... It looks like dynamic builds are produced when the binary uses net package or something from os. http://grokbase.com/t/gg/golang-nuts/137jbj44wt/go-nuts-re-go-program-isnt-compiled-to-static-binary-if-uses-net-package Build fails if I pass -d ldflag (which discards dynamic links). I guess I'll just fork golang container and build go tools in it statically for now.
Because of root Docker's golang image, static builds are not available.
Dynamically linked gotools from Docker's golang image are unable to produce static builds. Example ldd output from freshly created binary: