Solana build on Windows - mariomatic/solana GitHub Wiki

Solana Windows changes

GIT

Need to support symlinks. Clone with: git clone --config core.symlinks=true https://github.com/solana-labs/solana.git

BUILD ERRORS

1. OpenSSL

problem:

Build can not fond OpenSLL install dir ( module openssl-sys) :

Could not find directory of OpenSSL installation, and this -sys crate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set the OPENSSL_DIR environment variable for the compilation process.

solution:

Download openssl for windows and make a env variable:

$env:OPENSSL_DIR="D:\play\openssl-1.1\x64"

2. GAG

problem:

gag v0.1.10 is not windows compatible.

possible solutions:

  • try to fix gag and push changes
  • make cargo ignore gag

solution:

  1. remove gag from dependencies list in local-cluster/Cargo.toml
  2. set test test_optimistic_confirmation_violation_detection() on ignore

3. LIBROCKSDB

problem:

Librocksdb is dependening on LLVM

error: failed to run custom build command for librocksdb-sys v6.11.4

possible solutions:

  • install llvm. It seems that would not be enough becouse llvm-config doesn't come with windows build. We need to build llvm from source and include llvm-config so:
  • build llvm
  • something to watch out:

https://stackoverflow.com/questions/34674753/why-doesnt-llvm-config-on-windows-emit-the-correct-parameters-for-clang-exe

solution:

  1. install CMAKE

https://cmake.org/download/

  1. get llvm from github
  2. cd llvm-project/llvm
  3. cmake .
  4. open LLVM.sln in VisualStudio and change to release. build.
  5. copy release directory somewhere ie. D:\LLVM
  6. install llvm binary snapshop
  7. copy llvm-config to llvm bin dir

4. VALIDATOR

problem:

error[E0308]: match arms have incompatible types --> validator\src\lib.rs:61:13 | 38 | let logger_thread = match logfile { | ------------- match arms have incompatible types 39 | None => None, | ---- this is found to be of type std::option::Option<_> ... 61 | / { 62 | | println!("logging to a file is not supported on this platform"); 63 | | () 64 | | } | |_____________^ expected enum std::option::Option, found () | = note: expected type std::option::Option<_> found unit type ()

error: aborting due to previous error; 1 warning emitted

For more information about this error, try rustc --explain E0308. error: could not compile solana-validator

solution:

change return () to None

5. BANKING-BENCH

problem:

error[E0282]: type annotations needed --> banking-bench\src\main.rs:81:40 | 81 | let sig: Vec = (0..64).map(|| thread_rng().gen()).collect(); | ^^^ cannot infer type for type parameter B declared on the associated > function map | help: consider specifying the type argument in the method call | 81 | let sig: Vec = (0..64).map(|| thread_rng().gen::()).collect(); | ^^^^^

error[E0282]: type annotations needed --> banking-bench\src\main.rs:192:36 | 192 | let sig: Vec = (0..64).map(|| thread_rng().gen()).collect(); | ^^^ cannot infer type for type parameter B declared on the associated > function map | help: consider specifying the type argument in the method call | 192 | let sig: Vec = (0..64).map(|| thread_rng().gen::()).collect(); | ^^^^^

solution:

add parameter type :

thread_rng().gen::<u8>()

DONE!

.\run.sh