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

anchor build failed. with use of unstable library feature 'build_hasher_simple_hash_one' #2755

Closed
just-like-a-boby opened this issue Dec 31, 2023 · 7 comments
Labels
compile error Issues related to compile errors lang

Comments

@just-like-a-boby
Copy link

here is my tool-chain
anchor_version = "0.29.0" solana_version = "1.17.13"
i have change the solana_version from 1.16.24 stable to 1.17.13. but it did't work

@just-like-a-boby
Copy link
Author

rustc version is rustc 1.76.0-nightly

@acheroncrypto acheroncrypto added lang compile error Issues related to compile errors labels Dec 31, 2023
@acheroncrypto
Copy link
Collaborator

This happens because Solana's rustc is outdated(solana-labs/solana#33504).

The easiest way to fix this is to downgrade ahash version to the latest compatible version by adding:

ahash = "=0.8.6"

to your dependency list in Cargo.toml.

@acheroncrypto
Copy link
Collaborator

Fixed in solana-labs/solana#34636 and solana-labs/solana#34650

@oWahyudi
Copy link

still having hash error when building (anchor build)

[dependencies]
ahash = "=0.8.6"

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 rust-lang/rust#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.
error: could not compile ahash due to previous error

@beeman
Copy link

beeman commented Jan 27, 2024

still having hash error when building (anchor build)

[dependencies] ahash = "=0.8.6"

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 rust-lang/rust#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. error: could not compile ahash due to previous error

Can you share a repo that shows this error so I can test it locally?

@oWahyudi
Copy link

this my repo:
https://github.com/oWahyudi/staking_program

The codes can successfully compile using the cargo build command.

$>cargo build
warning: `staking_program` (lib) generated 9 warnings (1 duplicate) (run `cargo fix --lib -p staking_program` to apply 5 suggestions)
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s

compilation error when compile using the anchor build command.

$>anchor build
error: package `solana-program v1.18.0` cannot be built because it requires rustc 1.72.0 or newer, while the currently active rustc version is 1.68.0-dev
Either upgrade to rustc 1.72.0 or newer, or use
cargo update -p solana-program@1.18.0 --precise ver
where `ver` is the latest version of `solana-program` supporting rustc 1.68.0-dev

@acheroncrypto
Copy link
Collaborator

compilation error when compile using the anchor build command.

$>anchor build
error: package `solana-program v1.18.0` cannot be built because it requires rustc 1.72.0 or newer, while the currently active rustc version is 1.68.0-dev
Either upgrade to rustc 1.72.0 or newer, or use
cargo update -p solana-program@1.18.0 --precise ver
where `ver` is the latest version of `solana-program` supporting rustc 1.68.0-dev

That error has nothing to do with this issue, run solana-install init 1.18.0 to fix it.

@coral-xyz coral-xyz locked as resolved and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compile error Issues related to compile errors lang
Projects
None yet
Development

No branches or pull requests

4 participants