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
Apple M1 compile issues with wasmtime #179
Comments
This only affects |
I tried some cleaner hacks (fork substrate at v3.0.0 and update wasmtime to 0.24.0, force version changes in Cargo.lock, ...etc), but this ended up being the least hassle. Just update a piece of code in your cached registry. File: note: Change } else if #[cfg(target_os = "macos")] {
let cx = &*(cx as *const libc::ucontext_t);
(*cx.uc_mcontext).__ss.__rip as *const u8 to } else if #[cfg(target_os = "macos")] {
let cx = &*(cx as *const libc::ucontext_t);
(*cx.uc_mcontext).__ss.__pc as *const u8 |
Script to replace the wasm-runtime-0.22.0 target:
|
I did:
and it worked! I guess although the program counter (pc) and return instruction pointer are functionally equivallent, the M1 chip some how uses a pc in the ARM as with the RISC-V architecture instead of the rip as with the x86 intel architecture? also how do I run that script you posted? |
You can run that script from anywhere since it uses |
I had the problem as well, but now I'm developing on docker container, it compiles fine. However, I have to install latest docker which supports Apple M1, and then install a plugin named |
@Dengjianping how long does it take you to do a release build (of this repo) within a docker container on you M1? Directly on my MBP (16GB RAM) and after a |
I'm trying configure nicks template on the substrate-node-template repo, but when I copy paste in the code into src/runtime/lib.rs and try to cargo build --release I get 64 errors in places I didn't even edit. I re-installed the correct nightly versions so I'm confused as to why it's just not working. Is This a knows issue? I can paste the code anywhere in the file since rust doesn't care about the order of execution right? the fix above made the node compile before I made these changes to configure nicks. repo: Config: pasted the code here: Here is the long error message after running
error: expected one of: error[E0433]: failed to resolve: use of undeclared type error[E0433]: failed to resolve: use of undeclared type error[E0433]: failed to resolve: use of undeclared type error[E0433]: failed to resolve: use of undeclared type error[E0433]: failed to resolve: use of undeclared type error[E0433]: failed to resolve: use of undeclared type error[E0433]: failed to resolve: use of undeclared type error[E0433]: failed to resolve: use of undeclared type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type error[E0412]: cannot find type warning: unused doc comment error: duplicate lang item in crate error: duplicate lang item in crate warning: use of deprecated type alias error[E0599]: no method named error[E0599]: no method named error[E0283]: type annotations needed error: aborting due to 64 previous errors; 2 warnings emitted Some errors have detailed explanations: E0283, E0412, E0433, E0599. To learn more, run the command again with --verbose. |
Almost the same if compile it directly on MacOS, but it took about 10mins to compile in docker container. |
@VadneyK , you might need to rename |
@Dengjianping thanks! why should it be pallet now? I guess the tutorial is outdated? I thought we want to export the "Module type from the decl_module! macro." as stated in the tutorial? I still have some other issues. I tried changing Module to Pallet in line 291 but I still get the repeated kentarovadney@Kentaros-MacBook-Air substrate-node-template % cargo run Caused by: --- stderr ---snip --------- error: aborting due to 24 previous errors; 2 warnings emitted Some errors have detailed explanations: E0277, E0412, E0433. To learn more, run the command again with --verbose. |
@VadneyK Try to replace line type Currency = Balances; Yes, sometimes those docs fall behind the code changes. |
@VadneyK I feel like those issues has nothing to do with M1, but using master branch of node-template, please, make sure you are using https://github.com/substrate-developer-hub/substrate-node-template/tree/v3.0.0 EDIT: in order to copy paste from tutorial |
@Dengjianping the suggested change didn't change any of the errors ;( I cant seem to close the issue but it's all resolved now! |
Hey all 👋 I'm still seeing this wasm error on 3.0.0 on my M1 This is my first experience with Rust. It seems many of these packages have been patched to fix their M1 issues. I'm not sure how to update the necessary dependencies. I've had problems with Is there anyway to get this repo running on an M1?
|
@reggi replace __rip to __pc. the ARM architecture apparently references the return instruction pointer(rip) as the program counter (pc) as per my comment here: #179 (comment) |
substrate-node-template compiles on Apple M1 using rustc 1.51.0 along with the Polkadot Git repository. I think this issue can be closed. |
Awesome. What version of this template? 3.0.0 working? Or do you need to use the monthly, should be included in substrate-developer-hub/substrate-developer-hub.github.io#1026 to reflect any caveats. |
Reported to be working without any issues now, please use latest monthly release if you have issues 🙏🏼 |
I would not consider this issue closed because I ma having another error: ` "-o" "/Users/elioprifti/substrate-node-template/target/debug/build/librocksdb-sys-6e368def0b907fcc/out/rocksdb/db/db_impl/db_impl_debug.o" "-c" "rocksdb/db/db_impl/db_impl_debug.cc" snip exit status: 0 --- stderr error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-arch" "arm64" "-I" "rocksdb/include/" "-I" "rocksdb/" "-I" "rocksdb/third-party/gtest-1.8.1/fused-src/" "-I" "snappy/" "-I" "." "-Wall" "-Wextra" "-std=c++11" "-Wno-unused-parameter" "-DSNAPPY=1" "-DNDEBUG=1" "-DOS_MACOSX=1" "-DROCKSDB_PLATFORM_POSIX=1" "-DROCKSDB_LIB_IO_POSIX=1" "-o" "/Users/elioprifti/substrate-node-template/target/debug/build/librocksdb-sys-6e368def0b907fcc/out/rocksdb/util/crc32c.o" "-c" "rocksdb/util/crc32c.cc" with args "c++" did not execute successfully (status code exit status: 1). elioprifti@Elios-Air substrate-node-template % ` |
I tested with a new build on the master branch and didn't encounter any issue. Finished dev [unoptimized + debuginfo] target(s) in 4m 27s I have very little installed to try and avoid conflicts, .e.g no homebrew even installed. Is your xcode and rustc up to date? |
Futher insight to build issues on ARM:
|
@herou how do you solved this error |
@PankajChaudhary5 check out this branch: https://github.com/herou/recipes/tree/m1_fix_v3.0.0 |
Description
I know that M1 isn't officially supported, but wanted to report a recent issue as the previous workaround (https://vikiival.medium.com/run-substrate-on-apple-m1-a2699743fae8) no longer applies.
Steps to Reproduce
Clone the repo on an Apple M1, then run
cargo build
.Expected vs. Actual Behavior
Expected a success compilation, but received an error.
Environment
The text was updated successfully, but these errors were encountered: