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 documentation about how to compile for Windows without cross-compilation #70

Open
sdroege opened this issue Mar 23, 2018 · 11 comments · May be fixed by #190
Open

Add documentation about how to compile for Windows without cross-compilation #70

sdroege opened this issue Mar 23, 2018 · 11 comments · May be fixed by #190

Comments

@sdroege
Copy link
Member

sdroege commented Mar 23, 2018

See https://www.reddit.com/r/rust/comments/86kmhu/compiling_rust_windows_gtk_stepbystep/ for a good start

@EPashkin
Copy link
Member

We have almost same in http://gtk-rs.org/docs-src/requirements.html
but it can be not fully actual now

@EPashkin
Copy link
Member

.. and it also present in your link.

@asteding
Copy link

asteding commented Sep 4, 2019

I followed the steps on the tutorial to test the cross compilation from Archlinux to Windows and failed with linker problems.
Is the tutorial up to date?
Can anybody confirm?

@sdroege
Copy link
Member Author

sdroege commented Sep 4, 2019

How does it fail?

@asteding
Copy link

asteding commented Sep 4, 2019

@sdroege
I followed the instructions from https://gtk-rs.org/docs-src/tutorial/cross
If i run

cargo build --target=x86_64-pc-windows-gnu --release

The output looks like https://paste.xinu.at/wCc8rp/ . To me it looks like i can compile the whole program, but linking fails.
Shell i also upload the small project i tried on?

@sdroege
Copy link
Member Author

sdroege commented Sep 5, 2019

Needs someone who actually knows about Windows to look at that. Sounds to me like a toolchain incompatibility between the GTK binaries and the Rust toolchain.

@asteding
Copy link

asteding commented Sep 5, 2019

If you need any additional information that will help solve this or make this work please let me know. I'll also try to further investigate. I'd love to have a cross compile GTK for rust.

@Firionus
Copy link

Firionus commented Jul 7, 2020

I just got Hello World to work on Windows, which was great, but I felt the onboarding experience was a bit rough. It can be hard to put yourself in the shoes of a new user once you're not anymore, so I tried to write these problems down while they're still fresh in my mind:

  • Is Step 5 of the GTK Windows MSYS2 install instructions required for Gtk-rs? What parts of mingw-w64-x86_64-toolchain can be omitted? (It has 17 install options. Do I really need Ada, Fortran, Objective C?)
  • Requirements is not supposed to be used anymore. But it is the only document with Windows install instructions.
    • SETX failed with this error for me. Setting in GUI worked, so I didn't investigate.
    • Requirements gives the impression that only one of the sections "Using the native Windows shell" or "Using the MSYS2 MinGW shell" needs to be executed. However I could only compile after installing mingw-w64-x86_64-pkg-config and mingw-w64-x86_64-gcc, indicating the second part isn't optional.
  • Needing the GNU ABI is only metioned in the deprecated Requirements
    • The linked rustup README on GNU ABI is hard to understand.
      • What do these things mean when I want to set up Gtk-rs?
      • Do I only need the rustup gnu target or the full gnu toolchain for Gtk-rs?
      • How do I configure Rust to use the right target/toolchain for my project without explicitly specifying it at every call to cargo?

A Windows build documentation should address those questions because other new users will likely also face them.

@sdroege
Copy link
Member Author

sdroege commented Jul 7, 2020

Is Step 5 of the GTK Windows MSYS2 install instructions required for Gtk-rs? What parts of mingw-w64-x86_64-toolchain can be omitted? (It has 17 install options. Do I really need Ada, Fortran, Objective C?)

No, a C compiler is sufficient.

* What do these things mean when I want to set up Gtk-rs?

With MSYS2 you need to install the GNU Windows Rust toolchain via rustup but you don't need to install the full GNU toolchain via MSYS2. All you need for building gtk-rs is part of the Rust toolchain, you might only need other parts for building C code.

This is only a limitation/bug with MSYS2 though: if you build GTK correctly you can use a GTK built with MSVC with the Rust GNU toolchain, and a GTK built with the GNU toolchain with the Rust MSVC toolchain and any other combination you might want.

* How do I configure Rust to use the right target/toolchain for my project without explicitly specifying it at every call to cargo?

rustup override set and rustup default are what you're looking for. The first is per-project, the latter is the global default.

@jscissr jscissr linked a pull request Dec 29, 2020 that will close this issue
@sophie-h
Copy link
Contributor

@Hofer-Julian Either move to gtk4-rs or close as duplicate of gtk-rs/gtk4-rs#259?

@Hofer-Julian
Copy link
Contributor

This issue talks about gtk3, so I'd close it if the alternative is moving to gtk4-rs

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 a pull request may close this issue.

6 participants