Skip to content

Instantly share code, notes, and snippets.

@tmornini
Created October 27, 2016 19:52
Show Gist options
  • Save tmornini/d4f5a9185698e5b000b55f6a8dca5b37 to your computer and use it in GitHub Desktop.
Save tmornini/d4f5a9185698e5b000b55f6a8dca5b37 to your computer and use it in GitHub Desktop.
Go builds static binaries on OS X, dynamic binaries on Ubuntu
If I build on Mac OS X 10.11.6 with Go 1.7.3 installed from brew with:
GOOS=linux GOARCH=amd64 go build -v
And then check the executable:
file purchases
purchases: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped
The same on semaphore-ci (and other CI systems) on Ubuntu 14.04 and also built with Go 1.7.3:
file purchases
purchases: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
What would cause this difference, and how should I build a static binary on Linux?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment