Skip to content
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

Building with default features on macOS requires rustc v1.79 or newer. #2261

Closed
dmbfm opened this issue Jun 16, 2024 · 7 comments
Closed

Building with default features on macOS requires rustc v1.79 or newer. #2261

dmbfm opened this issue Jun 16, 2024 · 7 comments

Comments

@dmbfm
Copy link

dmbfm commented Jun 16, 2024

I am using macOS Sonoma 14.4.1, rustc/cargo version 1.77.2. When trying to use the image crate with the default features enabled I get an error about the minimum required rust version.

Expected

Since the minimum version for the image crate is 1.67.1, the program should build correctly.

Actual behaviour

I get the following message when trying to run cargo build:

error: package `ravif v0.11.7` cannot be built because it requires rustc 1.79 or newer, while the currently active rustc version is 1.77.2
Either upgrade to rustc 1.79 or newer, or use
cargo update [email protected] --precise ver
where `ver` is the latest version of `ravif` supporting rustc 1.77.2

Reproduction steps

cargo new image-test
cd image-test
cargo add image
cargo build
@kornelski
Copy link
Contributor

kornelski commented Jun 17, 2024

I've made ravif demand 1.79, because a dependency of rav1ebitstream-io — started using inline const syntax, which requires 1.79. If you didn't get the version error on ravif, you'd get even more confusing build errors.

You can build it on older Rust if you downgrade bitstream-io to 2.3.0 and ravif to 0.11.5

The fix

cargo update
cargo update ravif --precise 0.11.5
cargo update bitstream-io --precise 2.3.0

@dmbfm
Copy link
Author

dmbfm commented Jun 18, 2024

It's not much of an issue for me really but if the MSRV of the image crate is 1.67.1, shouldn't it ideally work with the default features of the crate?

@kornelski
Copy link
Contributor

kornelski commented Jun 18, 2024

The crate may be compatible with an older version of Rust itself, but it can't control what the 3rd party dependencies are doing. Pinning dependencies to older versions has other project-breaking consequences.
Cargo doesn't have ability to select dependencies based on Rust compatibility yet (in stable releases), so if you need to work with an older version of Rust, you need to downgrade dependencies yourself.

@dmbfm
Copy link
Author

dmbfm commented Jun 18, 2024

Got it. Thanks!

@dmbfm dmbfm closed this as completed Jun 18, 2024
@HeroicKatora
Copy link
Member

HeroicKatora commented Jun 18, 2024

@dmbfm This is quite recent and likely very relevant: rust-lang/cargo#13873 Although it doesn't exist at the Rust toolchain version you're looking for (except with hacks over installing a much newer cargo than rustc detailed in the thread, maybe it actually would work) that's the workflow which should be working one day. The tooling team is likely to be very interested in your issue and whether it'd be solved by that implementation.

@kornelski
Copy link
Contributor

MSRV-aware resolver unfortunately doesn't fix this, because bitstream-io 2.4.0 added 1.79-requiring code without rust-version. They've fixed it in 2.4.1, but MSRV-aware cargo downgrades to 2.4.0 only, not to 2.3.0.

@fintelia
Copy link
Contributor

fintelia commented Jul 2, 2024

In CI we do validate that -Z minimal-versions compiles with the MSRV Rust version. You'd be missing out on lots of bug fixes and such, but at least it allows you to identify one consistent set of dependency versions that work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants