macOS

To cross-compile with macOS, we need to install a package manager. The easiest and most complete is Homebrew—you can install it from https://brew.sh/. The recommended toolchain for Linux compilation is musl-cross, which is in the FiloSottile/musl-cross/musl-cross package. With Homebrew installed, execute the following commands in your Terminal window:

  1. brew install gtk+3
  2. export HOMEBREW_BUILD_FROM_SOURCE=1
  3. brew install FiloSottile/musl-cross/musl-cross

Once that is completed, you should be able to build for Linux by setting the GOOS=linuxGOARCH=amd64CGO_ENABLED=1, and CC=x86_64-linux-musl-gcc environment variables with CXX=x86_64-linux-musl-g++. You can then build as normal, resulting in a Linux executable instead of macOS:

Building a Linux executable from macOS
..................Content has been hidden....................

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