Created
June 23, 2016 03:19
-
-
Save nobonobo/2284fe75eb18f4138a3663d270ac3e75 to your computer and use it in GitHub Desktop.
golang muslスタティックリンク
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo pacman -S musl | |
| CC=/usr/bin/musl-gcc go build --ldflags '-linkmode external -extldflags "-static"' sample.go | |
| ldd sample | |
| 動的実行ファイルではありません |
Author
Author
GOPATH環境変数の反映やOutputがrootオーナーなのはdocker runのオプションで調整してください。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
dockerベースでビルドするときは以下のようにやってもビルドできるよ!(docker for linuxで確認)