April 22, 2020 · 1 min read · 79 words · go, linux
I have a go app that runs via scheduled task on my Synology NAS DS218+. Compiling GO binaries for major platforms is fairly straight forward. Compiling GO binaries for Synology is a bit more involved. The following is what I've found to work.
First, install musl-cross.
$ brew install FiloSottile/musl-cross/musl-cross
Then run the following go build command.
$ CC=x86_64-linux-musl-gcc \\ CXX=x86_64-linux-musl-g++ \\ GOARCH=amd64 \\ GOOS=linux \\ CGO_ENABLED=1 \\ go build -ldflags "-linkmode external -extldflags -static"
Authored by Anthony Fox on April 22, 2020
Have comments or feedback? I'd love to hear from you.