-
Notifications
You must be signed in to change notification settings - Fork 21
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
vcpkg support #8
Comments
Hi Windel. I'm not familiar with Windows development or @sdroege : what do you think about this? |
I'm not very positive about vcpkg as they ship broken GTK since a couple of years without anybody ever fixing it. I expect people to run into problems. If GTK is already that broken for so long, other things will surely be too. Otherwise it would seem like a good solution. @nirbheek do you have opinions? |
vcpkg is listed on the gtk.org website, even though it's known to be broken. I'd say vcpkg support can be added if someone is willing to come in and take ownership of that and deal with broken things :) |
I looked a bit into vcpkg. As a build system on windows, it works great, but how to extract the various build info remains a bit a mistery to me. It would be great to fix the issue in gtk with the gtk-3.lib renaming to gtk-3.0.lib etc.. Hopefully vcpkg can somehow report what the proper filename of the gtk lib files is. The benefit of vcpkg is that you can use the default rust on windows with gtk-rs. This works really well, except for the renaming of dll and lib files. Next item is the resources and settings.ini file, but that's a different story. |
@ids1024 started working on this on #12 Before considering merging this work we'd need to sort out the following:
|
I would still encourage to support this. It is true that vcpkg has its own quirks, but I used it to build a gtk-rs app in windows. Windows support is a thing, and I believe it cannot be ignored. The obligatory response: "if you want to use this application, install linux instead of windows" does not make much sense to me. To me, it appears that this package, |
The point here is not to discuss if we want to support Windows or not, of course we do, but what's the added value |
This is an interesting design topic. I'm a bit reluctant to automatic detection of either pkg-config or vcpkg, since a change of your PATH setting might surprise users. How about sensible defaults per OS, with the option to override it? So:
|
Okay, I'm sorry for this. Ignore my comment about this 😄 , we agree here. I did not try pkg-config on windows, I'll give it a shot some day! Does it work well with visual studio? Is this still a discussion point, which compiler on windows we want to support? rust recommends the visual studio backend, while gtk-rs recommends mingw backend. I guess this is a mismatch, and for me a reason to prefer vcpkg. |
Also vcpkg is not recommended by the gtk project anymore because they packaging is simply too broken. Everybody I know is doing gtk development on Windows otherwise. Both with mingw and msvc (and personally I'd recommend the latter on Windows). Generally the quality of software in vcpkg is really bad, I wouldn't make it the default and making it the default would also break existing workflows. |
My experience with Windows development is basically limited to porting software developed primarily on Linux. So it would be nice to hear from someone who knows more but as I understand it: There are actually two kinds of Rust targets for Windows. But unless I'm mistaken, there isn't an easy way to use
If what I said above is accurate, the advantage would be good support for the
Probably default to vcpkg on |
Making vcpkg the default for the msvc toolchain would also break existing workflows.
It works fine with the msvc toolchain, just not with vcpkg because their packaging is broken. |
Hm. The Gtk docs currently mention gvsbuild. I guess that is currently the best way to use The It seems to me it should probably be supported, in some way, even if not by default. I suppose |
That, or cerbero (there's a branch with gtk support), or using meson directly.
The problem is not so much integration of
That would make sense indeed, yes. |
Still I believe that a good approach on windows would be the rust toolchain with the visual studio compiler with a GTK build with visual studio as well. Is there already a wiki page about building gtk on windows specifically for gtk-rs? I thought there was some sort of guide for it? I keep my own instructions here: https://github.com/windelbouwman/lognplot/blob/master/lognplotgtk/building.md |
It does. That's the officially supported way for finding GTK and how to link to it. |
Hmm, I tried to run gvsbuild, but it failed somewhere with gettext. This looks like the manual route, which I do not wish to walk: https://wiki.gnome.org/Projects/GTK/Win32/MSVCCompilationOfGTKStack |
Reviving this since it was brought up in gtk-rs/gtk4-rs#865. Hi everyone! I'm a maintainer on vcpkg. We'd really like to make it easier for rust to consume C & C++ libraries via vcpkg (as well as the reverse in the future). I'd also like to clarify slightly that vcpkg serves a different role than pkg-config: it should be compared to "apt" instead. For example, we support consuming vcpkg packages via pkg-config, because packages can provide .pc files. Especially in regards to meson and pkg-config, our support for both systems has improved dramatically in the last two years (though we're aware that further improvements remain). It is our intent to supply standard, valid pkg-config files on all platforms for all libraries that have upstream support. I'm sorry that some users have had bad experiences with gtk via vcpkg; the gnome collection of libraries is much more challenging to package properly than a bog-standard CMake "here's a handful of c files". As with many similar ecosystems, vcpkg relies heavily on the community to invest in maintaining packages that have extensive use. As mentioned above, that resulted in historically poor interactions with meson & pkg-config because they are so under-utilized on Windows. Setting that aside, I think an ideal place to start would be to consider vcpkg locations for .pc files. Given a vcpkg install tree at |
Thanks for all these info @ras0219-msft
I'm happy to read that, this will save us from adding support to another mechanism to check deps. So what would you suggest as the right road to ease integration between system-deps and vcpkg? As I understood it, the only thing needed would be to set |
Unfortunately it isn't quite as simple to get I think we should follow the conventions set by https://github.com/mcgoo/vcpkg-rs and https://crates.io/crates/cargo-vcpkg to start with (I'm not the author of those, but I advised during their initial implementation). I don't think I could summarize things any better than just copying parts of their docs, so I'll simply link the standard location: https://docs.rs/vcpkg/latest/vcpkg/. If I recall correctly, those crates attempt to read directly into the vcpkg metadata to provide users integration with all vcpkg packages, not just those providing pkg-config files. Perhaps that's a path worth exploring in the future (system-deps requesting dependency info from cargo-vcpkg), but I think we can get a lot of milage out of just pkg-config for now. Maybe the right answer is to depend upon that crate and ask it to expose a function to get the current target's install tree location? Then it would be something like (apologies for the poor rust and lack of error handling) vcpkg::target_installed_dir().unwrap().join("lib").join("pkgconfig") +@mcgoo for their insight on this |
Yes, I'd rather keep using pkg-config as the one and only way to retrieve deps until we have a very good reason to add another system.
Looks like there is already a public find_vcpkg_root(). Would this do? The vcpkg does not have any dep so we could easily depends on it in system-deps. |
We've fully released manifest mode in the last ~2 years, which changes the location of files from being
Obviously in the case that the user is using Maybe the next steps are to open an issue on the Or to just get things moving you could use the |
Yes, I'd prefer to have this solved in the vcpkg crate(s) first. Can you please open such issue? I'd rather have someone actually understanding the problem do it. ;) |
Hi @ras0219-msft, good to see you in the Rust world. :) I would also like to have better integration of vcpkg and Cargo. This would make it much more practical to use bindings to C & C++ libraries in cross platform Rust applications. I don't like the common practice of Rust bindings to C libraries vendoring the C library. I think Cargo should stick to packaging Rust and not try to take responsibilities for other languages, so integrating vcpkg and Cargo would be great IMO. Having setup vcpkg for two large, complex cross platform C++ applications, I think vcpkg is the most practical way to manage cross platform C & C++ dependencies. FWIW, just thinking about the difficulty of shipping GTK on Windows and macOS made me not even seriously consider the GTK Rust bindings when considering what GUI library to use for my application (I ended up going with Slint which I'm happy with so far). I agree with @gdesmott that we should rely on existing mechanisms for locating C & C++ dependencies, particularly pkgconfig. I just did a quick experiment the other day on x86-64 Linux setting IMO Rust crates should just need to say they want to find a C or C++ library with pkgconfig. Like with C & C++, I think it should be Rust applications', not libraries', responsibility to integrate with vcpkg if they want. I would like the Cargo & vcpkg integration to work similarly to CMake & vcpkg integration. That is, add a vcpkg.json manifest and vcpkg as a submodule to the application repository. Then, have I'm not sure the existing vcpkg-rs and cargo-vcpkg crates are really useful to implement what I described above for using vcpkg in manifest mode. Those crates predate vcpkg's manifest mode and rely on each individual Rust crate which binds a C library to add their own code to integrate with vcpkg. I think we may need a new crate or a major rewrite of cargo-vcpkg to do this. Ideally it would be as simple for applications as adding one line to build.rs to bootstrap vcpkg and call Perhaps this will require some changes in vcpkg-tool as well as new Rust code to make it all work together nicely. It would be great if Microsoft could invest some effort into this. I think some on the vcpkg team know Rust, perhaps you could work on this? Might be worth reaching out to the windows-rs team too. |
Hi!
I'm trying to setup a CI on github actions to build a rust gtk app. This is not an easy task. I'm using vcpkg with visual studio 2019 as a compiler.
Would it be possible / is it an idea at all to add vcpkg support to this system-deps repository?
Regards,
Windel
The text was updated successfully, but these errors were encountered: