My issue is that something is trying to call pkg-config on Windows. How can I replace this or stub it with something that gives the right output? I've installed gtk4 using gvsbuild so theoretically the Rust bindings will work.
Compiling gio-sys v0.17.4
The following warnings were emitted during compilation:
warning: Could not run `"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.66"`
error: failed to run custom build command for `glib-sys v0.17.4`
Windows 10, Visual Studio build tools are installed.
Split because I apparently can't post too many links
After installing pkg-config via msys2 and adding it to my PATH, I get
cargo:warning=`"pkg-config" "--libs" "--cflags" "glib-2.0" "glib-2.0 >= 2.66"` did not exit successfully: exit code: 1
error: could not find system library 'glib-2.0' required by the 'glib-sys' crate
--- stderr
Package glib-2.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glib-2.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'glib-2.0', required by 'virtual:world', not found
Package 'glib-2.0', required by 'virtual:world', not found
I've then been searching for how to add paths to the linker flags, Rustc-link-search in cargo config is the only thing that worked, Build Scripts - The Cargo Book I guess doesn't work because there's no build script? (what is generating the link.exe command then?)
It wants you to have pkg-config installed, and pkg-config expects you to have glib-2.0 library installed AND have a glib-2.0.pc file in a directory where pkg-config is looking for it. On Windows I don't even know where that directory would be. It's a unix-centric tool looking for a unix-centric library.
I actually got this working and then hit a number of other bugs.
For anyone else in this unusual situation, you need:
MSVC toolchain (installed with rustup-init if you didn't have it)
MSYS2
gvsbuild from GitHub - wingtk/gvsbuild: GTK stack for Windows
In MSYS2, you need to install mingw-w64-x86_64-pkgconf and mingw-w64-x86_64-glib2 (and whatever other libraries pkgconf is using - you're now outside of the MSVC world, use pacman -Fy filename.pc to find the packages
I would say the documentation at Windows - GUI development with Rust and GTK 4 is not quite complete, unless this call out to pkgconfig is just something the particular project I am trying to compile is doing.