3

Whole error:

error: cannot find macro `thread_local` in this scope
    --> /home/hardeep/.cargo/git/checkouts/substrate-7e08433d4c370a21/948fbd2/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
    --> /home/hardeep/.cargo/git/checkouts/substrate-7e08433d4c370a21/948fbd2/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)

     Compiling hash-db v0.16.0
     Compiling hashbrown v0.12.3
  For more information about this error, try `rustc --explain E0425`.
  error: could not compile `sp-externalities` (lib) due to 4 previous errors
  warning: build failed, waiting for other jobs to finish...
warning: build failed, waiting for other jobs to finish...

rustups show:

hardeep@LAPTOP-M6QACF70:~/substrate/substrate-node-template$ rustup show
Default host: x86_64-unknown-linux-gnu
rustup home:  /home/hardeep/.rustup

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

stable-x86_64-unknown-linux-gnu (default)
nightly-x86_64-unknown-linux-gnu

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

wasm32-unknown-unknown
x86_64-unknown-linux-gnu

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

stable-x86_64-unknown-linux-gnu (directory override for '/home/hardeep/substrate/substrate-node-template')
rustc 1.75.0 (82e1608df 2023-12-21)

I tried all the things like installing wasm32-unknown-unknown.I also tried updating cargo with cargo update, before used cargo clean and used cargo build --release. also tried to pull if there were problem with my subsrate current node. Can anyone please help me with this.

1
  • Which version substrate are you working on ?
    – CocDap
    Jan 23 at 2:51

1 Answer 1

0

I've fixed it by adding my new pallet' STD feature. So if you have your Cargo.toml like

[dependencies]
pallet-dummy = { git = "https://github.com/xxx", default-features = false }

Then simply add

[features]
default = ["std"]
std = [
    "pallet-dummy/std",
]

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.