-
Notifications
You must be signed in to change notification settings - Fork 552
Remove binary packaging support #979
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
Comments
Path not ending in
;
`Path not ending in ;
This issue appears to be causing the windows-app docs build to fail. Though I'm not a big fan of sinking too much time into getting cross-compilation to work, this is probably something that would need to be addressed, on way or another. |
@tim-weis It appears these FWIW I have previously been told that cross-compiling support is a big deal for windows-rs (unfortunately natively using autogenerated COM bindings on Linux is not :|), and am personally rolling it out to quite a few projects as it is - especially on GH Actions - several orders of magnitude faster than natively compiling Rust projects on Windows. |
This is a know issue. Would appreciate any suggestions as I've not found a satisfactory way to deal with problem. This started with the introduction of packaging support where crates like windows-app need to provide binaries to dependent crates. The difficulty is in determining the target directory so that such crates can copy their binaries to a location where the dependent crates can make use of them. I have described this problem in more detail here and why the I burned through a few published crate versions testing packaging support because Cargo behaves differently depending on whether dependencies are published or not and without a reliable way to find the target directory it became quite a problem to test reliably. |
If the target directory is in the same location on Linux then perhaps that would at least solve the docs and cross-compilation issue. |
@kennykerr That seems like an exceptionally annoying problem to have. Thinking out loud, let's go over the call-sites:
Either way, I have not come across a crate that helps dependent crates copy extra libraries to the target folder, especially when that dependent (directly built) crate provides the libraries itself. It should probably have that as its own build step depending on how the crate is debugged and packaged ( Then,
The |
Previously this worked because the gen crate used |
Agreed
Without providing any copy-logic or However, I think you have already explored this solution? EDIT: FWIW |
master...MarijnS95:winmds @kennykerr Would something like this work for you? |
Does this change affect consumers of the |
@riverar not at all. Winmd from win32metadata is still provided by the windows_gen crate, and crate users are still responsible for providing their own winmd and dlls for "external" bindings that are not within the windows SDK as provided by win32metadata. |
OK but unless I'm misreading the changes (very possible), it looks like all the logic around copying files out of |
Yes, its important to keep the different scenarios in mind. There are basically three.
Other non-Rust build systems make this possible by allowing shared target folders. |
The goal is to get rid of copies entirely, at least for
Scenario 3 is the one I don't want to encounter, at least not in the implicit way it is now. What happens if I add a crate D, that has nothing to do with B nor C but only wishes to pull things from the Would you be opposed to make A shouldn't have to write extra macro goo to deal with stuff from C. C however, should - to be explicit - need an extra line to specify it wishes to take into account the winmds "exported" (or otherwise explicitly provided) by B (and recursively A). Then one can easily add diamond inheritance, say where C wants to read winmds from B and an imaginary crate E. |
Additionally, note that I don't expect crate A to ever see the winmds provided by B nor C; neither should B see the files from C. |
The
Hm, any further details? Requiring developers to directly specify winmds for import (e.g. |
This sounds like a feature specific to Either way I'm fine disabling this with
Downstream crates shouldn't have to explicitly specify the winmds they wish to pull in, given that they would probably have to scour the source of their upstream crate to find out - that's confusing and awkward indeed! The name-ambiguity problem as outlined above remains, too. Rather, downstream crates should specify - for example by means of calling the Let me know if this is clear enough. If not, I'll try to piece together a little example/test one way or another. |
In practice, I don't think scenario 3 is going to be very common at all. It's just something we need for the windows-app crate and perhaps one or two others down the road. We'd just like it to work as smoothly as possible. But the vast majority of projects will be well served by scenarios 1 and 2. Ideally, Cargo itself can eventually pick up the slack and provide first-class support for binary packaging. |
@kennykerr While it'd be nice for cargo to pick this up it's still a highly specific scenario (collecting a [list of a] bunch of files to take into account during a Anyway, what is your view on the proposed solution above? It'll get rid of the |
I've decided to just rip out the binary packaging support for now. Its not an urgently-needed feature right now and we can always revisit in future. The Windows crate will thus continue to support the first two scenarios above. |
@kennykerr So not just binary packaging support, but also recursively re-providing winmds during build/compilation to support scenario 3? Anything I can help out with by rebasing and submitting the branch above? |
I'm going camping so I won't get to this in the next week or so. All the scenario 3 code can disappear.
I'm happy to take care of this upon my return, but feel free to jump start the process if you're confident you know what's required. I just won't be around to spot check. @riverar may be able to help keep an eye on things. He's working on removing the need for this from the windows-app-rs repo. |
Nice, enjoy and have fun on your week off!
Yes, that makes the most sense.
I thought we wanted to get rid of copying altogether? That shouldn't be necessary to support scenario 2 at all? My solution in master...MarijnS95:winmds simply passes the path from
I'll see what I can do, pending the above regarding removing copies altogether. |
The winmd files don't need to be copied, but the |
Ah, I thought that copy behaviour was going to be moved into |
Every crate dependent on the Ref: windows-rs/crates/macros/src/lib.rs Lines 89 to 102 in 49ecfbc
|
@riverar Doesn't That bit of code you linked: windows-rs/crates/macros/src/lib.rs Line 121 in 49ecfbc
At least it uses What's the plan, revert to the state in that commit and then rip out the copy for winmds: windows-rs/crates/macros/src/lib.rs Lines 140 to 144 in 49ecfbc
In favour of propagating its path using something akin to master...MarijnS95:winmds? I'm not in a hurry to get this cross-compilation fixed; if my approach isn't close to what you're planning I'll leave this up to you :) |
Yep! The samples are just Rust development samples and don't represent the Windows app ecosystem very well. There are a zillion reasons to ship files side-by-side with an app, as you can imagine. Could be an application compatibility shim/hook, a localized string or image bucket, libavcodec.dll for video encoding, a manifest to enable access to newer controls and high-DPI support, etc. Nearly all modern Windows apps ship with files at their side. To reduce developer friction and align with the Rust ecosystem's idiomatic Ideally, we'd move all this code elsewhere but I don't believe Cargo has any post-build hooks to latch onto. (Post-build scripts, lifecycle events, etc. are hot asks in the Cargo community/repository but I haven't seen any major RFC movement in that area.) So we're kind of stuck with what we got or "tell the developer to do it themselves / run a script", with the latter being antithetical to creating a great developer experience. Open to other ideas!
If you want to tackle this while Kenny is away, I would say the plan is: revert back to what we had, prior to the PATH/winmd hacks, and maintain the
The approach you had was great/solid but I don't think we need it now. The winmd dependency propagation logic is getting removed. The Make sense? Did I miss anything? |
Hmm, I had assumed there are also quite a few applications that wish to use
For now I'm relying on Linux where libraries are generally easily installable through a package manager and end up in well-known locations that are searched by linkers, instead of having build scripts copy them to the target folder to sit next to an executable (which is only a problem for the few custom libraries one does not install to the system), so I can't really comment on a proper solution. Again, it's fine to revert this to the old system without
I would have submitted that branch (with the deployment behaviour reverted to the old state instead of being removed), but won't be able to test anything on Windows so that might be weird (but we have CI 🎉). Also, see below:
This branch doesn't contain "the propagation logic" as discussed above, just "propagating" the path to windows-rs/crates/gen/src/workspace.rs Lines 83 to 94 in 8e7ce3d
If we don't want to go back to |
Agreed. I think the only blocker for your branch was us wanting to support winmds from a bunch of other crates (scenario 3). But since that's out now, I think your changes would be compatible/welcome. I'm happy to test on Windows when ready. I'm sure if we missed something, Kenny will figure out how to yell at us from afar with just access to rocks and flora. |
Sounds good, I'll get that set up in the coming days!
Will look for smoke signals in the meantime :) |
Path not ending in ;
Cross-compiling a Windows-rs project from Linux (ie. one of the test crates within this repo) result in the following build error:
The
PATH
variable on Linux is separated with colons, not semicolons.It is worrying to see the same undocumented logic and error duplicated across three distinct places in the codebase. What is the first path in
PATH
supposed to point to? Why are the winmd files copied to../../.windows/winmd
relative to it? Do I need to worry about the bit that copies to%PROFILE%
, too?On a related note, is it worth turning the
cargo build
forubuntu-latest
in the CI intocargo check --all --target x86_64-pc-windows-gnu
, to ensure cross-compiling remains in working order?The text was updated successfully, but these errors were encountered: