counter-rust-deprecated icon indicating copy to clipboard operation
counter-rust-deprecated copied to clipboard

`npm run test:unit` fails in building

Open akhi3030 opened this issue 1 year ago • 0 comments

James Weir reported on zulip that npm run test:unit fails on Intel based Mac.

Details:

git clone https://github.com/near-examples/rust-counter.git
cd rust-counter/
npm run build

this worked as expected
npm run test:unit

[[email protected]](mailto:[email protected]) test:unit /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter

    cd contract && cargo test

Compiling parity-secp256k1 v0.7.0
Compiling wasmer-vm v1.0.2
Compiling blake3 v0.3.8
Compiling jemalloc-sys v0.3.2
Compiling wasmtime-runtime v0.20.0
Compiling librocksdb-sys v6.20.3
Compiling cranelift-codegen v0.67.0
Compiling cranelift-codegen v0.68.0
Compiling near-vm-errors v4.0.0-pre.1
Compiling near-account-id v0.13.0
Compiling impl-codec v0.5.1
The following warnings were emitted during compilation:

warning: /opt/local/bin/ranlib: object: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmer-vm-1a918933441aa76c/out/libhelpers.a(helpers.o) malformed object (unknown load command 1)
warning: ar: internal ranlib command failed

error: failed to run custom build command for wasmer-vm v1.0.2

Caused by:
process didn't exit successfully: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmer-vm-84f7d0b1efb62ce1/build-script-build (exit status: 1)
--- stdout
cargo:rerun-if-changed=src/trap/helpers.c
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2,sse3,ssse3")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmer-vm-1a918933441aa76c/out/src/trap/helpers.o" "-c" "src/trap/helpers.c"
exit status: 0
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
running: "ar" "cq" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmer-vm-1a918933441aa76c/out/libhelpers.a" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmer-vm-1a918933441aa76c/out/src/trap/helpers.o"
cargo:warning=/opt/local/bin/ranlib: object: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmer-vm-1a918933441aa76c/out/libhelpers.a(helpers.o) malformed object (unknown load command 1)
cargo:warning=ar: internal ranlib command failed
exit status: 1

--- stderr

error occurred: Command "ar" "cq" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmer-vm-1a918933441aa76c/out/libhelpers.a" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmer-vm-1a918933441aa76c/out/src/trap/helpers.o" with args "ar" did not execute successfully (status code exit status: 1).

warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: /opt/local/bin/ranlib: object: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmtime-runtime-1e9e4280580fdece/out/libhelpers.a(helpers.o) malformed object (unknown load command 1)
warning: ar: internal ranlib command failed

error: failed to run custom build command for wasmtime-runtime v0.20.0

Caused by:
process didn't exit successfully: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmtime-runtime-31c4da91d6f0f205/build-script-build (exit status: 1)
--- stdout
cargo:rerun-if-changed=src/helpers.c
TARGET = Some("x86_64-apple-darwin")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-apple-darwin")
CC_x86_64-apple-darwin = None
CC_x86_64_apple_darwin = None
HOST_CC = None
CC = None
CFLAGS_x86_64-apple-darwin = None
CFLAGS_x86_64_apple_darwin = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("true")
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2,sse3,ssse3")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmtime-runtime-1e9e4280580fdece/out/src/helpers.o" "-c" "src/helpers.c"
exit status: 0
AR_x86_64-apple-darwin = None
AR_x86_64_apple_darwin = None
HOST_AR = None
AR = None
running: "ar" "cq" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmtime-runtime-1e9e4280580fdece/out/libhelpers.a" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmtime-runtime-1e9e4280580fdece/out/src/helpers.o"
cargo:warning=/opt/local/bin/ranlib: object: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmtime-runtime-1e9e4280580fdece/out/libhelpers.a(helpers.o) malformed object (unknown load command 1)
cargo:warning=ar: internal ranlib command failed
exit status: 1

--- stderr

error occurred: Command "ar" "cq" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmtime-runtime-1e9e4280580fdece/out/libhelpers.a" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/wasmtime-runtime-1e9e4280580fdece/out/src/helpers.o" with args "ar" did not execute successfully (status code exit status: 1).

The following warnings were emitted during compilation:

warning: /opt/local/bin/ranlib: object: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/parity-secp256k1-afe78f6703a844fd/out/libcheck_uint128_t.a(check_uint128_t.o) malformed object (unknown load command 1)
warning: ar: internal ranlib command failed
warning: Compiling in 32-bit mode on a 64-bit architecture due to lack of uint128_t support.
warning: /opt/local/bin/ranlib: object: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/parity-secp256k1-afe78f6703a844fd/out/libsecp256k1.a(lax_der_parsing.o) malformed object (unknown load command 1)
warning: ar: internal ranlib command failed

error: failed to run custom build command for parity-secp256k1 v0.7.0

Caused by:
process didn't exit successfully: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/parity-secp256k1-8b30f9d1c8e353dc/build-script-build (exit status: 1)
--- stdout
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-arch" "x86_64" "-Wall" "-Wextra" "-o" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/parity-secp256k1-afe78f6703a844fd/out/depend/check_uint128_t.o" "-c" "depend/check_uint128_t.c"
exit status: 0
running: "ar" "cq" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/parity-secp256k1-afe78f6703a844fd/out/libcheck_uint128_t.a" "/Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/parity-secp256k1-afe78f6703a844fd/out/depend/check_uint128_t.o"
cargo:warning=/opt/local/bin/ranlib: object: /Users/james/go/src/gitlab.com/moonshotlabs/smart-contract-examples/rust-counter/contract/target/debug/build/parity-secp256k1-afe78f6703a844fd/out/libcheck_uint128_t.a(check_uint128_t.o) malformed object (unknown load command 1)

I tried to reproduce the problem on my M1 Mac and I see the following problem:

$ npm run test:unit
...
   Compiling object v0.22.0
   Compiling ethbloom v0.11.1
   Compiling proc-macro-crate v0.1.5
error[E0425]: cannot find function `get_fault_info` in this scope
   --> /Users/akhi/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-runtime-core-near-0.17.4/src/fault.rs:296:21
    |
296 |         let fault = get_fault_info(siginfo as _, ucontext);
    |                     ^^^^^^^^^^^^^^ not found in this scope

akhi3030 avatar Aug 19 '22 13:08 akhi3030