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
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
ld.exe in Rust’s
Getting the GTK+ SDK
Install MSYS2. We’re going to assume it’s installed in
C:\msys64on 64-bit systems and
C:\msys32on 32-bit ones. Adjust the path in the following steps if necessary.
In the “MSYS2 MSYS Shell” install
> pacman -S mingw-w64-i686-gtk3
> pacman -S mingw-w64-x86_64-gtk3
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
C:\> SET GTK_LIB_DIR=C:\msys32\mingw32\lib C:\> SET PATH=%PATH%;C:\msys32\mingw32\bin
C:\> SET GTK_LIB_DIR=C:\msys64\mingw64\lib C:\> SET PATH=%PATH%;C:\msys64\mingw64\bin
If you’re happy with these changes, make them permanent with
C:\> SETX GTK_LIB_DIR %GTK_LIB_DIR% C:\> SETX PATH %PATH%
Using the MSYS2 MinGW shell
Instead of setting the environment variables manually, you can let
sort the paths out for you.
In the “MSYS2 MSYS Shell” install the
> pacman -S mingw-w64-i686-toolchain
> pacman -S mingw-w64-x86_64-toolchain
Start the “MSYS2 MinGW Shell” (not to be confused with “MSYS2 MSYS Shell”).