Created
January 25, 2022 05:09
-
-
Save myl7/1f43c46e8cd10494524b8bcc317b670e to your computer and use it in GitHub Desktop.
Staticly build go even with cgo but excluding external dynamic libraries
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
#!/usr/bin/env bash | |
set -euo pipefail | |
# Ref: https://honnef.co/posts/2015/06/statically_compiled_go_programs__always__even_with_cgo__using_musl/ | |
CC=musl-gcc go build --ldflags '-linkmode external -extldflags "-static"' "$@" cmd/bibak/main.go |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment