-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
[Bug]: detecting native-static-libs on Windows with Rust 1.71 fails when linking crate from a workspace #418
Comments
Adding
I'm puzzled why this only affects Windows... 🤔 |
The generated Cargo.toml for the
I tried removing the empty
Is this a regression in Cargo??? 😕 |
Adding |
Creating the CMake build directory outside of the code repository works around the bug. |
Upstream Cargo bug: rust-lang/cargo#12360 |
Thanks for reporting! Could you test if adding the version field to the workspace table fixes the error? |
The workspace root's Cargo.toml already specifies the version: [workspace.package]
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/KDAB/cxx-qt/"
version = "0.5.3" I also tried specifying a version in the |
I tried reproducing this locally and on my mac M1 the See here for an example which uses windows + Rust 1.71 and has a version specified: https://github.com/corrosion-rs/corrosion/actions/runs/5559992612/jobs/10156620168?pr=419 |
Curious, I haven't seen this bug happen on macOS 🤔 |
We are using I find this behavior a bit strange, since cargo also outputs the warning But okay, we can fix this on the corrosion side by doing a search and replace. |
Huh, I see
Does |
Maybe there are more requirements here. I also don't see the failure in our CI for any platform, even though it should fail after I edited the test. |
Or supply the full Cargo.toml file to use instead of generating it then using CMake to manipulate the text file. |
to work around corrosion-rs/corrosion#418 with Rust 1.71
to work around corrosion-rs/corrosion#418 with Rust 1.71
The fix was released in Corrosion 0.4.2. However, if |
to work around corrosion-rs/corrosion#418 with Rust 1.71
to work around corrosion-rs/corrosion#418 with Rust 1.71
@Be-ing @jschwe Hey I've got a rust project and I've got all the same symptoms as this... But I don't get from the issue what exactly is the root cause or how to rectify it... because I'm not creating any cargo.toml files via cmake or anything like you are. I've got a workspace file, a and a few crates. One of these crates is used as a static library (windows & linux but only windows is showing these issues). I'm using the 2021 edition everywhere... I've only specified [workspace.members]. Do you have any suggestions? |
Are you using corrosion and if yes which version? |
Nope nothing to do with corrosion, I ran into this issue, and only found two instances online, this issue and this. |
Then you are most likely responsible yourself for linking the required libraries into the executable that links the rust static library. Rust 1.71 added more libraries that need to be linked on windows, so you need to check where you added those libraries and add the missings ones. |
@Be-ing why to call Would not
print the same output, where |
|
FWIW |
Current Behavior
Since updating to Rust 1.71, linking staticlibs is failing on Windows with missing symbol errors for the Rust standard library
Expected Behavior
build succeeds, as it did with Rust 1.70 and no changes to our code
Steps To Reproduce
build a staticlib crate with Rust 1.71 and link it to C++ dynamic library or executable
Environment
CMake configure log with Debug log-level
CMake Build step log
The text was updated successfully, but these errors were encountered: