3

When running anchor test on a fresh project without any change, I got following error:

Unable to get recent blockhash. Test validator does not look started. Check {} for errors. Consider increasing [test.startup_wait] in Anchor.toml.

I first tried increasing startup_wait as suggested, but that didn't worked, then tried running solana-test-validator --log and saw error was:

Aborted (core dumped)

So I also tried building it from source as suggested in this answer, but got another error when running solana-test-validator --log again:

Illegal instruction (core dumped)

2 Answers 2

5

If you already tried all this and still getting Illegal instruction error, you probably need to change some compilation variables.

In my case, the problem was the old CPU (older than 2013) and fixed by setting:

export RUST_REED_SOLOMON_ERASURE_ARCH=native

and then compiling all:

./scripts/cargo-install-all.sh . 

as mentioned in this Issue's comment

0

My CPU had no AVX2 and I had to additionally disable it like so:

git clone https://github.com/solana-labs/solana
cd solana
git checkout v1.16.18

cargo clean

export RUST_REED_SOLOMON_ERASURE_ARCH=native
export RUSTFLAGS="-C target-feature=-avx2"

./scripts/cargo-install-all.sh .

export PATH="$PWD"/bin:"$PATH"

Try running cargo clean before the new build since incremental compilation might reuse binaries built with previous compiler options. The build populates the ./bin and ./target folders.

solana-install init is of no need here if you are fine with running the binaries from the cloned git repository.

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.