IMI-eRnD-Be / wasm-run

Bundles and tooling for Rust WASM frontend application
MIT License
35 stars 3 forks source link

Problem with building. "failed to run custom build command for `binaryen-sys v0.12.0`" #12

Closed szagi3891 closed 3 years ago

szagi3891 commented 3 years ago

First, a fantastic idea for a tool to build "wasm" projects :) I keep my fingers crossed for this project :)

I wanted to use this tool to build my project in which I experiment with rust and wasm. Unfortunately, I get a compilation error:

MacBook-Pro-Grzegorz:app grzegorzszeliga$ cargo run -- build
    Finished dev [unoptimized + debuginfo] target(s) in 0.66s
     Running `/Users/grzegorzszeliga/Desktop/Projekty/rust-reactive/target/debug/app_rust build`
   Compiling proc-macro2 v1.0.24
   Compiling syn v1.0.54
   Compiling version_check v0.9.2
   Compiling serde_derive v1.0.118
   Compiling serde v1.0.118
   Compiling log v0.4.11
   Compiling serde_json v1.0.60
   Compiling typenum v1.12.0
   Compiling itoa v0.4.6
   Compiling autocfg v1.0.1
   Compiling memchr v2.3.4
   Compiling anyhow v1.0.36
   Compiling subtle v2.4.0
   Compiling unicode-segmentation v1.7.1
   Compiling proc-macro-hack v0.5.19
   Compiling getrandom v0.1.15
   Compiling futures-core v0.3.8
   Compiling leb128 v0.2.4
   Compiling libc v0.2.77
   Compiling futures-sink v0.3.8
   Compiling futures-io v0.3.8
   Compiling semver-parser v0.7.0
   Compiling lazy_static v1.4.0
   Compiling once_cell v1.5.2
   Compiling event-listener v2.5.1
   Compiling ppv-lite86 v0.2.10
   Compiling ucd-trie v0.1.3
   Compiling opaque-debug v0.3.0
   Compiling percent-encoding v2.1.0
   Compiling pin-utils v0.1.0
   Compiling maplit v1.0.2
   Compiling slab v0.4.2
   Compiling stdweb-internal-runtime v0.1.5
   Compiling matches v0.1.8
   Compiling cc v1.0.66
   Compiling sha1 v0.6.0
   Compiling wasmparser v0.59.0
   Compiling cache-padded v1.1.1
   Compiling base-x v0.2.8
   Compiling const_fn v0.4.4
   Compiling tinyvec_macros v0.1.0
   Compiling id-arena v2.2.1
   Compiling discard v1.0.4
   Compiling pin-project-lite v0.2.0
   Compiling base64 v0.12.3
   Compiling byteorder v1.3.4
   Compiling maybe-uninit v2.0.0
   Compiling http-types v2.9.0
   Compiling proc-macro-nested v0.1.6
   Compiling data-encoding v2.3.1
   Compiling waker-fn v1.1.0
   Compiling wit-schema-version v0.1.0
   Compiling parking v2.0.0
   Compiling regex-syntax v0.6.21
   Compiling bitflags v1.2.1
   Compiling base64 v0.13.0
   Compiling infer v0.2.3
   Compiling pin-project-lite v0.1.11
   Compiling httparse v1.3.4
   Compiling arrayref v0.3.6
   Compiling constant_time_eq v0.1.5
   Compiling arrayvec v0.5.2
   Compiling stable_deref_trait v1.2.0
   Compiling unicode-width v0.1.8
   Compiling safemem v0.3.3
   Compiling same-file v1.0.6
   Compiling remove_dir_all v0.5.3
   Compiling atty v0.2.14
   Compiling vec_map v0.8.2
   Compiling strsim v0.8.0
   Compiling ansi_term v0.11.0
   Compiling route-recognizer v0.2.0
   Compiling rustc-demangle v0.1.18
   Compiling downcast-rs v1.2.0
   Compiling ryu v1.0.5
   Compiling thread_local v1.0.1
   Compiling wasm-bindgen-shared v0.2.69
   Compiling instant v0.1.9
   Compiling filetime v0.2.13
   Compiling generic-array v0.14.4
   Compiling standback v0.2.13
   Compiling time v0.2.23
   Compiling cookie v0.14.3
   Compiling proc-macro-error-attr v1.0.4
   Compiling proc-macro-error v1.0.4
   Compiling wast v21.0.0
   Compiling futures-channel v0.3.8
   Compiling crossbeam-utils v0.8.1
   Compiling num-traits v0.2.14
   Compiling crossbeam-utils v0.7.2
   Compiling num-integer v0.1.44
   Compiling futures-task v0.3.8
   Compiling heck v0.3.1
   Compiling semver v0.9.0
   Compiling async-mutex v1.4.0
   Compiling simple-mutex v1.1.5
   Compiling pest v2.1.3
   Compiling form_urlencoded v1.0.0
   Compiling unicode-bidi v0.3.4
   Compiling concurrent-queue v1.2.2
   Compiling tinyvec v1.1.0
   Compiling cmake v0.1.45
   Compiling wit-writer v0.2.0
   Compiling blake3 v0.3.7
   Compiling textwrap v0.11.0
   Compiling walkdir v2.3.1
   Compiling fastrand v1.4.0
   Compiling async-dup v1.2.2
   Compiling rustc_version v0.2.3
   Compiling async-channel v1.5.1
   Compiling pest_meta v2.1.3
   Compiling unicode-normalization v0.1.16
   Compiling kv-log-macro v1.0.7
   Compiling virtualdom v0.1.0 (/Users/grzegorzszeliga/Desktop/Projekty/rust-reactive/crates/virtualdom)
   Compiling futures-lite v1.11.3
   Compiling quote v1.0.7
   Compiling rand_core v0.5.1
   Compiling aho-corasick v0.7.15
   Compiling wit-parser v0.2.0
   Compiling wit-text v0.8.0
   Compiling num_cpus v1.13.0
   Compiling time v0.1.44
   Compiling stdweb v0.4.20
   Compiling clap v2.33.3
   Compiling notify v4.0.15
   Compiling base64 v0.9.3
   Compiling rand_chacha v0.2.2
   Compiling idna v0.2.0
   Compiling wit-validator v0.2.1
   Compiling regex v1.4.2
   Compiling digest v0.9.0
   Compiling cipher v0.2.5
   Compiling universal-hash v0.4.0
   Compiling crypto-mac v0.10.0
   Compiling block-buffer v0.9.0
   Compiling aead v0.3.2
   Compiling crypto-mac v0.8.0
   Compiling crossbeam-queue v0.2.3
   Compiling rand v0.7.3
   Compiling aes-soft v0.6.4
   Compiling ctr v0.6.0
   Compiling polyval v0.4.3
   Compiling hmac v0.10.1
   Compiling sha2 v0.9.2
   Compiling hmac v0.8.1
   Compiling byte-pool v0.2.2
   Compiling aes v0.6.0
   Compiling ghash v0.3.0
   Compiling hkdf v0.10.0
   Compiling tempfile v3.1.0
   Compiling aes-gcm v0.8.0
   Compiling binaryen-sys v0.12.0
error: failed to run custom build command for `binaryen-sys v0.12.0`

Caused by:
  process didn't exit successfully: `/Users/grzegorzszeliga/Desktop/Projekty/rust-reactive/target/release/build/binaryen-sys-ba2d091eee38a5df/build-script-build` (exit code: 101)
  --- stdout
  running: "cmake" "/Users/grzegorzszeliga/.cargo/registry/src/github.com-1ecc6299db9ec823/binaryen-sys-0.12.0/binaryen" "-DBUILD_STATIC_LIB=ON" "-DENABLE_WERROR=OFF" "-DCMAKE_INSTALL_PREFIX=/Users/grzegorzszeliga/Desktop/Projekty/rust-reactive/target/wasm32-unknown-unknown/release/build/binaryen-sys-0721a94ee49cb433/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown" "-DCMAKE_C_COMPILER=/usr/bin/clang" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown" "-DCMAKE_CXX_COMPILER=/usr/bin/clang" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown" "-DCMAKE_ASM_COMPILER=/usr/bin/clang" "-DCMAKE_BUILD_TYPE=MinSizeRel"
  -- The C compiler identification is AppleClang 12.0.0.12000032
  -- The CXX compiler identification is AppleClang 12.0.0.12000032
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - failed
  -- Check for working C compiler: /usr/bin/clang
  -- Check for working C compiler: /usr/bin/clang - broken
  -- Configuring incomplete, errors occurred!
  See also "/Users/grzegorzszeliga/Desktop/Projekty/rust-reactive/target/wasm32-unknown-unknown/release/build/binaryen-sys-0721a94ee49cb433/out/build/CMakeFiles/CMakeOutput.log".
  See also "/Users/grzegorzszeliga/Desktop/Projekty/rust-reactive/target/wasm32-unknown-unknown/release/build/binaryen-sys-0721a94ee49cb433/out/build/CMakeFiles/CMakeError.log".

  --- stderr
  fatal: not a git repository (or any of the parent directories): .git
  CMake Error at /usr/local/Cellar/cmake/3.19.1/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message):
    The C compiler

      "/usr/bin/clang"

    is not able to compile a simple test program.

    It fails with the following output:

      Change Dir: /Users/grzegorzszeliga/Desktop/Projekty/rust-reactive/target/wasm32-unknown-unknown/release/build/binaryen-sys-0721a94ee49cb433/out/build/CMakeFiles/CMakeTmp

      Run Build Command(s):/usr/bin/make cmTC_6ed98/fast && /Applications/Xcode.app/Contents/Developer/usr/bin/make  -f CMakeFiles/cmTC_6ed98.dir/build.make CMakeFiles/cmTC_6ed98.dir/build
      Building C object CMakeFiles/cmTC_6ed98.dir/testCCompiler.c.o
      /usr/bin/clang   -ffunction-sections -fdata-sections -fPIC --target=wasm32-unknown-unknown  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -mmacosx-version-min=10.15 -o CMakeFiles/cmTC_6ed98.dir/testCCompiler.c.o -c /Users/grzegorzszeliga/Desktop/Projekty/rust-reactive/target/wasm32-unknown-unknown/release/build/binaryen-sys-0721a94ee49cb433/out/build/CMakeFiles/CMakeTmp/testCCompiler.c
      clang: warning: argument unused during compilation: '-mmacosx-version-min=10.15' [-Wunused-command-line-argument]
      error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
      1 error generated.
      make[1]: *** [CMakeFiles/cmTC_6ed98.dir/testCCompiler.c.o] Error 1
      make: *** [cmTC_6ed98/fast] Error 2

    CMake will not be able to correctly generate this project.
  Call Stack (most recent call first):
    CMakeLists.txt:2 (project)

  thread 'main' panicked at '
  command did not execute successfully, got: exit code: 1

  build script failed, must exit now', /Users/grzegorzszeliga/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.45/src/lib.rs:894:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
Error: build process exit with code 101
MacBook-Pro-Grzegorz:app grzegorzszeliga$

Can I ask for help ?

cecton commented 3 years ago

Hey 👋 Thanks a LOT! ❤️ There will be new features soon as I have some days off to take care of this.

Looking at your issue I think it might be trying to compile binaryen (a C++ library) to wasm which is not intended for. There is probably something wrong with the dependencies. May I see your Cargo.toml? There should be a cfg in front of the wasm dependencies and another in front of the wasm-run (binary running on your system). I will try to clear that out in the doc.

cecton commented 3 years ago

It should look like this you see:

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "^0.2"
// your wasm web app dependencies go here

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
wasm-run = "0.5"
structopt = "0.3"
// your binary dependencies go here (or "build" dependencies
szagi3891 commented 3 years ago

Indeed, it was a problem with dependencies.

My experimental repository: https://github.com/szagi3891/rust-reactive

It works. I could finally get rid of the rollup. Tomorrow I'll experiment harder with "wasm-run".

Thank you very much :)