wasm-pack
wasm-pack copied to clipboard
Can't build wasm-pack v0.10.0 in Docker.
🐛 Bug description
This issue maybe is not related to wasm-pack itself, but I have no clue where to look for, or how to fix it, that's why I'm posting it here. Maybe You will be able to help me out.
Just like in the topic, I wasn't able to install wasm-pack in the docker environment.
🤔 Expected Behavior
There should be no problem with installation of wasm-pack
👟 Steps to reproduce
My Dockerfile looks like this:
FROM rust:1.52-slim
RUN apt-get update && apt-get install pkg-config=0.29-6 libssl-dev -y
RUN rustup target add wasm32-unknown-unknown
RUN cargo install wasm-pack
Error message is:
...
#7 87.39 Compiling futures-cpupool v0.1.8
#7 87.96 Compiling mio v0.6.23
#7 88.37 Compiling idna v0.1.5
#7 90.19 error: failed to run custom build command for `openssl-sys v0.9.65`
#7 90.19
#7 90.19 Caused by:
#7 90.19 process didn't exit successfully: `/tmp/cargo-installflNsBL/release/build/openssl-sys-9662d42ed84354b4/build-script-main` (exit code: 101)
#7 90.19 --- stdout
#7 90.19 cargo:rustc-cfg=const_fn
#7 90.19 cargo:rerun-if-env-changed=X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR
#7 90.19 X86_64_UNKNOWN_LINUX_GNU_OPENSSL_NO_VENDOR unset
#7 90.19 cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
#7 90.19 OPENSSL_NO_VENDOR unset
#7 90.19 CC_x86_64-unknown-linux-gnu = None
#7 90.19 CC_x86_64_unknown_linux_gnu = None
#7 90.19 HOST_CC = None
#7 90.19 CC = None
#7 90.19 CFLAGS_x86_64-unknown-linux-gnu = None
#7 90.19 CFLAGS_x86_64_unknown_linux_gnu = None
#7 90.19 HOST_CFLAGS = None
#7 90.19 CFLAGS = None
#7 90.19 CRATE_CC_NO_DEFAULTS = None
#7 90.19 DEBUG = Some("false")
#7 90.19 CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
#7 90.19 running "perl" "./Configure" "--prefix=/tmp/cargo-installflNsBL/release/build/openssl-sys-c605ca3ea0bfbe0a/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" "linux-x86_64" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64"
#7 90.19 Configuring OpenSSL version 1.1.1k (0x101010bfL) for linux-x86_64
#7 90.19 Using os-specific seed configuration
#7 90.19 Creating configdata.pm
#7 90.19 Creating Makefile
#7 90.19
#7 90.19 **********************************************************************
#7 90.19 *** ***
#7 90.19 *** OpenSSL has been successfully configured ***
#7 90.19 *** ***
#7 90.19 *** If you encounter a problem while building, please open an ***
#7 90.19 *** issue on GitHub <https://github.com/openssl/openssl/issues> ***
#7 90.19 *** and include the output from the following command: ***
#7 90.19 *** ***
#7 90.19 *** perl configdata.pm --dump ***
#7 90.19 *** ***
#7 90.19 *** (If you are new to OpenSSL, you might want to consult the ***
#7 90.19 *** 'Troubleshooting' section in the INSTALL file first) ***
#7 90.20 *** ***
#7 90.20 **********************************************************************
#7 90.20 running "make" "depend"
#7 90.20
#7 90.20 --- stderr
#7 90.20 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/openssl-src-111.15.0+1.1.1k/src/lib.rs:469:39
#7 90.20 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
#7 90.20 warning: build failed, waiting for other jobs to finish...
#7 96.94 error: failed to compile `wasm-pack v0.10.0`, intermediate artifacts can be found at `/tmp/cargo-installflNsBL`
#7 96.94
#7 96.94 Caused by:
#7 96.94 build failed
I was able to solve that by installing a specific version of wasm-pack
Dockerfile:
FROM rust:1.52-slim
RUN apt-get update && apt-get install pkg-config=0.29-6 libssl-dev -y
RUN rustup target add wasm32-unknown-unknown
RUN cargo install wasm-pack --vers 0.9.1
🌍 Your environment
Include the relevant details of your environment. docker image: rust:1.52-slim
Not sure if it is relevant but switching from slim to rust:1.57-buster got me past an issue compiling openssl-sys in docker.
i'm running into this same issue now. It does seem to be right in that pkg-config is missing. The question is why and how to fix it.
@EthanZeigler, not sure if it helps but here is a Dockerfile that works for me, after the openssl issue I also needed to install clang for some dependencies, you may be able to skip that part:
https://github.com/LavaMoat/ecdsa-wasm/blob/main/Dockerfile
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
Please try out v0.12.0 from one of the following ways:
- https://github.com/rustwasm/wasm-pack/releases/tag/v0.12.0
- https://crates.io/crates/wasm-pack/0.12.0
- https://www.npmjs.com/package/wasm-pack/v/0.12.0