Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Installing on Windows
Getting gotk3 to work on Windows is little bit more difficult than it is on Linux systems.
If you haven't already, be sure to install Git for Windows. The Windows version includes a bash shell and several useful Unix command line utilities, which are required.
Install GTK and its dependencies
- first open MSYS
- Run the following command in order to install necessary dependencies for gotk3
pacman --noconfirm --needed -Sy bash pacman pacman-mirrors pacman --noconfirm -Su pacman --noconfirm -S mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gtk3
- Apply a workaround for a bug that is currently present in the package config files (This will be a no op if the bug has been fixed already)
bash -c "sed -i -e 's/-Wl,-luuid/-luuid/g' C:/msys64/mingw64/lib/pkgconfig/gdk-3.0.pc"
Modify your environment variables
The System Properties window must be opened to modify user and system environment variables. Opening this window varies slightly between Windows 7 and 8.
Windows 7: From the Start Menu, right click Computer, and select Properties. Click the 'Advanced system settings' link at the left, and then click the button labeled 'Environment Variables...'.
Windows 8: Right click the lower left corner (on Windows 8.1 this is the 'Start Screen' button) and select `System'. Click the 'Advanced system settings' link at the left, and then click the button labeled 'Environment Variables...'.
If this is a fresh Go installation and
GOPATH has not been created, do so now:
mkdir -p ~/src/go
To set the
GOPATH environment variable, click New from the 'Environment Variables' window. In the dialog that opens, enter
GOPATH for the variable name, and
%USERPROFILE%\src\go for the value.
Path environment variable must also be modified to include the folders containing mingw-w64 and Fedora binaries and DLLs. Modify the System
Path variable by appending the string
;C:\Fedora\bin;C:\Program Files\mingw-builds\x64-4.8.1-posix-seh-rev5\mingw64\bin (the leading semicolon is to delimit the path from previous paths).
The changes made to the environment variables do not take effect immediately. On Windows 7, close and reopen all cmd.exe or git shell windows for the new environment variable changes to take effect. Windows 8 has changed this to require signing out and back in before any changes to the environment variables take effect.
Go get gotk3
With a compiler toolchain (MinGW-w64), pkg-config, and GTK with all dependencies installed, you should finally have a working build environment to install gotk3. From git bash, run:
go get github.com/gotk3/gotk3/gtk
If the above finished without outputting any errors, the install was successful.
Try an example
To be sure all the needed DLLs are installed, try running the examples provided as part of the gtk package. Navigate to
$GOPATH/src/github.com/gotk3/gotk3-examples/gtk-examples and try building each example with
go build and then running the generated .exe. If all works fine, your gotk3 install should be ready for developing your own applications.
Congratulations, you have successfully installed gotk3 on Windows. Happy hacking!