The gtk crate expects GTK+, GLib and Cairo development files to be installed on your system.

Debian and Ubuntu

> sudo apt-get install libgtk-3-dev


> sudo dnf install gtk3-devel glib2-devel

### Fedora 21 and earlier
> sudo yum install gtk3-devel glib2-devel


> brew install gtk+3


On Windows Rust can use either the MSVC toolchain or the GNU toolchain. The latter is easier to install, but the former provides a better overall experience and allows interfacing with Windows libraries that are incompatible with the GNU toolchain and allows for example usage of the Visual Studio debugger.

MSVC toolchain

  1. Install GTK using the instructions on the GTK website. This will take some time. Once it’s finished, make a note of the folder installed\x86-windows (32-bit)/installed\x64-windows (64-bit); these instructions will refer to it as %VCPKGDIR%.
  2. Add %VCPKGDIR%\bin to the beginning of your PATH environment variable.
  3. Set the GTK_LIB_DIR environment variable to %VCPKGDIR%\lib.
  4. Create the following symlinks. (NTFS has supported symlinks since Windows Vista, but prior to the Windows 10 Creators Update it required elevated privileges. Copying the files also works, but you’ll need to do it again when GTK is updated.)
    • %VCPKGDIR%\lib\gtk-3.0.lib points to %VCPKGDIR%\lib\gtk-3.lib.
    • %VCPKGDIR%\lib\gdk-3.0.lib points to %VCPKGDIR%\lib\gdk-3.lib.
    • %VCPKGDIR%\bin\gtk-3.0.dll points to %VCPKGDIR%\bin\gtk-3.dll.
    • %VCPKGDIR%\bin\gdk-3.0.dll points to %VCPKGDIR%\bin\gdk-3.dll.
  5. Create the folder %VCPKGDIR%\etc\gtk-3.0. Inside it, create the file settings.ini:

Possible problems

process didn't exit successfully (exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND)

%VCPKGDIR%\bin is too late in the PATH environment variable, and DLLs for other programs are being found before the ones installed alongside GTK. Move %VCPKGDIR%\bin earlier in your PATH and try again.

GNU toolchain

Make sure you have the GNU ABI version of the rust compiler installed. Contrary to earlier instructions, you don’t need to uncheck “Linker and platform libraries” in the Rust setup or delete gcc.exe and ld.exe in Rust’s bin directory.

Getting the GTK+ SDK

The GTK+ Project recommends using the GTK+ SDK provided by MSYS2:

If you prefer getting the SDK from gtk-win64 or building it from source, set the variables in the next section accordingly.

Using the native Windows shell

Back in the cmd.exe shell set the GTK_LIB_DIR and PATH environment variables:

If you’re happy with these changes, make them permanent with SETX:


Using the MSYS2 MinGW shell

Instead of setting the environment variables manually, you can let pkg-config sort the paths out for you.

Possible problems

Error on linking on Windows MSYS2: undefined reference to `imp_acrt_iob_func’

Download these packages and install it with pacman -U <path>:

Also pkg-config better ignore these packages on updating, add “IgnorePkg = mingw-w64-x86_64-crt-git mingw-w64-x86_64-headers-git” to /etc/pacman.conf