wasm-pack icon indicating copy to clipboard operation
wasm-pack copied to clipboard

cargo install wasm-pack: broken on Windows

Open sononix opened this issue 4 years ago • 1 comments

Im filing this under bug !! Duplicate of https://github.com/rustwasm/wasm-pack/issues/1026 https://github.com/rustwasm/wasm-pack/issues/1058

Problematic for windows users installing wasm-pack --- cargo install wasm-pack I wasnt aware of cargo install wasm-pack --no-default-features

Running windows 10, I have compliled openssl statically from its repo, the default for the executable is the apps folder

I have set an number of envoronmental variables to take this into account

looks to be missing openssl/opensslv.h

OPENSSL_DIR: C:...\OpenSSL\openssl\apps OPENSSL_INCLUDE_DIR: C:...\OpenSSL\openssl\apps\include OPENSSL_LIB_DIR: C:...\OpenSSL\openssl\apps\lib OPENSSL_NO_VENDOR: 1 OPENSSL_STATIC: 1

Is there a particular sets of flags in compliation that needs to be set? or is there a dependency issue at the moment

Updating crates.io index Installing wasm-pack v0.10.1 Compiling winapi-x86_64-pc-windows-gnu v0.4.0 Compiling winapi v0.3.9 Compiling autocfg v1.0.1 Compiling proc-macro2 v1.0.30 Compiling unicode-xid v0.2.2 Compiling syn v1.0.80 Compiling libc v0.2.104 Compiling serde_derive v1.0.130 Compiling serde v1.0.130 Compiling cfg-if v1.0.0 Compiling cc v1.0.71 Compiling cfg-if v0.1.10 Compiling semver-parser v0.7.0 Compiling lazy_static v1.4.0 Compiling pkg-config v0.3.21 Compiling winapi-build v0.1.1 Compiling maybe-uninit v2.0.0 Compiling version_check v0.9.3 Compiling futures v0.1.31 Compiling byteorder v1.4.3 Compiling memchr v2.4.1 Compiling log v0.4.14 Compiling rand_core v0.4.2 Compiling winapi v0.2.8 Compiling scopeguard v1.1.0 Compiling iovec v0.1.4 Compiling either v1.6.1 Compiling tinyvec_macros v0.1.0 Compiling autocfg v0.1.7 Compiling itoa v0.4.8 Compiling adler v1.0.2 Compiling matches v0.1.9 Compiling slab v0.4.5 Compiling fnv v1.0.7 Compiling unicode-bidi v0.3.7 Compiling gimli v0.25.0 Compiling rustc-demangle v0.1.21 Compiling failure_derive v0.1.8 Compiling unicode-width v0.1.9 Compiling ryu v1.0.5 Compiling crc32fast v1.2.1 Compiling regex-syntax v0.6.25 Compiling serde_json v1.0.68 Compiling hashbrown v0.11.2 Compiling percent-encoding v1.0.1 Compiling percent-encoding v2.1.0 Compiling httparse v1.5.1 Compiling try-lock v0.2.3 Compiling parking_lot_core v0.8.5 Compiling native-tls v0.2.8 Compiling stable_deref_trait v1.2.0 Compiling smallvec v1.7.0 Compiling unicode-segmentation v1.8.0 Compiling curl v0.4.39 Compiling once_cell v1.8.0 Compiling bitflags v1.3.2 Compiling encoding_rs v0.8.29 Compiling openssl v0.10.36 Compiling lazy_static v0.2.11 Compiling vec_map v0.8.2 Compiling encode_unicode v0.3.6 Compiling mime v0.3.16 Compiling foreign-types-shared v0.1.1 Compiling scopeguard v0.3.3 Compiling quick-error v1.2.3 Compiling strsim v0.8.0 Compiling dtoa v0.4.8 Compiling hex v0.3.2 Compiling siphasher v0.2.3 Compiling glob v0.2.11 Compiling instant v0.1.12 Compiling getrandom v0.2.3 Compiling try_from v0.3.2 Compiling tinyvec v1.5.0 Compiling lock_api v0.3.4 Compiling lock_api v0.4.5 Compiling rand_core v0.3.1 Compiling textwrap v0.11.0 Compiling owning_ref v0.4.1 Compiling bytes v0.4.12 Compiling base64 v0.10.1 Compiling form_urlencoded v1.0.1 Compiling foreign-types v0.3.2 Compiling humantime v1.3.0 Compiling uuid v0.8.2 Compiling rand_isaac v0.1.1 Compiling rand_hc v0.1.0 Compiling rand_xorshift v0.1.1 Compiling lock_api v0.1.5 Compiling heck v0.3.3 Compiling kernel32-sys v0.2.2 Compiling ws2_32-sys v0.2.1 Compiling openssl-src v111.16.0+1.1.1l Compiling http v0.1.21 Compiling string v0.2.1 Compiling unicode-normalization v0.1.19 Compiling tokio-sync v0.1.8 Compiling tokio-buf v0.1.1 Compiling crossbeam-utils v0.7.2 Compiling miniz_oxide v0.4.4 Compiling memoffset v0.5.6 Compiling crossbeam-epoch v0.8.2 Compiling indexmap v1.7.0 Compiling num-traits v0.2.14 Compiling num-integer v0.1.44 Compiling rand_pcg v0.1.2 Compiling rand_chacha v0.1.1 Compiling rand v0.6.5 Compiling unicase v2.6.0 Compiling proc-macro-error-attr v1.0.4 Compiling proc-macro-error v1.0.4 Compiling addr2line v0.16.0 Compiling smallvec v0.6.14 Compiling idna v0.1.5 Compiling idna v0.2.3 Compiling http-body v0.1.0 Compiling backtrace v0.3.62 Compiling libz-sys v1.1.3 Compiling curl-sys v0.4.49+curl-7.79.1 Compiling bzip2-sys v0.1.11+1.0.8 Compiling openssl-sys v0.9.67 Compiling num_cpus v1.13.0 Compiling tokio-io v0.1.13 Compiling want v0.2.0 Compiling object v0.27.1 Compiling aho-corasick v0.7.18 Compiling url v2.2.2 Compiling url v1.7.2 Compiling futures-cpupool v0.1.8 Compiling tokio-executor v0.1.10 Compiling crossbeam-queue v0.2.3 Compiling h2 v0.1.26 Compiling quote v1.0.10 Compiling tokio-timer v0.2.13 Compiling tokio-current-thread v0.1.7 Compiling flate2 v1.0.22 Compiling mime_guess v2.0.3 Compiling publicsuffix v1.5.6 Compiling crossbeam-deque v0.7.4 The following warnings were emitted during compilation:

warning: build/expando.c:1:10: fatal error: openssl/opensslv.h: No such file or directory warning: 1 | #include <openssl/opensslv.h> warning: | ^~~~~~~~~~~~~~~~~~~~ warning: compilation terminated.

error: failed to run custom build command for openssl-sys v0.9.67

Caused by: process didn't exit successfully: C:\....\Local\Temp\cargo-installymZAOI\release\build\openssl-sys-449ab54b9380865e\build-script-main (exit code: 101) --- stdout cargo:rustc-cfg=const_fn cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_NO_VENDOR X86_64_PC_WINDOWS_GNU_OPENSSL_NO_VENDOR unset cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR OPENSSL_NO_VENDOR = 1 cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_LIB_DIR X86_64_PC_WINDOWS_GNU_OPENSSL_LIB_DIR unset cargo:rerun-if-env-changed=OPENSSL_LIB_DIR OPENSSL_LIB_DIR = C:...\OpenSSL\openssl\apps\lib cargo:rerun-if-env-changed=X86_64_PC_WINDOWS_GNU_OPENSSL_INCLUDE_DIR X86_64_PC_WINDOWS_GNU_OPENSSL_INCLUDE_DIR unset cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR = C:...\OpenSSL\openssl\apps\include cargo:rustc-link-search=native=C:...\OpenSSL\openssl\apps\lib cargo:include=C:...\OpenSSL\openssl\apps\include OPT_LEVEL = Some("3") TARGET = Some("x86_64-pc-windows-gnu") HOST = Some("x86_64-pc-windows-gnu") CC_x86_64-pc-windows-gnu = None CC_x86_64_pc_windows_gnu = None HOST_CC = None CC = None CFLAGS_x86_64-pc-windows-gnu = None CFLAGS_x86_64_pc_windows_gnu = None HOST_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None DEBUG = Some("false") CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2") running: "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-I" "C:\...\OpenSSL\openssl\apps\include" "-Wall" "-Wextra" "-E" "build/expando.c" cargo:warning=build/expando.c:1:10: fatal error: openssl/opensslv.h: No such file or directory cargo:warning= 1 | #include <openssl/opensslv.h> cargo:warning= | ^~~~~~~~~~~~~~~~~~~~ cargo:warning=compilation terminated. exit code: 1

--- stderr thread 'main' panicked at ' Header expansion error: Error { kind: ToolExecError, message: "Command "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-I" "C:\\...\\OpenSSL\\openssl\\apps\\include" "-Wall" "-Wextra" "-E" "build/expando.c" with args "gcc.exe" did not execute successfully (status code exit code: 1)." }

Failed to find OpenSSL development headers.

You can try fixing this setting the OPENSSL_DIR environment variable pointing to your OpenSSL installation or installing OpenSSL headers package specific to your distribution:

  # On Ubuntu
  sudo apt-get install libssl-dev
  # On Arch Linux
  sudo pacman -S openssl
  # On Fedora
  sudo dnf install openssl-devel

See rust-openssl README for more information:

  https://github.com/sfackler/rust-openssl#linux

', C:....cargo\registry\src\github.com-1ecc6299db9ec823\openssl-sys-0.9.67\build/main.rs:147:13 stack backtrace: 0: rust_begin_unwind at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library\std\src/panicking.rs:517:5 1: std::panicking::begin_panic_fmt at /rustc/09c42c45858d5f3aedfa670698275303a3d19afa/library\std\src/panicking.rs:460:5 2: build_script_main::validate_headers 3: build_script_main::main 4: core::ops::function::FnOnce::call_once note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace. warning: build failed, waiting for other jobs to finish... error: failed to compile wasm-pack v0.10.1, intermediate artifacts can be found at C:\...\Local\Temp\cargo-installymZAOI

Caused by: build failed

sononix avatar Oct 23 '21 06:10 sononix

https://rustwasm.github.io/wasm-pack/installer/

yangdan8 avatar Jul 22 '22 09:07 yangdan8

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

drager avatar Jun 17 '23 13:06 drager