1

When I am trying to build substrate node-template, cargo build below error occurs. How to solve this issue.

system : Apple M1 Pro OSX : Ventura 13.2.1

rustup show

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

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

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

wasm32-unknown-unknown
x86_64-apple-darwin

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

nightly-x86_64-apple-darwin (overridden by +toolchain on the command line)
rustc 1.70.0-nightly (f63ccaf25 2023-03-06)
  error: cannot find macro `thread_local` in this scope
    --> /Users/xxxxx/.cargo/git/checkouts/substrate-7e08433d4c370a21/f38bd66/primitives/externalities/src/scope_limited.rs:22:1
     |
  22 | environmental::environmental!(ext: trait Externalities);
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `thread_local` is in scope, but it is an attribute: `#[thread_local]`
     = note: this error originates in the macro `$crate::thread_local_impl` which comes from the expansion of the macro `environmental::environmental` (in Nightly builds, run with -Z macro-backtrace for more info)

  error[E0425]: cannot find value `GLOBAL` in this scope
    --> /Users/xxxxxxx/.cargo/git/checkouts/substrate-7e08433d4c370a21/f38bd66/primitives/externalities/src/scope_limited.rs:22:1
     |
  22 | environmental::environmental!(ext: trait Externalities);
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
     |
     = note: this error originates in the macro `$crate::environmental` which comes from the expansion of the macro `environmental::environmental` (in Nightly builds, run with -Z macro-backtrace for more info)

  For more information about this error, try `rustc --explain E0425`.
  error: could not compile `sp-externalities` due to 4 previous errors
2
  • 2
    Check you are using the same versions of substrate in all your repository, check the version in the runtime/Cargo.toml , pallets/template/Cargo.toml and node/Cargo.toml
    – Alex Bean
    Commented Mar 7, 2023 at 12:19
  • thanks for replying
    – nagaraj
    Commented Mar 7, 2023 at 18:16

1 Answer 1

1

Your issue sounds like it might be an environment issue. I notice you are running the x86_64 version of Rust on your Mac. I have an M1 chip as well, and have no issues using the ARM target, so I'd start with installing and using the *-aarch64-apple-darwin toolchains for both stable and nightly. Install the wasm32-unknown-unknown targets after that and try again.

1
  • thanks for replay, I was using Rosetta it was issue :)
    – nagaraj
    Commented Mar 7, 2023 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.