To Linux from Windows

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 may need to install Cygwin www.cygwin.com/ (as it has a larger package library) or Windows subsystem for Linux docs.microsoft.com/en-us/windows/wsl/ (as that brings a full Linux distribution to your Windows desktop).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.7.240