-
Notifications
You must be signed in to change notification settings - Fork 489
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
Linux -> Windows Cross Compilation broken #638
Comments
Have you actually tried to build for Windows on Linux? I'm not sure that's ever worked. That would require libs for Windows that a Linux-based linker could use to resolve imports, not to mention a C++ compiler that can cross compile for Windows on Linux. Not saying that's not possible, but I'd be surprised if that worked before this change. Also, I would imagine this problem would eventually go away once DLL imports are implemented. |
Anyway, I deal with the issue of the build script not necessarily using the target compiler by checking the |
Hmm what do you mean? We use a mingw cross compiler on Linux to build for Windows and that works fine (except for this crate). Using the winapi crate works but I thought I would give this one a try but if it is not supported for this crate then so be it :) |
That works because the |
I'll leave this open for now while noting that it is blocked on rust-lang/rust#58713. |
Cool, thanks! :) |
Just wanted to continue my comments from issue #1073, I confirmed that in my particular case I was able to cross-compile a simple MessageBoxA testing project. (Compiled on Debian with mingw) I symlinked like so: So with that working I started to look at how to work out how I could get windows-rs to work without symlinking the libraries. |
Related to rust-lang/rust#58713 and @ricobbe's work. |
On my Windows SDK version 10.0.22000.0 installation it is cased as windows-rs/crates/gen/src/function.rs Line 15 in 21ed8f2
|
Thank you for your help! That line was indeed the one that I needed to change to get it to work: This meant that line 21 had to change to: Together with lower casing the link macros in bindings.rs cross-compilation works in my particular project! I might have broken two legacy test cases in pwstr.rs however. |
@abbec @ke1satsu I applied the lowercase change in #1128 - let me know if there is anything else preventing you from cross compiling. Also feel free to suggest some sort of test that I can add to the build here to make sure cross-compilation keeps working - I don't have any experience with Linux otherwise I would add something. |
Awesome! Thanks alot :) As for tests in the build, I'm sorry to say I've never touched CI/CD so I'm unsure how one could go about checking that in the pipeline. If I figure something out I'll make sure to drop some suggestions here! |
I can wire up |
Thanks! |
@ke1satsu What are you using to satisfy |
Your guess was spot on, I just needed a limited few API calls for what I tried to do. I saw that some tests broke but I wasn't sure what the tests really did so I left them alone. You also seem right in that mingw doesn't seem to include onecoreuap, unless its bundled somewhere. I tried googling it and there are surprisingly few threads complaining about it lacking so I'm not really sure. |
@ke1satsu Hah, thanks for the quick follow up! I'll think some more about how we handle this. |
It's true that most (all?) umbrella libraries are missing from mingw-w64. Nobody asked for it on the mailing list yet so I think they would accept patches adding it. |
This change 198621c#diff-26e81435323b9d11b39a44aa6f5adf5b3d863e3b2b149d6c2777b925ca8694b9R53 seems to break cross-compilation from Linux. It seems the build script is run with the equivalent of
cfg!(unix)
, notcfg!(windows)
.The text was updated successfully, but these errors were encountered: