Closed sergey-melnychuk closed 1 month ago
Run of code at https://github.com/eigerco/beerus/pull/676 without axum
breaks on mimalloc
.
$ cargo check --target wasm32-unknown-unknown --no-default-features
Checking parity-scale-codec v3.6.12
Checking num_enum v0.7.2
Checking starknet-crypto v0.6.2
Compiling cairo-lang-sierra v2.6.3
Compiling libmimalloc-sys v0.1.38
Checking ethereum-types v0.8.0
Checking ark-ec v0.4.2
Checking http-body v0.4.6
Compiling phf_shared v0.11.2
Checking num-modular v0.5.1
Compiling const_format_proc_macros v0.2.32
Checking lru v0.12.3
Compiling thiserror-impl-no-std v2.0.2
Compiling proc-macro-error v1.0.4
Checking rustls-pki-types v1.7.0
Checking minimal-lexical v0.2.1
Checking tinyvec_macros v0.1.1
Checking httpdate v1.0.3
Checking untrusted v0.9.0
Checking utf8parse v0.2.2
Checking tinyvec v1.6.0
Checking ring v0.17.8
Checking nom v7.1.3
The following warnings were emitted during compilation:
warning: libmimalloc-sys@0.1.38: In file included from c_src/mimalloc/src/static.c:17:
warning: libmimalloc-sys@0.1.38: In file included from c_src/mimalloc/include/mimalloc/internal.h:17:
warning: libmimalloc-sys@0.1.38: In file included from c_src/mimalloc/include/mimalloc/types.h:27:
warning: libmimalloc-sys@0.1.38: c_src/mimalloc/include/mimalloc/atomic.h:386:10: fatal error: 'unistd.h' file not found
warning: libmimalloc-sys@0.1.38: #include <unistd.h>
warning: libmimalloc-sys@0.1.38: ^~~~~~~~~~
warning: libmimalloc-sys@0.1.38: 1 error generated.
error: failed to run custom build command for `libmimalloc-sys v0.1.38`
Caused by:
process didn't exit successfully: `/home/work/Work/Eiger/code/beerus/target/debug/build/libmimalloc-sys-4acd2cccd80c0430/build-script-build` (exit status: 1)
--- stdout
OPT_LEVEL = Some("0")
TARGET = Some("wasm32-unknown-unknown")
HOST = Some("x86_64-unknown-linux-gnu")
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=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
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:warning=In file included from c_src/mimalloc/src/static.c:17:
cargo:warning=In file included from c_src/mimalloc/include/mimalloc/internal.h:17:
cargo:warning=In file included from c_src/mimalloc/include/mimalloc/types.h:27:
cargo:warning=c_src/mimalloc/include/mimalloc/atomic.h:386:10: fatal error: 'unistd.h' file not found
cargo:warning=#include <unistd.h>
cargo:warning= ^~~~~~~~~~
cargo:warning=1 error generated.
--- stderr
error occurred: Command "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-I" "c_src/mimalloc/include" "-I" "c_src/mimalloc/src" "-Wall" "-Wextra" "-DMI_DEBUG=0" "-o" "/home/work/Work/Eiger/code/beerus/target/wasm32-unknown-unknown/debug/build/libmimalloc-sys-2bf48d963bdaf74e/out/98cfcaec7182b1d8-static.o" "-c" "c_src/mimalloc/src/static.c" with args clang did not execute successfully (status code exit status: 1).
There is also some issue with ring, but I think I've found a solution to that
warning: ring@0.17.8: error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
warning: ring@0.17.8: 1 error generated.
error: failed to run custom build command for `ring v0.17.8`
Caused by:
process didn't exit successfully: `/Users/luke/code/eiger/beerus/target/debug/build/ring-0d2c451aff869db2/build-script-build` (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=RING_PREGENERATE_ASM
cargo:rustc-env=RING_CORE_PREFIX=ring_core_0_17_8_
OPT_LEVEL = Some("0")
TARGET = Some("wasm32-unknown-unknown")
HOST = Some("x86_64-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=CC_ENABLE_DEBUG_OUTPUT
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
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:warning=error: unable to create target: 'No available targets are compatible with triple "wasm32-unknown-unknown"'
cargo:warning=1 error generated.
--- stderr
error occurred: Command "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=wasm32-unknown-unknown" "-I" "include" "-I" "/Users/luke/code/eiger/b
eerus/target/wasm32-unknown-unknown/debug/build/ring-0b0ecddcc30e01f2/out" "-Wall" "-Wextra" "-fvisibility=hidden" "-std=c1x" "-Wall" "-Wbad-function-cast" "-Wcast-align" "-Wcast-qual" "-Wconversion
" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wnested-externs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wstrict-prototypes" "-Wundef" "-Wuninitialized" "-g
3" "-nostdlibinc" "-DNDEBUG" "-DRING_CORE_NOSTDLIBINC=1" "-o" "/Users/luke/code/eiger/beerus/target/wasm32-unknown-unknown/debug/build/ring-0b0ecddcc30e01f2/out/fad98b632b8ce3cc-curve25519.o" "-c" "
crypto/curve25519/curve25519.c" with args clang did not execute successfully (status code exit status: 1).
Currently with
axum
and RPC serving extracted, the only thing that stops from compiling stateless execution code with--target wasm32-unknown-unknown
seems to be the possibility for theblockifier
to depend oncairo-vm
withoutmimalloc
dependency (with default features disabled).Will investigate further and reproduce properly on forked
cairo-vm
&blockifier
, also report here if any extra effort is required to makeblockifier
wasm-friendly.