Cross-compiling Golang Applications for Synology 1513+

To compile a Golang application project for Synology NAS architecture, first let’s take a look at the list of Synology boxes by architecture. Looking at that chart, we can determine that the Synology 1513+ is running on a x86 cedarview processor and has a listed architecture of x86_64. Ok, so let’s tell Go to compile for x86_64 on Mac OS with Go installed via Homebrew:

1
2
cd $(brew --prefix go)/libexec/src
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 ./make.bash --no-clean

Now cd in to your project directory and run:

1
GOOS=linux GOARCH=amd64 go build

That’s it. You should have a linux x86_64 compiled binary in your current working directory.

HFGL!