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
-syscrate cannot proceed without this knowledge. If OpenSSL is installed and this crate had trouble finding it, you can set theOPENSSL_DIRenvironment 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:
- remove gag from dependencies list in local-cluster/Cargo.toml
- 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:
solution:
- install CMAKE
- get llvm from github
cd llvm-project/llvmcmake .- open LLVM.sln in VisualStudio and change to release. build.
- copy release directory somewhere ie.
D:\LLVM - install llvm binary snapshop
- copy llvm-config to llvm bin dir
4. VALIDATOR
problem:
error[E0308]:
matcharms have incompatible types --> validator\src\lib.rs:61:13 | 38 | let logger_thread = match logfile { | -------------matcharms have incompatible types 39 | None => None, | ---- this is found to be of typestd::option::Option<_>... 61 | / { 62 | | println!("logging to a file is not supported on this platform"); 63 | | () 64 | | } | |_____________^ expected enumstd::option::Option, found()| = note: expected typestd::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 compilesolana-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
Bdeclared on the associated > functionmap| 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
Bdeclared on the associated > functionmap| 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