Installing on Windows

Marcel Schramm edited this page Nov 16, 2018 · 20 revisions

Getting gotk3 to work on Windows is little bit more difficult than it is on Linux systems.

Instaling Git

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.

Installing MinGW

The next step is to install MinGW-w64. Download the installer from here. These instructions are tested with version 4.8.1.

Install GTK and its dependencies

  1. first open MSYS
  2. 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
  3. 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.

The 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

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/ 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.

Grid Example

Congratulations, you have successfully installed gotk3 on Windows. Happy hacking!

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.