coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.36k stars 1.25k forks source link

Build Failed | use of unstable library feature 'proc_macro_c_str_literals' #2943

Closed silentEAG closed 2 months ago

silentEAG commented 2 months ago

When creating a new project using anchor init with version 0.30.0, and then directly using anchor build, the following error occurs:

error[E0658]: use of unstable library feature 'proc_macro_byte_character'
   --> /home/ayanami/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.81/src/wrapper.rs:871:21
    |
871 |                     proc_macro::Literal::byte_character(byte)
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #115268 <https://github.com/rust-lang/rust/issues/115268> for more information
    = help: add `#![feature(proc_macro_byte_character)]` to the crate attributes to enable
    = note: this compiler was built on 2024-03-19; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature 'proc_macro_c_str_literals'
   --> /home/ayanami/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.81/src/wrapper.rs:898:21
    |
898 |                     proc_macro::Literal::c_string(string)
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #119750 <https://github.com/rust-lang/rust/issues/119750> for more information
    = help: add `#![feature(proc_macro_c_str_literals)]` to the crate attributes to enable
    = note: this compiler was built on 2024-03-19; consider upgrading it if it is out of date

Version information:

solana --version
solana-cli 1.18.12 (src:b9c13825; feat:4215500110, client:SolanaLabs)
anchor --version
anchor-cli 0.30.0

The issue stems from: https://github.com/rust-lang/rust/issues/115268, with a related issue at https://github.com/DioxusLabs/dioxus/issues/2376.

acheroncrypto commented 2 months ago

nightly is currently required to build the IDL, what version are you on?

Also, https://github.com/coral-xyz/anchor/pull/2941 should help this issue.

silentEAG commented 2 months ago

Oh, it works, thanks! Yes, I used stable to build the IDL. Switching to nightly works well.