1

I'm trying to use the environmental crate (link: https://docs.rs/environmental/1.1.3/src/environmental/lib.rs.html#64) to work with EVM and ethereum transactions. But it seems like adding either features=["std"] or environmental/std does'nt work :/

[dependencies]
environmental = { version = "1.1.3", features=["std"] }

Link: https://github.com/edgeware-network/edgeware-node/blob/erup-5-latest/primitives/rpc/evm-tracing-events/Cargo.toml#L11

tracelog:

     Compiling evm-tracing-events v0.1.0 (/home/runner/work/edgeware-node/edgeware-node/primitives/rpc/evm-tracing-events)
  error: cannot find macro `thread_local` in this scope
    --> /home/runner/work/edgeware-node/edgeware-node/primitives/rpc/evm-tracing-events/src/lib.rs:51:1
     |
  51 | environmental::environmental!(listener: dyn Listener + 'static);
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `thread_local` is in scope, but it is an attribute: `#[thread_local]`
     = note: this error originates in the macro `$crate::thread_local_impl` (in Nightly builds, run with -Z macro-backtrace for more info)

  error[E0425]: cannot find value `GLOBAL` in this scope
    --> /home/runner/work/edgeware-node/edgeware-node/primitives/rpc/evm-tracing-events/src/lib.rs:51:1
     |
  51 | environmental::environmental!(listener: dyn Listener + 'static);
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
     |
     = note: this error originates in 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 `evm-tracing-events` due to 3 previous errors
  warning: build failed, waiting for other jobs to finish...
warning: build failed, waiting for other jobs to finish...
Error: Process completed with exit code 101.

It complains due to missing code parts that needs a feature flag to be added.

Links: https://docs.rs/environmental/1.1.3/src/environmental/lib.rs.html#66 https://github.com/edgeware-network/edgeware-node/runs/6208406289?check_suite_focus=true#step:8:1538

Does anyone know how I can enable the std features?

Code for pallet: https://docs.rs/environmental/1.1.3/src/environmental/lib.rs.html#64

1 Answer 1

-1

non answer: this was because #![cfg_attr(not(feature = "std"), no_std)] was enabled on the pallet..

3
  • 2
    you cannot use std in your runtime. If you are building a pallet this isn't going to work.
    – Nuke
    May 29, 2022 at 3:58
  • yeah I realized this... There is some std leak somewhere
    – flipchan
    Jun 6, 2022 at 14:46
  • 1
    You can also get here if you're accidentally referencing two versions of substrate at the same time.
    – Squirrel
    Feb 27 at 21:10

Your Answer

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

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