Solana Test Validator error - missing AVX2

I’ve been working through this Figment tutorial…

When I run solana-test-validator I get ‘Aborted.’

Running with --log. I get this

[2021-11-01T12:23:12.966788500Z WARN solana_perf] CUDA is disabled
[2021-11-01T12:23:12.966832300Z INFO solana_perf] AVX detected
[2021-11-01T12:23:12.966837600Z ERROR solana_perf] Incompatible CPU detected: missing AVX2 support. Please build from source on the target
Aborted

Looks like I need to build from source. How do I remove the installed binaries? I can’t see instructions for that in the Solana docs.

Or will building from source just overwrite my current install?

Hi @TheBodyElectric and welcome to the forum! :wave:

See this post for the best way I know to uninstall Solana:

Thanks @zicklag.

Do you know anything about the AVX2 error? Is building from source the only way around this?

Yeah. As far as I understand it, which may not be 100% correct, AVX is a hardware feature supported by certain CPU’s and used by Solana to speed up certain operations. In order to reduce binary size, they only build the Solana with support for certain ( the most common, probably ) CPU features that they need. Because your CPU has a different feature set, you have to compile Solana so that it will use that feature set on your CPU, and Solana just doesn’t have it pre-compiled with support for your CPU feature set, so you have to do it yourself.

Building Solana shouldn’t be too difficult. Feel free to ask if you have problems compiling it.

I’ve just had the chance to return to this. My build fails with this.

"Compiling solana-frozen-abi-macro v1.8.2 (…/solana-1.8.2/frozen-abi/macro)
error: expected item, found ..
→ frozen-abi/macro/build.rs:1:1
|
1 | …/build.rs
| ^^ expected item

error: aborting due to previous error

error: could not compile solana-frozen-abi-macro

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish…
error: build failed"

I notice that build.rs file actually contains the text “…/build.rs” instead of Rust source code. I assume that’s an error in the source. I’m using the download from almost a week ago, so it may have been updated since. I’ll check.

Edit: no, not been updated in 12 days.

Ah, I know what happened. You downloaded the source using the “Download Zip” button on GitHub right?

That file that is failing to compile is supposed to be a symlink, and I think Zip files don’t support symlinks.

You’ll have to clone the source code with the git command or the GitHub desktop app.

I downloaded the sources with the command “git clone”. And I have the same build error as the author of the topic.

Hi @Bojo and welcome to the forum!

What OS are you building on? Is it an older version of Windows maybe?

Yes, on Windows 7. My laptop cannot be upgraded to Windows 10. Will only Linux help?

If this file is the only one with problems you can just manually delete the frozen-abi/macro/build.rs file, then copy the frozen-abi/build.rs file to frozen-abi/macro/build.rs.

Thanks. But after these actions, I received the following errors:

D:\Projects\Solana\solana>cargo.exe build
   Compiling solana-program v1.9.0 (D:\Projects\Solana\solana\sdk\program)
   Compiling solana-sdk v1.9.0 (D:\Projects\Solana\solana\sdk)
   Compiling solana-program-runtime v1.9.0 (D:\Projects\Solana\solana\program-r
ntime)
   Compiling solana-vote-program v1.9.0 (D:\Projects\Solana\solana\programs\vot
)
   Compiling solana-stake-program v1.9.0 (D:\Projects\Solana\solana\programs\st
ke)
   Compiling solana-runtime v1.9.0 (D:\Projects\Solana\solana\runtime)
   Compiling solana-version v1.9.0 (D:\Projects\Solana\solana\version)
   Compiling solana-gossip v1.9.0 (D:\Projects\Solana\solana\gossip)
error: expected item, found `..`
 --> sdk\program\build.rs:1:1
  |
1 | ../../frozen-abi/build.rs
  | ^^ expected item

error: could not compile `solana-program` due to previous error
warning: build failed, waiting for other jobs to finish...
error: expected item, found `..`
 --> sdk\build.rs:1:1
  |
1 | ../frozen-abi/build.rs
  | ^^ expected item

error: expected item, found `..`
 --> program-runtime\build.rs:1:1
  |
1 | ../frozen-abi/build.rs
  | ^^ expected item

error: expected item, found `..`
 --> programs\vote\build.rs:1:1
  |
1 | ../../frozen-abi/build.rs
  | ^^ expected item

error: expected item, found `..`
 --> programs\stake\build.rs:1:1
  |
1 | ../../frozen-abi/build.rs
  | ^^ expected item

error: expected item, found `..`
 --> runtime\build.rs:1:1
  |
1 | ../frozen-abi/build.rs
  | ^^ expected item

error: expected item, found `..`
 --> version\build.rs:1:1
  |
1 | ../frozen-abi/build.rs
  | ^^ expected item

error: expected item, found `..`
 --> gossip\build.rs:1:1
  |
1 | ../frozen-abi/build.rs
  | ^^ expected item

error: build failed

Ah, OK. You need to replace each of those files that are showing an error with a copy of the frozen-abi/build.rs file.

Hopefully will be all that we need to fix.

It helped, thank you. Then another error occurred:

   Compiling futures-macro v0.3.18
error: failed to run custom build command for `openssl-sys v0.9.70`

Caused by:
  process didn't exit successfully: `D:\Projects\Solana\solana\target\debug\buil
d\openssl-sys-736d1d76570b18fa\build-script-main` (exit code: 101)
  --- stdout
  cargo:rustc-cfg=const_fn
  cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR
  X86_64_PC_WINDOWS_MSVC_OPENSSL_NO_VENDOR unset
  cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
  OPENSSL_NO_VENDOR unset
  running "perl" "./Configure" "--prefix=D:\\Projects\\Solana\\solana\\target\\d
ebug\\build\\openssl-sys-e7ad322dad563f82\\out\\openssl-build\\install" "no-dso"
 "no-shared" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdi
r=lib" "no-legacy" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-ide
a" "no-seed" "no-capieng" "no-asm" "VC-WIN64A"

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { c
ode: 2, kind: NotFound, message: "Не удается найти указанный файл." }', C:\Users
\Bojo\.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-src-300.0.2+3.0.0\
src\lib.rs:490:39
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed

You need to install OpenSSL. I think the easiest way to do that is to install vcpkg first.

First, to install vcpkg, create a directory C:\src, then open a terminal in that directory and run:

git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg\vcpkg install openssl:x64-windows

After that’s done, try running the Rust build again.