February 2019
Intermediate to advanced
450 pages
11h 59m
English
Using MSYS2 as earlier, we can install the gcc package to provide cross compilation for Linux:
pacman -S gcc
After the installation has completed, we can tell our Go compiler to use gcc by setting the environment variable CC=gcc. Compilation should now succeed following the instructions in your current example, such as the following:
GOOS=linux CGO_ENABLED=1 CC=gcc go build
It's possible, at this point, that you may see additional errors due to missing headers. To fix this, you'll need to search for, and install, the required libraries. If, for example, your error stated that SDL couldn't be found then you would use pacman -Ss sdl to search for the right package to install. If you can't find an appropriate package, you ...
Read now
Unlock full access