When i run cargo install wasm-pack
on windows 10 64-bit i get this error:
error: failed to run custom build command for `openssl-sys v0.9.65`
Caused by:
process didn't exit successfully: `C:\Users\vilgo\AppData\Local\Temp\cargo-install2J8ZNz\release\build\openssl-sys-932395a164949059\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
openssl-src: Enable the assembly language routines in building OpenSSL.
running "perl" "./Configure" "--prefix=C:\\Users\\vilgo\\AppData\\Local\\Temp\\cargo-install2J8ZNz\\release\\build\\openssl-sys-a51d272dcebf1fc5\\out\\openssl-build\\install" "no-dso" "no-shared" "no-ssl3" "no-unit-test" "no-comp" "no-zlib" "no-zlib-dynamic" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-engine" "VC-WIN64A"
--- stderr
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "Det går inte att hitta filen." }', C:\Users\vilgo\.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-src-111.15.0+1.1.1k\src\lib.rs:469:39
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: failed to compile `wasm-pack v0.10.0`, intermediate artifacts can be found at `C:\Users\vilgo\AppData\Local\Temp\cargo-install2J8ZNz`
Caused by:
build failed
How can i fix it? I ran it in regular cmd.
I think your problem happened because all three of these things happened:
\
as a directory separator, which causes the OpenSSL build to fail.Any one of these three solutions should solve your problem:
Make sure your default Perl installation is a "native" Windows Perl like Strawberry Perl. Make sure your build environment does not default to the msys perl. Then, retry compiling both wasm-pack and OpenSSL from source.
You can build wasm-pack from source, but instruct the Rust OpenSSL bindings to look for a precompiled OpenSSL.
If you don't have it already, download and install vcpkg, which we'll use to install OpenSSL:
git clone https://github.com/Microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
Then use vcpkg to install OpenSSL:
vcpkg install openssl:x64-windows-static-md
(If this does not work, try vcpkg install openssl:x64-windows
.)
And then try compiling wasm-pack. Set VCPKG_ROOT
to tell the Rust OpenSSL build script where to look, and also set OPENSSL_NO_VENDOR=1
to discourage the build script from compiling OpenSSL from source.
set VCPKG_ROOT=c:\path\to\vcpkg\installation
set OPENSSL_NO_VENDOR=1
cargo install wasm-pack
If you do not want to compile either wasm-pack or OpenSSL, you can use the Windows installer (wasm-pack-init.exe) on the rustwasm downloads page. Alternatively, you could also run your wasm-pack builds in Windows Subsystem for Linux (WSL).
Make sure you have the development packages of Open SSL installed.
For example, libssl-dev
on Ubuntu or openssl-devel
on Fedora. If OpenSSL is already installed and the crate still had trouble finding it, you can set the OPENSSL_DIR
environment variable to specify the path for your Open SSL installation. If you are using windows you can use the Win32/Win64 OpenSSL Installation Project to provide a simple installation of OpenSSL on windows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With