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

Encountered an error when using near-sdk-sim in mac m1 #355

Closed
madwiki opened this issue Apr 6, 2021 · 6 comments
Closed

Encountered an error when using near-sdk-sim in mac m1 #355

madwiki opened this issue Apr 6, 2021 · 6 comments

Comments

@madwiki
Copy link

madwiki commented Apr 6, 2021

Environment:
MacOS Big Sur 11.2.3
Mac mini (M1, 2020)
rustc 1.51.0 (2fd73fabe 2021-03-23)

In Cargo.toml, after I added

 <span class="error">[dev-dependencies]</span>
 near-sdk-sim = "3.0.1"

Logs when run cargo test --package my_contract – --nocapture

Compiling cranelift-codegen v0.68.0
Compiling cranelift-codegen v0.67.0
Compiling primitive-types v0.9.0
Compiling borsh v0.8.2
Compiling wasmer-compiler v1.0.2
Compiling wasmer-runtime-core-near v0.17.1
Compiling librocksdb-sys v6.11.4
The following warnings were emitted during compilation:

warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to the full path to a valid `llvm-config` executable (including the executable itself)

error: failed to run custom build command for `librocksdb-sys v6.11.4`

Caused by:
process didn't exit successfully: `/Users/mad/my-contract/target/debug/build/librocksdb-sys-6dec38e3daa0d72d/build-script-build` (exit code: 101)
— stdout
cargo:warning=couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
cargo:warning=set the LLVM_CONFIG_PATH environment variable to the full path to a valid `llvm-config` executable (including the executable itself)

— stderr
thread 'main' panicked at 'libclang error; possible causes include:

*   Invalid flag syntax
*   Unrecognized flags
*   Invalid flag arguments
*   File I/O errors
*   Host vs. target architecture mismatch
    If you encounter an error missing from this list, please file an issue or a PR!', /Users/mad/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.54.0/src/ir/context.rs:573:15
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    warning: build failed, waiting for other jobs to finish...
    error<span class="error">[E0425]</span>: cannot find function `get_fault_info` in this scope
    --> /Users/mad/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmer-runtime-core-near-0.17.1/src/fault.rs:289:21 

   <div class="table-wrap"> 
   </div>

   289 | let fault = get_fault_info(siginfo as _, ucontext);

   <div class="table-wrap">
     | ^^^^^^^^^^^^^^ not found in this scope | 
   </div>

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
error: build failed
@madwiki madwiki changed the title Encountered an error when using near-sdk-sim Encountered an error when using near-sdk-sim in mac m1 Apr 6, 2021
@petersalomonsen
Copy link

Have you installed the command line tools for xcode? On my M1 I get further than this, but I have another problem with wasmer requiring AVX support.

@marco-sundsk
Copy link

I have encountered the same problem, and my rust toolchain is stable-aarch64-apple-darwin (default).
The error msg shows on my M1 is:

error[E0425]: cannot find function `get_fault_info` in this scope
   --> /Users/haosun/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/wasmer-runtime-core-near-0.17.1/src/fault.rs:289:21
    |
289 |         let fault = get_fault_info(siginfo as _, ucontext);
    |                     ^^^^^^^^^^^^^^ not found in this scope

And no other error output.

@think-in-universe
Copy link
Member

think-in-universe commented Aug 10, 2021

@austinabell Hey Austin, could you please check this issue?

this issue may be relevant: wasmerio/wasmer#1832 (thought it's about iOS, not Mac M1)

@austinabell
Copy link
Contributor

@austinabell Hey Austin, could you please check this issue?

this issue may be relevant: wasmerio/wasmer#1832 (thought it's about iOS, not Mac M1)

Yeah, I believe this is just an issue of llvm/clang being not configured correctly or the path to llvm binaries not being set up. Setting this up is a bit opinionated, whether or not you want to use brew or not, and I don't personally have an M1 to check the minimal setup (is the file architecture the same as other intel mac?).

This should error even after this when using sim tests though because I believe sim tests are still using the version of nearcore which compiles the version of wasmer which is incompatible with m1, but I believe @willemneal might have the correct status of this.

@myklemykle
Copy link

I can confirm: sim tests are still broken on M1, with this same get_fault_info error.

@austinabell
Copy link
Contributor

sim deprecated in favour of https://github.com/near/workspaces-rs/

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

No branches or pull requests

6 participants