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

New projects on anchor-cli 0.29.0 / solana-cli 1.17.17 still having ahash errors when building #2792

Closed
mikemaccana opened this issue Jan 26, 2024 · 5 comments
Labels
compile error Issues related to compile errors duplicate This issue or pull request already exists

Comments

@mikemaccana
Copy link
Contributor

mikemaccana commented Jan 26, 2024

I did look for duplicates on this, but couldn't find any. Re rust-lang/rust#86161

ahash still seems to be failing in solana-cli 1.17.17, anchor-cli 0.29.0.

% anchor --version
anchor-cli 0.29.0

% solana --version
solana-cli 1.17.17 (src:27a43800; feat:1337574167, client:SolanaLabs)

% anchor init anchor-test --template=multiple

% cd anchor-test

% anchor build
<...snip...>
   Compiling solana-frozen-abi v1.17.14
   Compiling num-traits v0.2.17
   Compiling memoffset v0.9.0
   Compiling cpufeatures v0.2.12
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

   Compiling jobserver v0.1.27
For more information about this error, try `rustc --explain E0658`.
error: could not compile `ahash` due to previous error
@mikemaccana mikemaccana changed the title anchor-cli 0.29.0 / solana-cli 1.17.17 still having ahash issues on new projects New projects on anchor-cli 0.29.0 / solana-cli 1.17.17 still having ahash errors when building Jan 26, 2024
@acheroncrypto acheroncrypto added the duplicate This issue or pull request already exists label Jan 26, 2024
@acheroncrypto
Copy link
Collaborator

It's a duplicate of #2755 but Anchor doesn't even have a direct dependency to ahash, it's coming from Solana's side solana-labs/solana#34609.

I see in the logs you shared that it's compiling solana-frozen-abi v1.17.14 and ahash wasn't fixed on that version:

https://github.com/solana-labs/solana/blob/cc7c59af9f09932168bad4b3f94e3e09d336f6be/Cargo.toml#L135

It was fixed in the next release(1.17.15):

https://github.com/solana-labs/solana/blob/cc0e9a0e5a6b5c3e86d52ac105dac743826afd9a/Cargo.toml#L135

There is a solution I've posted in #2755 (comment) but in any case, pinning is only a short-term solution and problems like this will continue to happen as long as Solana's rustc is outdated solana-labs/solana#34609.

@mikemaccana
Copy link
Contributor Author

mikemaccana commented Jan 26, 2024

Edit: oh wait, there are two things were are discussing with similar versions, solana-frozen-abi v1.17.14 and solana-cli v1.17.17


If this was fixed in 1.17.15, I don't understand why it's occurring in 1.17.17.

I have heard (from you via Jacob) that cargo update will resolve this but running

cargo update
anchor init anchor-test --template=multiple
cd anchor-test
anchor build

Still produces this error.

@acheroncrypto
Copy link
Collaborator

Yes, the version I was talking about was from the logs you've shared:

% anchor build
   Compiling solana-frozen-abi v1.17.14

it's not your solana-cli version.

I have heard (from you via Jacob) that cargo update will resolve this but running

cargo update
anchor init anchor-test --template=multiple
cd anchor-test
anchor build

Still produces this error.

cargo update command needs to be run in a cargo workspace, not before the workspace is crated. It updates the dependencies to the latest SemVer compatible versions.

You can see which version of Solana crates you have by running:

cargo tree -i solana-program

You can also only update Solana deps with:

cargo update -p solana-program --precise 1.17.17

@mikemaccana
Copy link
Contributor Author

mikemaccana commented Jan 29, 2024

Cool. I made another repo with a workflow to check Anchor is working out of the box though and I can see it works fine.

I can't update my own project right now (I have a deadline and my Anchor program breaks when I run cargo update -p solana-program --precise 1.17.17) but that's beside the point.

% cargo update -p solana-program --precise 1.17.17
    Updating crates.io index
error: failed to select a version for the requirement `solana-program = "=1.17.16"`
candidate versions found which didn't match: 1.17.17
location searched: crates.io index
required by package `solana-zk-token-sdk v1.17.16`
    ... which satisfies dependency `solana-zk-token-sdk = "^1.16.13"` (locked to 1.17.16) of package `spl-token-2022 v0.9.0`
    ... which satisfies dependency `spl-token-2022 = "^0.9"` (locked to 0.9.0) of package `anchor-spl v0.29.0`
    ... which satisfies dependency `anchor-spl = "^0.29.0"` (locked to 0.29.0) of package `revealer v0.1.0 (/Users/mikemaccana/Code/solana/anchor-wtf/programs/anchor-wtf)`
perhaps a crate was updated and forgotten to be re-vendored?

@acheroncrypto acheroncrypto added the compile error Issues related to compile errors label Feb 4, 2024
@acheroncrypto
Copy link
Collaborator

solana-cli 1.18.0 which has a newer version of rustc got released so this particular error is not a problem anymore.

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 duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants