60262186
Lok Sze Decoration Engineering Limited
Flat C7, 5/F, Tung Lee Factory Building, 9 Lai Yip Street, Kwun Tong, Kowloon

  • 中文 (香港)
  • English
  • Solana: Package `Solana-program vX.X.X` cannot be built because it requires rustc X.X.X or newer

    Error Messages and Solutions for Building Anchor Packages on Solana

    As a developer working with the Solana platform, you are probably familiar with building and deploying packages using the Anchor framework. However, sometimes you may encounter errors when trying to build or deploy a package that relies on an outdated version of Rust. In this article, we will address two common issues related to building Anchor packages: “Solana: Package solana-program vX.X.X cannot be built because it requires rustc X.X.X or later” and “error: package solana-program v1 .18.26 cannot be built because it requires rustc 1.75.0 or later, while the currently active rustc version is 1.72.0-dev”.

    Issue 1: Solana: Package solana-program vX.X.X cannot be built because it requires rustc X.X.X or later

    When you run anchor build, the command fails to compile your Solana package due to a mismatch between the required Rust version and the current Rust version used by Anchor. This error message indicates that the solana-program package relies on Rust 1.75.0 or later, but currently has the active Rust version 1.72.0-dev.

    To resolve this issue, you need to upgrade your Rust version or use a compatible version of the solana-program package. Here are some steps to fix this error:

    • Upgrade your Rust version: You can update to the latest stable or beta version using the following commands:

    hit

    rustup upgrade --selfinstall

    Alternatively, you can use rustup tool install --upgrade where is the desired version.

    • Use a compatible version of the solana-program' package: you can try to downgrade or use a stable branch from the official Solana repository. For example:

    kick

    git clone

    cd solan-program

    git checkout v1.19.0

    • Rebuild your package: After updating your Rust version and switching to a compatible version of solana-program, rebuild your package using the following command:

    kick

    build anchor

    Issue 2: Error: Package solana-program v1.18.26 cannot be built because it requires rustc 1.75.0 or later, while the currently active rustc version is 1.72.0-dev

    This error message indicates that the package solana-programrelies on a specific Rust version, but currently has the active Rust version 1.72.0-dev.

    To solve this problem, you can:

    • Downgrade your Rust version: You can update to the latest stable or beta version using the following commands:

    
    

    striker

    rustup upgrade -- self-installation

    Alternatively, you can use rustup tool install –upgrade whereis the desired version.

    • Use a compatible version of thesolana-program’ package: you can try to downgrade or use a stable branch from the official Solana repository. For example:

    striker

    git clone

    cd solan-program

    git billing v1.17.0

    • Rebuild your package: After updating your Rust version and switching to a compatible version of solana-program, rebuild your package using the following command:

    striker

    anchor to build

    Metamask Error Withdrawing