Compiler installation

Each additional platform (with a different operating system to the current one) will require a C compiler to be installed. The ones recommended throughout this book are as follows (along with the CC environment variable to use them with CGo):

Target Platform CC= Download Notes

macOS (darwin)

o32-clang

github.com/tpoechtrager/osxcross/

You will also need the macOS SDK

(see osxcross documentation)

Windows

x86_64-w64-mingw32-gcc

On macOS: brew.sh/

On Linux: use your package manager

macOS: install mingw-w64 package

Linux: package names vary

Linux/BSD

gcc-linux

On macOS: brew.sh/

On Windows: cygwin.com/install.html

macOS: Install FiloSottile/musl-cross/musl-cross

Windows: Install gcc-linux package

Installing cross-compilation tools can be complicated—be sure to read the documentation on each download page and check your environment configuration after installing.
Full details of how to install and set up each of these compilers can be found in Appendix 2, Cross-Compiler Setup.
..................Content has been hidden....................

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