Skip to content

lang: Fix bytemuck_derive build error#3610

Merged
acheroncrypto merged 1 commit intosolana-foundation:masterfrom
acheroncrypto:lang-fix-bytemuck_derive-build-error
Mar 19, 2025
Merged

lang: Fix bytemuck_derive build error#3610
acheroncrypto merged 1 commit intosolana-foundation:masterfrom
acheroncrypto:lang-fix-bytemuck_derive-build-error

Conversation

@acheroncrypto
Copy link
Copy Markdown
Collaborator

Problem

anchor-lang doesn't compile due to an update to the bytemuck_derive crate.

error: rustc 1.79.0-dev is not supported by the following package:

                 Note that this is the rustc version that ships with Solana tools and not your system's rustc version. Use `solana-install update` or head over to https://docs.solanalabs.com/cli/install to install a newer version.
  bytemuck_derive@1.9.2 requires rustc 1.84
Either upgrade rustc or select compatible dependency versions with
`cargo update <name>@<current-ver> --precise <compatible-ver>`
where `<compatible-ver>` is the latest version supporting rustc 1.79.0-dev

As the error message suggests, the latest version of the bytemuck_derive crate specifies MSRV as 1.84, which is incompatible with the Rust version coming from the latest Solana version (1.79.0).

This is one of the issues with Rust's dependency management where even though anchor-lang only depends on bytemuck, and doesn't have its derive feature enabled, cargo refuses to build even when bytemuck_derive is an optional dependency that isn't enabled.

In stable Rust 1.84, cargo supports trying to fallback to a supported version instead of returning an error, which should fix many issues similar to this one. See:

Summary of changes

Add bytemuck_derive version requirement to be >1.0.0, <1.9.

This is a short term fix that will be removed once Solana build tools are on Rust >=1.84 (currently 1.79.0).

Fixes #3606

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 19, 2025

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added lang dependencies Pull requests that update a dependency file fix Bug fix PR labels Mar 19, 2025
@acheroncrypto acheroncrypto merged commit a107d82 into solana-foundation:master Mar 19, 2025
48 of 53 checks passed
@jacobcreech jacobcreech mentioned this pull request Mar 22, 2025
@Gizmor108
Copy link
Copy Markdown

i got this same error what should i do ?

error: rustc 1.79.0-dev is not supported by the following package:

             Note that this is the rustc version that ships with Solana tools and not your system's rustc version. Use `solana-install update` or head over to https://docs.solanalabs.com/cli/install to install a newer version.

indexmap@2.12.1 requires rustc 1.82
Either upgrade rustc or select compatible dependency versions with
cargo update <name>@<current-ver> --precise <compatible-ver>
where <compatible-ver> is the latest version supporting rustc 1.79.0-dev

@acheroncrypto
Copy link
Copy Markdown
Collaborator Author

i got this same error what should i do ?

You should update your Solana tooling version or downgrade problematic versions of crates like in this PR.

Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file fix Bug fix PR lang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error: failed to download bytemuck_derive v1.9.1 feature edition2024 is required

2 participants