Problem:
I'm trying to build an Anchor project on Solana, but I'm encountering compatibility issues with the rustc version used by the Solana tools. The specific error is:
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.84Either 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-devThis indicates that the rustc version used by the Solana tools (1.79.0-dev) is not compatible with the version required by the bytemuck_derive dependency (1.84).
Solutions Tried:
Reinstalling avm
:
We uninstalled and reinstalled avm using cargo uninstall avm
and cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
.
This did not resolve the issue.Manually installing the Solana CLI:
We tried installing the Solana CLI using the Solana installation script sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
and the new installation link sh -c "$(curl -sSfL https://release.anza.xyz/install/solana)"
.We also attempted to install a specific version of the Solana CLI.This did not resolve the issue.Creating a symbolic link for the Solana SDK:
We created a symbolic link from the Solana SDK location installed by the Solana CLI to the directory expected by avm (/home/mounir2/.cargo/bin/platform-tools-sdk/sbf).This did not resolve the issue.Configuring anchor build to use rustc from rustup:
We used the RUSTC environment variable to specify the path to rustc from rustup (export RUSTC=/home/mounir2/.cargo/bin/rustc).This led to an error indicating that cargo-build-sbf was not installed.Installing cargo-build-sbf:
We attempted to install cargo-build-sbf using cargo install cargo-build-sbf, but encountered a permission error.We resolved the permission issues by modifying the permissions of the rustc file and the project directory.Modifying the project directory permissions:
We modified the project directory permissions to allow user mounir2 to access it.This did not resolve the rustc version compatibility issue.Current Situation:
We are back to the initial error regarding the rustc version.