-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Compiling
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:
- TDM-GCC - http://tdm-gcc.tdragon.net/download
- MSYS2 with MingW-w64 - https://www.msys2.org/
- Cygwin - https://www.cygwin.com/
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:
Distribution | Packages required |
---|---|
Debian/Ubuntu |
libgl1-mesa-dev and xorg-dev
|
From here the go run
and go build
commands should work correctly.