Skip to content

Commit 2b88927

Browse files
Merge pull request #111 from ketsuban/msvc-instructions
Add instructions for installing on MSVC
2 parents 59d5e3a + 8b16060 commit 2b88927

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs-src/requirements.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,45 @@ The __gtk__ crate expects __GTK+__, __GLib__ and __Cairo__ development files to
2929

3030
## Windows
3131

32+
On Windows Rust can use either the MSVC toolchain or the GNU toolchain. The latter is easier to
33+
install, but the former provides a better overall experience and allows interfacing with other
34+
Windows libraries.
35+
36+
### MSVC toolchain
37+
38+
1. Install GTK using [the instructions on the GTK website](https://www.gtk.org/download/windows.php).
39+
This will take some time. Once it's finished, make a note of the folder `installed\x86-windows`
40+
(32-bit)/`installed\x64-windows` (64-bit); these instructions will refer to it as `%VCPKGDIR%`.
41+
2. Add `%VCPKGDIR%\bin` to the beginning of your `PATH` environment variable.
42+
3. Set the `GTK_LIB_DIR` environment variable to `%VCPKGDIR%\lib`.
43+
4. Create the following symlinks. (NTFS has supported symlinks since Windows Vista, but prior to the
44+
Windows 10 Creators Update it required elevated privileges. Copying the files also works, but
45+
you'll need to do it again when GTK is updated.)
46+
* `%VCPKGDIR%\lib\gtk-3.0.lib` points to `%VCPKGDIR%\lib\gtk-3.lib`.
47+
* `%VCPKGDIR%\lib\gdk-3.0.lib` points to `%VCPKGDIR%\lib\gdk-3.lib`.
48+
* `%VCPKGDIR%\bin\gtk-3.0.dll` points to `%VCPKGDIR%\bin\gtk-3.dll`.
49+
* `%VCPKGDIR%\bin\gdk-3.0.dll` points to `%VCPKGDIR%\bin\gdk-3.dll`.
50+
5. Create the folder `%VCPKGDIR%\etc\gtk-3.0`. Inside it, create the file `settings.ini`:
51+
52+
```ini
53+
[Settings]
54+
gtk-theme-name=win32
55+
```
56+
57+
#### Possible problems
58+
59+
##### `unresolved external symbol gtk_font_chooser_level_get_type`
60+
61+
This is [a bug](https://github.com/gtk-rs/gtk/issues/794) in version 0.6 of gtk-rs with versions of
62+
GTK prior to 3.22.30; either use gtk-rs from Git directly or backport [the fix](https://github.com/gtk-rs/gtk/pull/804)
63+
into the copy of gtk-rs in your Cargo registry.
64+
65+
##### `process didn't exit successfully (exit code: 0xc0000139, STATUS_ENTRYPOINT_NOT_FOUND)`
66+
67+
`%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.
68+
69+
### GNU toolchain
70+
3271
Make sure you have the [GNU ABI] version of the rust compiler installed.
3372
Contrary to earlier instructions, **you don't need to uncheck "Linker and
3473
platform libraries" in the Rust setup or delete `gcc.exe` and `ld.exe` in Rust's

0 commit comments

Comments
 (0)