Installing GTK-RS

Hi everyone,

I'm new to Rust, but I have a project in mind that should help me learn a lot about it. But, I'm a little discouraged ATM and hoping someone would be able to point me in the right direction of where I'm going wrong.

I'm trying to import the gtk-rs library, but I keep getting this error: failed to run custom build command for `glib-sys v0.10.1

So I thought that adding the "glib-sys v0.10.1" crate would resolve my issue, but it has not. Meanwhile, when I try to install GTK+3 via the gvsbuild from the git repo, that is not working either. I'm getting syntax errors even though I'm just copying and pasting what is listed on the GIT for how to actually build.

I haven't this many problems with just setting things up before and I'm frustrated after 6 hours of just trying to figure the setup piece of this. I've tried browsing the web for answers, but nothing really tackles my problem. I'm running a Windows 10 system with CLion. Any window\rust magicians out there willing to cast "knowledge raise", I feel stupid. Probably just need to get some sleep.

I don't have the answer, but I can confirm that installing GTK on windows is a nightmare.

I installed gtk from vcpkg the other day with the intention of trying out gtk-rs. Unfortunately I haven't gotten around to the gtk-rs part yet, but gtk built fine, at least.

Relevant reddit post

If something compiles on Windows that relies on gts-rs, will the binary link static to the GTK library? Will it run on a window system without GTK, or will the end user need to install GTK to run the program?

That's up to whoever built the gtk library. If gtk is built to produce static libraries, it will statically link. If it's built to produce dynamic libraries, it will require the dynamic libraries.

As mentioned earlier, I built gtk using vcpkg. If the supported triplet windows-x64 is used, it will build fine -- however it will produce dynamic libraries. I want to statically link all libraries, except the CRT. For this there's a community triplet called x64-windows-static-md. Unfortunately one of gtk's dependencies in vcpkg failed to build using this triplet.

But the answer to your specific question is: It depends on the type of .lib files the linker finds, and that in turn depends on how the gtk libraries were built.

1 Like

I will try this because the instructions that suggest using the gsvbuild don't seem to work or I should say the command line doesn't seem to work. Otherwise, I may just try NWG because I really just need a simple gui & Rust.. GTK just seemed like the most robust and mature library for UI design and Rust. But, if it's exhaustive to install, what's the point? I want to spend my time designing, not troubleshooting.

I appreciate everyone's feedback. If anyone else has more insight into the issue, I'd ready appreciate it.