Although Fyne has no native dependencies and is a pure Go API it does require CGo for calling system graphics libraries. Because of this you will need a C compiler (typically gcc, clang or compatible).
Most developer systems will already have one installed, but if you are getting started or have not used a C compiler before this section should get you set up.
On Linux the “gcc” package may already be installed - if not then install this from your package manager. One of the following commands is likely to work for your system:
sudo apt-get install gcc
sudo pacman -S gcc
yum -y install gcc
If this works then you will be able to run
gcc --version to see that it’s installed and on your PATH.
On macOS you should install XCode from the Mac App Store - first check you are on a fast internet connection as it is a large download. Once downloaded you will need to run
xcode-select --install to set up the command line tools (if you have not used them before). It is not unusual to find that your command line tools stop working after an Operating System upgrade - if this occurs simply execute that command again.
Windows does not have a standard way to install a C compiler, but there are many options available. Some that have worked for contributors of this project are:
By default Fyne uses the gl and GLFW bindings for Go which means that OpenGL must be installed on the development, and runtime, systems. Most modern desktop platforms have this running out of the box so this should not be a problem. On some Linux systems, however, the files needed to compile with OpenGL are not included. Here is a list of the packages you may need to install for various distributions:
Once the installation and setup is complete you can compile a fyne application like any other Go code:
go run main.go
go build ./main
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.