-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Generated meson.build from Cargo crate references undefined variable #13855
Comments
I also have this issue, with a different project and dependency here. It's kind of blocking me from using Meson to build Rust, because there doesn't seem to be an option to disable default features, like |
Poking around a bit in the libflate example, I notice that libflate depends on libflate_lz77. libflate itself has these features: [features]
default = ["std"]
std = ["libflate_lz77/std", "core2/std"] Meanwhile, libflate_lz77 has these features: [features]
default = ["std"]
std = ["core2/std", "libflate/std"] It looks like... each one is trying to enforce on the other, to build with a consistent set of features? And lz77 wants to force the feature active for its own parent crate, not a dependency. Which is apparently legal. Is this only the case because libflate via path ../ is a dev-dependency, or is this generally legal? I guess meson needs to handle arbitrary features getting set on things that aren't in dependencies. |
Yeah I suspect I think the issue is this code in meson is assuming that a dependency should be added whenever a crate tries to enable a feature on a dependency crate using https://github.com/mesonbuild/meson/blob/master/mesonbuild/cargo/interpreter.py#L581-L582 Reference: https://doc.rust-lang.org/cargo/reference/features.html#dependency-features I haven't quite gotten the fix right though, so, maybe I'm mistaken somehow. |
There are a few different build modes in Cargo that have separate sets of dependencies. The features section applies to dependencies in any mode. Sometimes, features are specified for dependencies that aren't actually included in normal builds: those dependencies should not be added to the build, and the feature toggle can be ignored. [1] [1]: https://doc.rust-lang.org/cargo/reference/features.html#dependency-features Resolves: mesonbuild#13855 Signed-off-by: Peter Delevoryas <peter@pjd.dev>
There are a few different build modes in Cargo that have separate sets of dependencies. The features section applies to dependencies in any mode. Sometimes, features are specified for dependencies that aren't actually included in normal builds: those dependencies should not be added to the build, and the feature toggle can be ignored. [1] [1]: https://doc.rust-lang.org/cargo/reference/features.html#dependency-features Resolves: mesonbuild#13855 Signed-off-by: Peter Delevoryas <peter@pjd.dev>
First step at fixing this: #13976. Configure passes but it has a bunch of build time errors, like:
That requires using the |
Seems rustc decided to close the issue.... someone will have to push them harder... rust-lang/rust#119926 |
Describe the bug
Meson's cargo importer generates a meson.build that is referencing an undefined variable for the crate libflate_lz77, which is a transitive dependency of the crate I'm trying to import.
Might be related to these two crates depending on each other, or dev-dependencies: libflate depends on libflate_lz77 and libflate_lz77 has libflate in its dev-dependencies.
The first couple lines from the meson.build in question (note libflate_options not being defined unlike the others):
To Reproduce
meson.build:
matfile.wrap:
Expected behavior
The generated meson.build for libflate_lz77 does not reference an undefined variable.
system parameters
meson --version
1.6.0 (with patch from 5769074)ninja --version
if it's a Ninja build? 1.12.1The text was updated successfully, but these errors were encountered: