Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WASM support #92

Open
REASY opened this issue Mar 13, 2023 · 4 comments
Open

WASM support #92

REASY opened this issue Mar 13, 2023 · 4 comments

Comments

@REASY
Copy link

REASY commented Mar 13, 2023

Project: Add wasm32-unknown-unknown support (WASM) #93 is a candidate to bring WASM support

@turboladen
Copy link

turboladen commented Mar 21, 2023

FWIW, I came across this while using wasm-pack to build a lib that depends on surrealdb (which depends on rocksdb -> librocksdb-sys -> bzip2-sys) and get:

❯ wasm-pack build
[INFO]: 🎯  Checking for the Wasm target...
[INFO]: 🌀  Compiling to Wasm...
   Compiling zstd-sys v2.0.7+zstd.1.5.4
   Compiling bzip2-sys v0.1.11+1.0.8
   Compiling libz-sys v1.1.8
   Compiling rquickjs-sys v0.1.7
   Compiling url v2.3.1
   Compiling num-integer v0.1.45
   Compiling serde_urlencoded v0.7.1
   Compiling serde_qs v0.8.5
   Compiling unicase v2.6.0
   Compiling nanorand v0.7.0
   Compiling web-sys v0.3.61
   Compiling bitmaps v2.1.0
   Compiling num-bigint v0.4.3
   Compiling tokio v1.26.0
   Compiling infer v0.2.3
   Compiling relative-path v1.8.0
   Compiling ieee754 v0.2.6
   Compiling async-task v4.3.0
   Compiling smallvec v1.10.0
   Compiling accurate v0.3.1
   Compiling rstar v0.9.3
   Compiling rquickjs-core v0.1.7
   Compiling http-types v2.12.0
   Compiling sized-chunks v0.6.5
   Compiling flume v0.10.14
   Compiling proc-macro-error v1.0.4
   Compiling futures v0.3.27
   Compiling darling v0.14.4
   Compiling mime_guess v2.0.4
   Compiling async-trait v0.1.67
   Compiling proc-macro-crate v1.3.1
   Compiling paste v1.0.12
   Compiling sha2 v0.10.6
   Compiling hmac v0.12.1
   Compiling rand_xoshiro v0.6.0
   Compiling approx v0.5.1
   Compiling aho-corasick v0.7.20
   Compiling lazy_static v1.4.0
   Compiling mime v0.3.17
   Compiling regex-syntax v0.6.28
   Compiling semver v1.0.17
   Compiling rquickjs-macro v0.1.7
   Compiling http-client v6.5.3
   Compiling rmp v0.8.11
   Compiling geographiclib-rs v0.2.3
   Compiling imbl v1.0.1
   Compiling geo-types v0.7.9
   Compiling pbkdf2 v0.11.0
   Compiling blowfish v0.9.1
   Compiling salsa20 v0.10.2
   Compiling regex v1.7.1
   Compiling thread_local v1.1.7
   Compiling time v0.1.45
   Compiling blake2 v0.10.6
   Compiling float_next_after v0.1.5
   Compiling encoding_rs v0.8.32
   Compiling minimal-lexical v0.2.1
   Compiling robust v0.2.3
   Compiling arc-swap v1.6.0
   Compiling any_ascii v0.1.7
   Compiling urlencoding v2.1.2
   Compiling zeroize v1.5.7
   Compiling psl-types v2.0.11
   Compiling lexical-sort v0.3.1
   Compiling addr v0.15.6
   Compiling bcrypt v0.13.0
error: failed to run custom build command for `rquickjs-sys v0.1.7`

Caused by:
  process didn't exit successfully: `/Users/steve.loveless/Development/agrian/snick-basic/js/target/release/build/rquickjs-sys-b04ed66db74b26c3/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-env-changed=CARGO_FEATURE_EXPORTS
  cargo:rerun-if-env-changed=CARGO_FEATURE_BINDGEN
  cargo:rerun-if-env-changed=CARGO_FEATURE_UPDATE_BINDINGS
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_BYTECODE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_GC
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_GC_FREE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_FREE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_LEAKS
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_MEM
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_OBJECTS
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_ATOMS
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_SHAPES
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_MODULE_RESOLVE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_PROMISE
  cargo:rerun-if-env-changed=CARGO_FEATURE_DUMP_READ_OBJECT
  Appliyng patch patches/check_stack_overflow.patch
  patching file quickjs.c
  Appliyng patch patches/infinity_handling.patch
  patching file quickjs.c
  Hunk #1 succeeded at 10235 (offset 44 lines).
  Hunk #2 succeeded at 41732 (offset 168 lines).
  Hunk #3 succeeded at 47839 (offset 168 lines).
  Appliyng patch patches/atomic_new_class_id.patch
  patching file quickjs.c
  Hunk #1 succeeded at 3371 (offset 18 lines).
  Appliyng patch patches/read_module_exports.patch
  patching file quickjs.c
  Hunk #1 succeeded at 27254 (offset 93 lines).
  patching file quickjs.h
  Hunk #1 succeeded at 1039 (offset 4 lines).

  --- stderr
  Apple clang version 14.0.0 (clang-1400.0.29.202)
  Target: wasm32-unknown-unknown
  Thread model: posix
  InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
  ignoring nonexistent directory "/include"
  ignoring duplicate directory "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include"
  #include "..." search starts here:
  #include <...> search starts here:
   /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/14.0.0/include
  End of search list.
  /Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/rquickjs-sys-8777175c0d3bc38f/out/quickjs.h:28:10: fatal error: 'stdio.h' file not found
  thread 'main' panicked at 'Unable to generate bindings: ClangDiagnostic("/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/rquickjs-sys-8777175c0d3bc38f/out/quickjs.h:28:10: fatal error: 'stdio.h' file not found\n")', /Users/steve.loveless/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/rquickjs-sys-0.1.7/build.rs:213:10
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: 1 error generated.
warning: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: 1 error generated.
warning: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: 1 error generated.

error: failed to run custom build command for `zstd-sys v2.0.7+zstd.1.5.4`

Caused by:
  process didn't exit successfully: `/Users/steve.loveless/Development/agrian/snick-basic/js/target/release/build/zstd-sys-77fd76e040993580/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=ZSTD_SYS_USE_PKG_CONFIG
  cargo:rustc-cfg=feature="std"
  cargo:rerun-if-changed=wasm-shim/stdlib.h
  cargo:rerun-if-changed=wasm-shim/string.h
  TARGET = Some("wasm32-unknown-unknown")
  OPT_LEVEL = Some("s")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
  CC_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
  CC_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
  CFLAGS_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
  CFLAGS_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
  CC_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
  CC_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
  CFLAGS_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
  CFLAGS_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
  CC_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
  CC_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
  CFLAGS_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
  CFLAGS_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
  CC_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
  CC_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
  CFLAGS_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
  CFLAGS_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "wasm-shim/" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-DXXH_STATIC_ASSERT=0" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/zstd-sys-a046e03986993f47/out/zstd/lib/common/debug.o" "-c" "zstd/lib/common/debug.c"
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "wasm-shim/" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-DXXH_STATIC_ASSERT=0" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/zstd-sys-a046e03986993f47/out/zstd/lib/common/entropy_common.o" "-c" "zstd/lib/common/entropy_common.c"
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  exit status: 1
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  exit status: 1
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "wasm-shim/" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-DXXH_STATIC_ASSERT=0" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/zstd-sys-a046e03986993f47/out/zstd/lib/common/error_private.o" "-c" "zstd/lib/common/error_private.c"
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  exit status: 1

  --- stderr


  error occurred: Command "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "wasm-shim/" "-I" "zstd/lib/" "-I" "zstd/lib/common" "-I" "zstd/lib/legacy" "-fvisibility=hidden" "-DXXH_STATIC_ASSERT=0" "-DZSTD_LIB_DEPRECATED=0" "-DXXH_PRIVATE_API=" "-DZSTDLIB_VISIBILITY=" "-DZDICTLIB_VISIBILITY=" "-DZSTDERRORLIB_VISIBILITY=" "-DZSTD_LEGACY_SUPPORT=1" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/zstd-sys-a046e03986993f47/out/zstd/lib/common/debug.o" "-c" "zstd/lib/common/debug.c" with args "clang" did not execute successfully (status code exit status: 1).


The following warnings were emitted during compilation:

warning: In file included from bzip2-1.0.8/blocksort.c:22:
warning: bzip2-1.0.8/bzlib_private.h:25:10: fatal error: 'stdlib.h' file not found
warning: #include <stdlib.h>
warning:          ^~~~~~~~~~
warning: 1 error generated.
warning: In file included from bzip2-1.0.8/huffman.c:22:
warning: bzip2-1.0.8/bzlib_private.h:25:10: fatal error: 'stdlib.h' file not found
warning: #include <stdlib.h>
warning:          ^~~~~~~~~~
warning: 1 error generated.

error: failed to run custom build command for `bzip2-sys v0.1.11+1.0.8`

Caused by:
  process didn't exit successfully: `/Users/steve.loveless/Development/agrian/snick-basic/js/target/release/build/bzip2-sys-741c3c598b5ac79e/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("wasm32-unknown-unknown")
  OPT_LEVEL = Some("s")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
  CC_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
  CC_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
  CFLAGS_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
  CFLAGS_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "bzip2-1.0.8" "-D_FILE_OFFSET_BITS=64" "-DBZ_NO_STDIO" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/bzip2-sys-004704ebc0319d3c/out/lib/bzip2-1.0.8/blocksort.o" "-c" "bzip2-1.0.8/blocksort.c"
  cargo:warning=In file included from bzip2-1.0.8/blocksort.c:22:
  cargo:warning=bzip2-1.0.8/bzlib_private.h:25:10: fatal error: 'stdlib.h' file not found
  cargo:warning=#include <stdlib.h>
  cargo:warning=         ^~~~~~~~~~
  cargo:warning=1 error generated.
  exit status: 1
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "bzip2-1.0.8" "-D_FILE_OFFSET_BITS=64" "-DBZ_NO_STDIO" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/bzip2-sys-004704ebc0319d3c/out/lib/bzip2-1.0.8/huffman.o" "-c" "bzip2-1.0.8/huffman.c"
  cargo:warning=In file included from bzip2-1.0.8/huffman.c:22:
  cargo:warning=bzip2-1.0.8/bzlib_private.h:25:10: fatal error: 'stdlib.h' file not found
  cargo:warning=#include <stdlib.h>
  cargo:warning=         ^~~~~~~~~~
  cargo:warning=1 error generated.
  exit status: 1

  --- stderr


  error occurred: Command "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "bzip2-1.0.8" "-D_FILE_OFFSET_BITS=64" "-DBZ_NO_STDIO" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/bzip2-sys-004704ebc0319d3c/out/lib/bzip2-1.0.8/blocksort.o" "-c" "bzip2-1.0.8/blocksort.c" with args "clang" did not execute successfully (status code exit status: 1).


The following warnings were emitted during compilation:

warning: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: 1 error generated.
warning: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: 1 error generated.
warning: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: 1 error generated.
warning: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: 1 error generated.
warning: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: 1 error generated.
warning: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: 1 error generated.

error: failed to run custom build command for `libz-sys v1.1.8`

Caused by:
  process didn't exit successfully: `/Users/steve.loveless/Development/agrian/snick-basic/js/target/release/build/libz-sys-68f9f4e637123275/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=LIBZ_SYS_STATIC
  cargo:rerun-if-changed=build.rs
  TARGET = Some("wasm32-unknown-unknown")
  OPT_LEVEL = Some("s")
  HOST = Some("aarch64-apple-darwin")
  cargo:rerun-if-env-changed=CC_wasm32-unknown-unknown
  CC_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CC_wasm32_unknown_unknown
  CC_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32-unknown-unknown
  CFLAGS_wasm32-unknown-unknown = None
  cargo:rerun-if-env-changed=CFLAGS_wasm32_unknown_unknown
  CFLAGS_wasm32_unknown_unknown = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "src/zlib" "-fvisibility=hidden" "-DZ_SOLO" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/libz-sys-568df974f67767e6/out/lib/src/zlib/adler32.o" "-c" "src/zlib/adler32.c"
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "src/zlib" "-fvisibility=hidden" "-DZ_SOLO" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/libz-sys-568df974f67767e6/out/lib/src/zlib/compress.o" "-c" "src/zlib/compress.c"
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "src/zlib" "-fvisibility=hidden" "-DZ_SOLO" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/libz-sys-568df974f67767e6/out/lib/src/zlib/crc32.o" "-c" "src/zlib/crc32.c"
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "src/zlib" "-fvisibility=hidden" "-DZ_SOLO" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/libz-sys-568df974f67767e6/out/lib/src/zlib/deflate.o" "-c" "src/zlib/deflate.c"
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "src/zlib" "-fvisibility=hidden" "-DZ_SOLO" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/libz-sys-568df974f67767e6/out/lib/src/zlib/infback.o" "-c" "src/zlib/infback.c"
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  exit status: 1
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  running: "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "src/zlib" "-fvisibility=hidden" "-DZ_SOLO" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/libz-sys-568df974f67767e6/out/lib/src/zlib/inffast.o" "-c" "src/zlib/inffast.c"
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  exit status: 1
  exit status: 1
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  exit status: 1
  exit status: 1
  cargo:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
  cargo:warning=1 error generated.
  exit status: 1

  --- stderr


  error occurred: Command "clang" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=wasm32-unknown-unknown" "-I" "src/zlib" "-fvisibility=hidden" "-DZ_SOLO" "-DSTDC" "-D_LARGEFILE64_SOURCE" "-D_POSIX_SOURCE" "-o" "/Users/steve.loveless/Development/agrian/snick-basic/js/target/wasm32-unknown-unknown/release/build/libz-sys-568df974f67767e6/out/lib/src/zlib/adler32.o" "-c" "src/zlib/adler32.c" with args "clang" did not execute successfully (status code exit status: 1).


Error: Compiling your crate to WebAssembly failed
Caused by: Compiling your crate to WebAssembly failed
Caused by: failed to execute `cargo build`: exited with exit status: 101
  full command: cd "/Users/steve.loveless/Development/agrian/snick-basic/js" && "cargo" "build" "--lib" "--release" "--target" "wasm32-unknown-unknown"

Env info:

❯ clang --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
❯ cargo --version
cargo 1.68.0 (115f34552 2023-02-26)
❯ brew info bzip2
==> bzip2: stable 1.0.8 (bottled) [keg-only]
Freely available high-quality data compressor
https://sourceware.org/bzip2/
/opt/homebrew/Cellar/bzip2/1.0.8 (26 files, 516.1KB)
  Poured from bottle on 2022-12-07 at 16:22:21
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/bzip2.rb
License: bzip2-1.0.6
==> Caveats
bzip2 is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have bzip2 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/bzip2/bin:$PATH"' >> ~/.zshrc

For compilers to find bzip2 you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/bzip2/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/bzip2/include"

@turboladen
Copy link

turboladen commented Mar 21, 2023

Looks like the content of #79 is quite similar... I'm not using wasi though--just wasm-pack. ...although if I just run cargo build --target wasm32-unknown-unknown, I get the same build failures (it's just a vanilla project, generated by cargo generate --git https://github.com/rustwasm/wasm-pack-template, then I added the surrealdb dependency). And not that it tells a whole lot, but cargo build runs fine.

@REASY
Copy link
Author

REASY commented Jul 28, 2023

@turboladen #93 is there for a while, didn't get much attention. You can apply it as a patch though.

@wolfv wolfv mentioned this issue Sep 13, 2023
@folkertdev
Copy link
Collaborator

Just adding this here too: since 0.5.0 you can compile with a pure rust implementation of libbz2, so that cross-compilation should work out of the box

bzip2 = { version = "0.5.0", default-features = false, features = ["libbz2-rs-sys"] }

Let us know if that works for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants