Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing installation step for Windows #1584

Merged

Conversation

pieterdd
Copy link
Contributor

Initially the instructions didn't work for me, but I was able to figure out that I was missing a bit of linker configuration. I documented this requirement and rewrote other parts of the Windows documentation a little bit.

Copy link
Collaborator

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, apart from that, it looks good.
Thanks!

Comment on lines 43 to 50
### Ensure your linker can find GTK's library files

Open `%HOMEPATH%\.cargo\config` for editing. You can add extra flags for your linker here to tell it where GTK's library files are. If you're using LLVM's linker with the `stable-x86_64-pc-windows-msvc` Rust toolchain, your config may look like this:

```toml
[target.x86_64-pc-windows-msvc]
linker = "lld-link.exe"
rustflags = ["-C", "link-args=/LIBPATH:C:\\gtk-build\\gtk\\x64\\release\\lib\\"]
```
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that's only necessary if you use lld?
If yes, please make that clear here

Copy link
Contributor Author

@pieterdd pieterdd Jan 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to use it when using the default linker, I just didn't research the appropriate flag to do so. Here's what happens when I remove my ~/.cargo/config:

error: linking with `link.exe` failed: exit code: 1181
(...)
  = note: LINK : fatal error LNK1181: cannot open input file 'gobject-2.0.lib'

This works fine for me:

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "link-args=/LIBPATH:C:\\gtk-build\\gtk\\x64\\release\\lib\\"]

It looks like both linkers support the same flag, so I'll update the documentation accordingly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why I didn't have to do that, but oh well.
Let's add it :)

Rewrite it a bit and document the linker configuration step.
@pieterdd pieterdd force-pushed the expand-windows-install-instructions branch from 0666fd3 to a1fe0db Compare January 28, 2024 12:21
@Hofer-Julian Hofer-Julian merged commit 3f1b05a into gtk-rs:master Jan 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants