Skip to content

Instantly share code, notes, and snippets.

@troian
Last active January 4, 2020 05:29
Show Gist options
  • Save troian/06d00b0e65eba79c218fd9a096d03b66 to your computer and use it in GitHub Desktop.
Save troian/06d00b0e65eba79c218fd9a096d03b66 to your computer and use it in GitHub Desktop.
Crosscompile golang-migrate command for RPI2
TOOLCHAIN_PREFIX=armv7-linux-gnueabihf \
CC=${TOOLCHAIN_PREFIX}-gcc \
CXX=${TOOLCHAIN_PREFIX}-g++ \
CGO_LDFLAGS="-Os -s -Wl,--gc-sections -fwhole-program -dead_strip" \
CGO_CFLAGS="-fdata-sections -ffunction-sections -Os --sysroot=<sysroot path>" \
CGO_ENABLED=1 \
GOARCH=arm \
GOOS=linux \
GOARM=7 \
go build -v -a -ldflags "-X main.Version=$(git describe --tags) -linkmode external -v" -tags 'sqlite3'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment