Developing apps with Fyne

Compiling for different platforms

Cross compiling with Go is designed to be simple - we just set the environment variable GOOS for the target Operating System (and GOARCH if targeting a different architecture). Unfortunately when using native graphics calls the use of CGo in Fyne makes this a little harder.

Compiling from a development computer

To cross-compile a Fyne application you will also have to set CGO_ENABLED=1 which tells go to enable the C compiler (this is normally turned off when the target platform is different to the current system). Doing so unfortunately means that you must have a C compiler for the target platform that you are going to compile for. After installing the appropriate compilers you will also need to set the CC environment variable to tell Go which compiler to use.

There are many ways to install the required tools - and different tools that can be used. The configuration recommended by the Fyne developers is:

GOOS (target) CC provider download notes
darwin o32-clang osxcross from You will also need to install the macOS SDK (instructions at the download link)
windows x86_64-w64-mingw32-gcc mingw64 package manager For macOS use homebrew
linux gcc or x86_64-linux-musl-gcc gcc or musl-cross cygwin or package manager musl-cross is available from homebrew to provide the linux gcc. You will also need to install X11 and mesa headers for compilation.

With the environment variables above set you should be able to compile in the usual manner. If further errors occur it is likely to be due to missing packages. Some target platforms require additional libraries or headers to be installed for the compilation to succeed.

Using a virtual environment

As a Linux system is able to cross compile to macOS and Windows easily it can be simpler to use a virtualised environment when you are not developing from Linux. Docker images are a useful tool for a complex build configuration and this works for Fyne as well. There are different tools that can be used. The tool recommended by the Fyne developers is fyne-cross. It has been inspired by xgo and uses a docker image built on top of the golang-cross image, that includes the MinGW compiler for windows, and a macOS SDK, along with the Fyne requirements.

fyne-cross allows to build binaries and create distribution packages for the following targets:

darwin amd64
darwin 386
linux amd64
linux 386
linux arm64
linux arm
windows amd64
windows 386
android amd64
android 386
android arm64
android arm


    go get


    fyne-cross --targets=linux/amd64,windows/amd64,darwin/amd64 package

Use fyne-cross help for more informations


The example below cross build the fyne examples application

    git clone
    cd examples
    fyne-cross --targets=linux/amd64,windows/amd64,darwin/amd64

Get In Touch!

We're excited to hear from anyone interested in the project. Whether it's to find out more, provide suggestions or to get involved - drop us a line!

If you would like to join us on slack but are not yet signed up to the golang slack server you can request an invite.