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

Build Failed: use of unstable library feature '_memoffset__offset_of_impl' #3187

Open
yjhmelody opened this issue Aug 22, 2024 · 2 comments
Open
Labels
compile error Issues related to compile errors idl related to the IDL, either program or client side

Comments

@yjhmelody
Copy link
Contributor

# Run anchor build

use of unstable library feature 'offset_of'
   --> /Users/yjhmelody/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-1.18.22/src/program.rs:441:20
    |
441 |         assert_eq!(offset_of!(StableInstruction, program_id), 48);
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> for more information
    = help: add `#![feature(offset_of)]` to the crate attributes to enable
    = note: this compiler was built on 2024-01-15; consider upgrading it if it is out of date
    = note: this error originates in the macro `_memoffset__offset_of_impl` which comes from the expansion of the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info)
anchor --version
anchor-cli 0.30.1
solana --version
solana-cli 1.18.17 (src:b685182a; feat:4215500110, client:SolanaLabs)
cargo --version
cargo 1.82.0-nightly (ba8b39413 2024-08-16)
rustc --version
rustc 1.82.0-nightly (5aea14073 2024-08-20)

It could not generate idl but works for anchor build --no-idl.

@acheroncrypto acheroncrypto added idl related to the IDL, either program or client side compile error Issues related to compile errors labels Aug 22, 2024
@acheroncrypto
Copy link
Collaborator

It looks like offset_of was stabilized in rustc 1.77 (rust-lang/rust#106655 (comment)).

The error logs mention:

this compiler was built on 2024-01-15; consider upgrading it if it is out of date

which could be the root of the problem. I'd try overriding the nightly version with the RUSTUP_TOOLCHAIN environment variable (release notes).

@yjhmelody
Copy link
Contributor Author

yjhmelody commented Aug 26, 2024

Ok, it work when override it. But better to always print current version for anchor build, since we really do not know which version it was being used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compile error Issues related to compile errors idl related to the IDL, either program or client side
Projects
None yet
Development

No branches or pull requests

2 participants