9

When I compile a simple hello world program, "ahash" never compiles:

   error[E0658]: use of unstable library feature 'build_hasher_simple_hash_one'
   --> src/random_state.rs:463:5
    |
463 | /     fn hash_one<T: Hash>(&self, x: T) -> u64 {
464 | |         RandomState::hash_one(self, x)
465 | |     }
    | |_____^
    |
    = note: see issue #86161 <https://github.com/rust-lang/rust/issues/86161> for more information
    = help: add `#![feature(build_hasher_simple_hash_one)]` to the crate attributes to enable
For more information about this error, try `rustc --explain E0658`

In short: helloworld isn't compiling because of an unstable dependency, yet changing versions of solana-cli and/or solana-program doesn't help

Solana --version:

solana-cli 1.16.25 (src:8dd7d060; feat:2294205250, client:SolanaLabs)

Rustup --version:

rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.75.0 (82e1608df 2023-12-21)`

rustup toolchain list

stable-x86_64-unknown-linux-gnu (default)
solana
2
  • If this is your first solana program I would start with the Anchor framework
    – joebuild
    Commented Dec 31, 2023 at 14:43
  • The same thing happened to me. But, my rust is 1.75.0
    – harlenoo
    Commented Dec 31, 2023 at 15:50

1 Answer 1

16

The easiest way to fix this problem is to add:

ahash = "=0.8.6"

to your dependency list in Cargo.toml

or run:

cargo update -p [email protected] --precise 0.8.6

Error reason

The latest release of ahash uses build_hasher_simple_hash_one which was stabilized in 1.71 but the latest rustc version from the Solana tools is 1.68.0.

Solana has its own fork of rustc which is on a different version than your default rustc installation. You can get the Solana's rustc version by running:

$ cargo build-sbf --version
solana-cargo-build-sbf 1.17.0
platform-tools v1.37
rustc 1.68.0

This problem will get fixed once https://github.com/solana-labs/solana/issues/33504 is resolved.

3
  • 2
    It worked, thank you! And thanks again for the explanation, I really appreciate that! Commented Dec 31, 2023 at 18:27
  • I came across this issue when using the new seahorse-dev implementation. I recently updated Solana and Rust and as a result, got [email protected]. I downgraded to 0.8.6 using the cargo command.
    – gritty
    Commented Jan 16 at 3:16
  • cargo update solved it, thanks!
    – mirind4
    Commented Feb 7 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.