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

Apple M1 compile issues with wasmtime #179

Closed
ddimaria opened this issue May 7, 2021 · 24 comments
Closed

Apple M1 compile issues with wasmtime #179

ddimaria opened this issue May 7, 2021 · 24 comments
Labels
bug Something isn't working

Comments

@ddimaria
Copy link

ddimaria commented May 7, 2021

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.

error[E0609]: no field `__rip` on type `__darwin_arm_thread_state64`
   --> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.22.0/src/traphandlers.rs:169:44
    |
169 |                     (*cx.uc_mcontext).__ss.__rip as *const u8
    |                                            ^^^^^ unknown field
    |
    = note: available fields are: `__x`, `__fp`, `__lr`, `__sp`, `__pc` ... and 2 others

error: aborting due to previous error

For more information about this error, try `rustc --explain E0609`.
error: could not compile `wasmtime-runtime`

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

Default host: aarch64-apple-darwin
rustup home:  ~/.rustup

installed toolchains
--------------------

stable-aarch64-apple-darwin (default)
nightly-aarch64-apple-darwin

installed targets for active toolchain
--------------------------------------

aarch64-apple-darwin
wasm32-unknown-unknown

active toolchain
----------------

stable-aarch64-apple-darwin (default)
rustc 1.52.0 (88f19c6da 2021-05-03)
@ddimaria ddimaria added the bug Something isn't working label May 7, 2021
@ddimaria ddimaria changed the title Apply M1 compile issues with wasmtime Apple M1 compile issues with wasmtime May 7, 2021
@ddimaria
Copy link
Author

ddimaria commented May 7, 2021

This only affects node and pallets crates. A fix was implemented and merged, but not released: paritytech/substrate#8356

@ddimaria
Copy link
Author

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: ~/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.22.0/src/traphandlers.rs

note: 1ecc6299db9ec823 may not be the same on your machine

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

@ddimaria
Copy link
Author

Script to replace the wasm-runtime-0.22.0 target:

#!/usr/bin/env bash

files=( $(compgen -G "$HOME/.cargo/registry/src/github.com-*/wasmtime-runtime-0.22.0/src/traphandlers.rs") )

if [ ! -z "$files" ]; then
    echo "Found file $files"
    sed -i '' 's/__rip/__pc/g' $files
fi

@VadneyK
Copy link

VadneyK commented May 19, 2021

I did:

cd ~/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.22.0/src/traphandlers.rs
then ctl-f to find and replace __rip with __pc

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?
Do I add this file under the root and just execute the script to make this compile on the M1 chip?

@ddimaria
Copy link
Author

You can run that script from anywhere since it uses $HOME

@Dengjianping
Copy link

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 Remote - Containers in vscode. That's really easy to use and convenient.

@ddimaria
Copy link
Author

@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 cargo clean, it takes about 8 mins. cargo check is super fast (like under 10s).

@VadneyK
Copy link

VadneyK commented May 26, 2021

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:
https://github.com/substrate-developer-hub/substrate-node-template
refering to this doc that tells me to copy paste: https://substrate.dev/docs/en/tutorials/add-a-pallet/configure-a-pallet

Config:
MacOS BigSur 11.2.3 M1 chip
image

pasted the code here:

1

2

Here is the long error message after running cargo run:

 Compiling pallet-aura v3.0.0 (https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc)
 Compiling pallet-grandpa v3.0.0 (https://github.com/paritytech/substrate.git?tag=monthly-2021-05#70ef0afc)

error: expected one of: Pallet, Call, Storage, Event, Config, Origin, Inherent, ValidateUnsigned
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:328:25
|
328 | Nicks: pallet_nicks::{Module, Call, Storage, Event},
| ^^^^^^

error[E0433]: failed to resolve: use of undeclared type Runtime
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:382:4
|
382 | Runtime::metadata().into()
| ^^^^^^^ use of undeclared type Runtime

error[E0433]: failed to resolve: use of undeclared type RandomnessCollectiveFlip
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:407:4
|
407 | RandomnessCollectiveFlip::random_seed().0
| ^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared type RandomnessCollectiveFlip

error[E0433]: failed to resolve: use of undeclared type Aura
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:428:49
|
428 | sp_consensus_aura::SlotDuration::from_millis(Aura::slot_duration())
| ^^^^ use of undeclared type Aura

error[E0433]: failed to resolve: use of undeclared type Aura
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:432:4
|
432 | Aura::authorities()
| ^^^^ use of undeclared type Aura

error[E0433]: failed to resolve: use of undeclared type Grandpa
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:450:4
|
450 | Grandpa::grandpa_authorities()
| ^^^^^^^ use of undeclared type Grandpa

error[E0433]: failed to resolve: use of undeclared type System
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:476:4
|
476 | System::account_nonce(account)
| ^^^^^^ use of undeclared type System

error[E0433]: failed to resolve: use of undeclared type TransactionPayment
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:485:4
|
485 | TransactionPayment::query_info(uxt, len)
| ^^^^^^^^^^^^^^^^^^ use of undeclared type TransactionPayment

error[E0433]: failed to resolve: use of undeclared type TransactionPayment
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:491:4
|
491 | TransactionPayment::query_fee_details(uxt, len)
| ^^^^^^^^^^^^^^^^^^ use of undeclared type TransactionPayment

error[E0412]: cannot find type Aura in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:89:14
|
89 | pub aura: Aura,
| ^^^^ not found in this scope

error[E0412]: cannot find type Grandpa in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:90:17
|
90 | pub grandpa: Grandpa,
| ^^^^^^^ help: a type alias with a similar name exists: GrandpaId
|
::: /Users/kentarovadney/.cargo/git/checkouts/substrate-7e08433d4c370a21/70ef0af/primitives/finality-grandpa/src/lib.rs:52:1
|
52 | pub type AuthorityId = app::Public;
| ----------------------------------- similarly named type alias GrandpaId defined here

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:153:31
|
153 | impl frame_system::Config for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Call in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:163:14
|
163 | type Call = Call;
| ^^^^
|
help: you might have meant to use the associated type
|
163 | type Call = Self::Call;
| ^^^^^^^^^^
help: consider importing one of these items
|
9 | use crate::pallet_template::Call;
|
9 | use frame_system::Call;
|
9 | use pallet_aura::Call;
|
9 | use pallet_balances::Call;
|
and 7 other candidates

error[E0412]: cannot find type Event in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:177:15
|
177 | type Event = Event;
| ^^^^^
|
help: you might have meant to use the associated type
|
177 | type Event = Self::Event;
| ^^^^^^^^^^^
help: consider importing one of these items
|
9 | use crate::pallet_template::Event;
|
9 | use frame_system::Event;
|
9 | use pallet_balances::Event;
|
9 | use pallet_grandpa::Event;
|
and 3 other candidates

error[E0412]: cannot find type Origin in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:179:16
|
179 | type Origin = Origin;
| ^^^^^^
|
help: you might have meant to use the associated type
|
179 | type Origin = Self::Origin;
| ^^^^^^^^^^^^
help: consider importing this type alias
|
9 | use frame_system::Origin;
|

error[E0412]: cannot find type PalletInfo in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:189:20
|
189 | type PalletInfo = PalletInfo;
| ^^^^^^^^^^
|
help: you might have meant to use the associated type
|
189 | type PalletInfo = Self::PalletInfo;
| ^^^^^^^^^^^^^^^^
help: consider importing this trait
|
9 | use frame_support::traits::PalletInfo;
|

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:204:30
|
204 | impl pallet_aura::Config for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:208:33
|
208 | impl pallet_grandpa::Config for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Event in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:209:15
|
209 | type Event = Event;
| ^^^^^
|
help: you might have meant to use the associated type
|
209 | type Event = Self::Event;
| ^^^^^^^^^^^
help: consider importing one of these items
|
9 | use crate::pallet_template::Event;
|
9 | use frame_system::Event;
|
9 | use pallet_balances::Event;
|
9 | use pallet_grandpa::Event;
|
and 3 other candidates

error[E0412]: cannot find type Call in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:210:14
|
210 | type Call = Call;
| ^^^^
|
help: you might have meant to use the associated type
|
210 | type Call = Self::Call;
| ^^^^^^^^^^
help: consider importing one of these items
|
9 | use crate::pallet_template::Call;
|
9 | use frame_system::Call;
|
9 | use pallet_aura::Call;
|
9 | use pallet_balances::Call;
|
and 7 other candidates

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:231:35
|
231 | impl pallet_timestamp::Config for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Aura in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:234:24
|
234 | type OnTimestampSet = Aura;
| ^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:244:34
|
244 | impl pallet_balances::Config for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Event in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:249:15
|
249 | type Event = Event;
| ^^^^^
|
help: you might have meant to use the associated type
|
249 | type Event = Self::Event;
| ^^^^^^^^^^^
help: consider importing one of these items
|
9 | use crate::pallet_template::Event;
|
9 | use frame_system::Event;
|
9 | use pallet_balances::Event;
|
9 | use pallet_grandpa::Event;
|
and 3 other candidates

error[E0412]: cannot find type System in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:252:22
|
252 | type AccountStore = System;
| ^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:253:62
|
244 | impl pallet_balances::Config for Runtime {
| - help: you might be missing a type parameter: <Runtime>
...
253 | type WeightInfo = pallet_balances::weights::SubstrateWeight;
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:260:45
|
260 | impl pallet_transaction_payment::Config for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Balances in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:261:45
|
60 | pub type Balance = u128;
| ------------------------ similarly named type alias Balance defined here
...
261 | type OnChargeTransaction = CurrencyAdapter<Balances, ()>;
| ^^^^^^^^
|
help: a type alias with a similar name exists
|
261 | type OnChargeTransaction = CurrencyAdapter<Balance, ()>;
| ^^^^^^^
help: you might be missing a type parameter
|
260 | impl pallet_transaction_payment::Config for Runtime {
| ^^^^^^^^^^

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:267:30
|
267 | impl pallet_sudo::Config for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Event in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:268:15
|
268 | type Event = Event;
| ^^^^^
|
help: you might have meant to use the associated type
|
268 | type Event = Self::Event;
| ^^^^^^^^^^^
help: consider importing one of these items
|
9 | use crate::pallet_template::Event;
|
9 | use frame_system::Event;
|
9 | use pallet_balances::Event;
|
9 | use pallet_grandpa::Event;
|
and 3 other candidates

error[E0412]: cannot find type Call in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:269:14
|
269 | type Call = Call;
| ^^^^
|
help: you might have meant to use the associated type
|
269 | type Call = Self::Call;
| ^^^^^^^^^^
help: consider importing one of these items
|
9 | use crate::pallet_template::Call;
|
9 | use frame_system::Call;
|
9 | use pallet_aura::Call;
|
9 | use pallet_balances::Call;
|
and 7 other candidates

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:273:34
|
273 | impl pallet_template::Config for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Event in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:274:15
|
274 | type Event = Event;
| ^^^^^
|
help: you might have meant to use the associated type
|
274 | type Event = Self::Event;
| ^^^^^^^^^^^
help: consider importing one of these items
|
9 | use crate::pallet_template::Event;
|
9 | use frame_system::Event;
|
9 | use pallet_balances::Event;
|
9 | use pallet_grandpa::Event;
|
and 3 other candidates

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:286:31
|
286 | impl pallet_nicks::Config for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:289:45
|
286 | impl pallet_nicks::Config for Runtime {
| - help: you might be missing a type parameter: <Runtime>
...
289 | type Currency = pallet_balances::Module;
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Event in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:308:18
|
308 | type Event = Event;
| ^^^^^
|
help: you might have meant to use the associated type
|
308 | type Event = Self::Event;
| ^^^^^^^^^^^
help: consider importing one of these items
|
9 | use crate::pallet_template::Event;
|
9 | use frame_system::Event;
|
9 | use pallet_balances::Event;
|
9 | use pallet_grandpa::Event;
|
and 3 other candidates

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:344:33
|
343 | pub type SignedExtra = (
| - help: you might be missing a type parameter: <Runtime>
344 | frame_system::CheckSpecVersion,
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:345:31
|
343 | pub type SignedExtra = (
| - help: you might be missing a type parameter: <Runtime>
344 | frame_system::CheckSpecVersion,
345 | frame_system::CheckTxVersion,
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:346:29
|
343 | pub type SignedExtra = (
| - help: you might be missing a type parameter: <Runtime>
...
346 | frame_system::CheckGenesis,
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:347:25
|
343 | pub type SignedExtra = (
| - help: you might be missing a type parameter: <Runtime>
...
347 | frame_system::CheckEra,
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:348:27
|
343 | pub type SignedExtra = (
| - help: you might be missing a type parameter: <Runtime>
...
348 | frame_system::CheckNonce,
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:349:28
|
343 | pub type SignedExtra = (
| - help: you might be missing a type parameter: <Runtime>
...
349 | frame_system::CheckWeight,
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:350:55
|
343 | pub type SignedExtra = (
| - help: you might be missing a type parameter: <Runtime>
...
350 | pallet_transaction_payment::ChargeTransactionPayment
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Call in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:353:68
|
353 | pub type UncheckedExtrinsic = generic::UncheckedExtrinsic<Address, Call, Signature, SignedExtra>;
| ^^^^ not found in this scope
|
help: consider importing one of these items
|
9 | use crate::pallet_template::Call;
|
9 | use frame_system::Call;
|
9 | use pallet_aura::Call;
|
9 | use pallet_balances::Call;
|
and 7 other candidates

error[E0412]: cannot find type Call in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:355:66
|
355 | pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExtra>;
| ^^^^ not found in this scope
|
help: consider importing one of these items
|
9 | use crate::pallet_template::Call;
|
9 | use frame_system::Call;
|
9 | use pallet_aura::Call;
|
9 | use pallet_balances::Call;
|
and 7 other candidates

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:358:2
|
357 | pub type Executive = frame_executive::Executive<
| - help: you might be missing a type parameter: <Runtime>
358 | Runtime,
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:360:29
|
357 | pub type Executive = frame_executive::Executive<
| - help: you might be missing a type parameter: <Runtime>
...
360 | frame_system::ChainContext,
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:361:2
|
357 | pub type Executive = frame_executive::Executive<
| - help: you might be missing a type parameter: <Runtime>
...
361 | Runtime,
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type AllPallets in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:362:2
|
357 | pub type Executive = frame_executive::Executive<
| - help: you might be missing a type parameter: <AllPallets>
...
362 | AllPallets,
| ^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:366:31
|
366 | impl sp_api::Core for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:380:35
|
380 | impl sp_api::Metadata for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:386:49
|
386 | impl sp_block_builder::BlockBuilder for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:411:75
|
411 | impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:420:49
|
420 | impl sp_offchain::OffchainWorkerApi for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:426:53
|
426 | impl sp_consensus_aura::AuraApi<Block, AuraId> for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:436:42
|
436 | impl sp_session::SessionKeys for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:448:44
|
448 | impl fg_primitives::GrandpaApi for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:474:82
|
474 | impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
| ^^^^^^^ not found in this scope

error[E0412]: cannot find type Runtime in this scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:480:93
|
480 | impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance> for Runtime {
| ^^^^^^^ not found in this scope

warning: unused doc comment
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:277:1
|
277 | /// Add this code block to your template for Nicks:
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ rustdoc does not generate documentation for macro invocations
|
= note: #[warn(unused_doc_comments)] on by default
= help: to document an item produced by a macro, the macro must produce the documentation as part of its expansion

error: duplicate lang item in crate sp_io (which sp_application_crypto depends on): panic_impl.
|
= note: the lang item is first defined in crate sp_io (which sp_application_crypto depends on)
= note: first definition in sp_io loaded from /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-c9fe396515fb85da.rmeta
= note: second definition in sp_io loaded from /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-9c9a8f2e54128cb1.rmeta

error: duplicate lang item in crate sp_io (which sp_application_crypto depends on): oom.
|
= note: the lang item is first defined in crate sp_io (which sp_application_crypto depends on)
= note: first definition in sp_io loaded from /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-c9fe396515fb85da.rmeta
= note: second definition in sp_io loaded from /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/target/debug/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/libsp_io-9c9a8f2e54128cb1.rmeta

warning: use of deprecated type alias pallet_balances::Module: use Pallet instead
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:289:21
|
289 | type Currency = pallet_balances::Module;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(deprecated)] on by default

error[E0599]: no method named create_extrinsics found for struct InherentData in the current scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:396:9
|
396 | data.create_extrinsics()
| ^^^^^^^^^^^^^^^^^ method not found in InherentData

error[E0599]: no method named check_extrinsics found for struct InherentData in the current scope
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:403:9
|
403 | data.check_extrinsics(&block)
| ^^^^^^^^^^^^^^^^ method not found in InherentData

error[E0283]: type annotations needed
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:87:2
|
87 | / impl_opaque_keys! {
88 | | pub struct SessionKeys {
89 | | pub aura: Aura,
90 | | pub grandpa: Grandpa,
91 | | }
92 | | }
| |_____^ cannot infer type
|
= note: cannot satisfy _: core::default::Default
= note: required by core::default::Default::default
= note: this error originates in the derive macro Default (in Nightly builds, run with -Z macro-backtrace for more info)

error: aborting due to 64 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0283, E0412, E0433, E0599.
For more information about an error, try rustc --explain E0283.
error: could not compile node-template-runtime

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

@Dengjianping
Copy link

@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 cargo clean, it takes about 8 mins. cargo check is super fast (like under 10s).

Almost the same if compile it directly on MacOS, but it took about 10mins to compile in docker container.

@Dengjianping
Copy link

Dengjianping commented May 27, 2021

@VadneyK , you might need to rename Module to Pallet at line 328.

@VadneyK
Copy link

VadneyK commented May 27, 2021

@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 could not find Pallet in 'pallet_nicks':

kentarovadney@Kentaros-MacBook-Air substrate-node-template % cargo run
Compiling node-template-runtime v3.0.0 (/Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime)
error: failed to run custom build command for node-template-runtime v3.0.0 (/Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime)

Caused by:
process didn't exit successfully: /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/target/debug/build/node-template-runtime-a7a9319b5248c4ea/build-script-build (exit code: 1)
--- stdout
Information that should be included in a bug report.
Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/Users/kentarovadney/Desktop/code/substrate/substrate-node-template/target/debug/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--release"
Using rustc version: rustc 1.54.0-nightly (ff2c947c0 2021-05-25)

--- stderr
Compiling node-template-runtime v3.0.0 (/Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime)
error[E0433]: failed to resolve: could not find Pallet in pallet_nicks
--> /Users/kentarovadney/Desktop/code/substrate/substrate-node-template/runtime/src/lib.rs:314:1
|
314 | / construct_runtime!(
315 | | pub enum Runtime where
316 | | Block = Block,
317 | | NodeBlock = opaque::Block,
... |
331 | | }
332 | | );
| |__^ could not find Pallet in pallet_nicks
|
= note: this error originates in the macro construct_runtime (in Nightly builds, run with -Z macro-backtrace for more info)

---snip ---------

error: aborting due to 24 previous errors; 2 warnings emitted

Some errors have detailed explanations: E0277, E0412, E0433.
For more information about an error, try rustc --explain E0277.
error: could not compile node-template-runtime

To learn more, run the command again with --verbose.

@Dengjianping
Copy link

@VadneyK Try to replace line 289 with following code:

type Currency = Balances;

Yes, sometimes those docs fall behind the code changes.

@al3mart
Copy link
Contributor

al3mart commented May 27, 2021

@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
I think that should work fine

EDIT: in order to copy paste from tutorial

@VadneyK
Copy link

VadneyK commented May 27, 2021

@Dengjianping the suggested change didn't change any of the errors ;(
@al3mart as you suggested I was on main instead of tag/v3.0.0 I did git checkout tags/v3.0.0 then deleted the librocksdb-sys inputs in cargo.lock and added librocksdb-sys = "6.17.3" under [package] in cargo.toml and it worked! thanks!

I cant seem to close the issue but it's all resolved now!

@reggi
Copy link

reggi commented May 28, 2021

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 librocksdb-sys / js-sys / and wasmtime-runtime and i've tried cargo update --package for each.

Is there anyway to get this repo running on an M1?

error[E0609]: no field `__rip` on type `__darwin_arm_thread_state64`
   --> /Users/thomasreggi/.cargo/registry/src/github.com-1ecc6299db9ec823/wasmtime-runtime-0.22.0/src/traphandlers.rs:169:44
    |
169 |                     (*cx.uc_mcontext).__ss.__rip as *const u8
    |                                            ^^^^^ unknown field
    |
    = note: available fields are: `__x`, `__fp`, `__lr`, `__sp`, `__pc` ... and 2 others

error: aborting due to previous error

@VadneyK
Copy link

VadneyK commented Jun 2, 2021

@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)

@davidrhodus
Copy link

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.

@NukeManDan
Copy link
Contributor

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.

@NukeManDan
Copy link
Contributor

Reported to be working without any issues now, please use latest monthly release if you have issues 🙏🏼

@herou
Copy link

herou commented Jul 8, 2021

I would not consider this issue closed because I ma having another error:
@ddimaria

` "-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"
exit status: 0
running: "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/db/db_impl/db_impl_experimental.o" "-c" "rocksdb/db/db_impl/db_impl_experimental.cc"
exit status: 0
running: "c++" "-O0" "-ffunction-sections" "-

snip

exit status: 0
running: "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/dynamic_bloom.o" "-c" "rocksdb/util/dynamic_bloom.cc"
exit status: 0
running: "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/hash.o" "-c" "rocksdb/util/hash.cc"
exit status: 0
running: "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/murmurhash.o" "-c" "rocksdb/util/murmurhash.cc"
exit status: 0
running: "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/random.o" "-c" "rocksdb/util/random.cc"
exit status: 0
running: "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/rate_limiter.o" "-c" "rocksdb/util/rate_limiter.cc"
exit status: 0
running: "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/slice.o" "-c" "rocksdb/util/slice.cc"
cargo:warning=rocksdb/util/crc32c.cc:502:18: error: use of undeclared identifier 'isSSE42'
cargo:warning= has_fast_crc = isSSE42();
cargo:warning= ^
cargo:warning=rocksdb/util/crc32c.cc:1232:7: error: use of undeclared identifier 'isSSE42'
cargo:warning= if (isSSE42()) {
cargo:warning= ^
cargo:warning=rocksdb/util/crc32c.cc:1233:9: error: use of undeclared identifier 'isPCLMULQDQ'
cargo:warning= if (isPCLMULQDQ()) {
cargo:warning= ^
cargo:warning=3 errors generated.
exit status: 1
running: "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/file_checksum_helper.o" "-c" "rocksdb/util/file_checksum_helper.cc"
exit status: 0
exit status: 0
exit status: 0
exit status: 0
exit status: 0
exit status: 0
exit status: 0
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 % `

@davidrhodus
Copy link

I would not consider this issue closed because I ma having another error:
@ddimaria

` "-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"
exit status: 0
running: "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/db/db_impl/db_impl_experimental.o" "-c" "rocksdb/db/db_impl/db_impl_experimental.cc"
exit status: 0
running: "c++" "-O0" "-ffunction-sections" "-

snip

exit status: 0
running: "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/dynamic_bloom.o" "-c" "rocksdb/util/dynamic_bloom.cc"
exit status: 0
running: "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/hash.o" "-c" "rocksdb/util/hash.cc"
exit status: 0
running: "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/murmurhash.o" "-c" "rocksdb/util/murmurhash.cc"
exit status: 0
running: "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/random.o" "-c" "rocksdb/util/random.cc"
exit status: 0
running: "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/rate_limiter.o" "-c" "rocksdb/util/rate_limiter.cc"
exit status: 0
running: "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/slice.o" "-c" "rocksdb/util/slice.cc"
cargo:warning=rocksdb/util/crc32c.cc:502:18: error: use of undeclared identifier 'isSSE42'
cargo:warning= has_fast_crc = isSSE42();
cargo:warning= ^
cargo:warning=rocksdb/util/crc32c.cc:1232:7: error: use of undeclared identifier 'isSSE42'
cargo:warning= if (isSSE42()) {
cargo:warning= ^
cargo:warning=rocksdb/util/crc32c.cc:1233:9: error: use of undeclared identifier 'isPCLMULQDQ'
cargo:warning= if (isPCLMULQDQ()) {
cargo:warning= ^
cargo:warning=3 errors generated.
exit status: 1
running: "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/file_checksum_helper.o" "-c" "rocksdb/util/file_checksum_helper.cc"
exit status: 0
exit status: 0
exit status: 0
exit status: 0
exit status: 0
exit status: 0
exit status: 0
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
david@davids-air substrate-node-template % date
Thu Jul 8 16:27:33 PDT 2021

I have very little installed to try and avoid conflicts, .e.g no homebrew even installed.

Is your xcode and rustc up to date?

@NukeManDan
Copy link
Contributor

Futher insight to build issues on ARM:
paritytech/polkadot#3482 (comment)

You should be able to build + run polkadot on your M1 after running the following 2 commands:

rustup install stable-aarch64-apple-darwin
rustup default stable-aarch64-apple-darwin

Then go to your polkadot directory, run cargo clean and attempt to build & run again with cargo build --release. That being said, I'm not sure why the version you've built with the stable-x86_64-apple-darwin target fails to run. I'll do some digging...

@Polkaverse
Copy link

I would not consider this issue closed because I ma having another error:
@ddimaria

` "-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"
exit status: 0
running: "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/db/db_impl/db_impl_experimental.o" "-c" "rocksdb/db/db_impl/db_impl_experimental.cc"
exit status: 0
running: "c++" "-O0" "-ffunction-sections" "-

snip

exit status: 0
running: "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/dynamic_bloom.o" "-c" "rocksdb/util/dynamic_bloom.cc"
exit status: 0
running: "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/hash.o" "-c" "rocksdb/util/hash.cc"
exit status: 0
running: "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/murmurhash.o" "-c" "rocksdb/util/murmurhash.cc"
exit status: 0
running: "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/random.o" "-c" "rocksdb/util/random.cc"
exit status: 0
running: "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/rate_limiter.o" "-c" "rocksdb/util/rate_limiter.cc"
exit status: 0
running: "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/slice.o" "-c" "rocksdb/util/slice.cc"
cargo:warning=rocksdb/util/crc32c.cc:502:18: error: use of undeclared identifier 'isSSE42'
cargo:warning= has_fast_crc = isSSE42();
cargo:warning= ^
cargo:warning=rocksdb/util/crc32c.cc:1232:7: error: use of undeclared identifier 'isSSE42'
cargo:warning= if (isSSE42()) {
cargo:warning= ^
cargo:warning=rocksdb/util/crc32c.cc:1233:9: error: use of undeclared identifier 'isPCLMULQDQ'
cargo:warning= if (isPCLMULQDQ()) {
cargo:warning= ^
cargo:warning=3 errors generated.
exit status: 1
running: "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/file_checksum_helper.o" "-c" "rocksdb/util/file_checksum_helper.cc"
exit status: 0
exit status: 0
exit status: 0
exit status: 0
exit status: 0
exit status: 0
exit status: 0
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 % `

@herou how do you solved this error

@herou
Copy link

herou commented Aug 11, 2021

@PankajChaudhary5 check out this branch: https://github.com/herou/recipes/tree/m1_fix_v3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants