Cross-compiling for macOS
With Windows and Linux (and some BSD flavours), all cross-compiling completes without CGO, therefore, we only need to look at macOS as a special case. To cross-compile successfully for macOS, we must add CGO_ENABLED=1 to our build, which will then look for the required system libraries. Clearly, these are not normally available and so we must set up our development environment to provide the required APIs.
The procedure for setting up the clang binary and required API bundles for macOS cross-compiling is a complicated process, but if you worked through Chapter 5, andlabs UI - Cross-platform Native UIs, this will already be set up. If you've jumped straight to this chapter, then you may need to follow the steps in ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access