【问题标题】:Substrate node template build failed (using macbook pro)Substrate 节点模板构建失败(使用 macbook pro)
【发布时间】:2022-01-01 15:44:48
【问题描述】:

我正在尝试创建我的 first substrate chain。 我的操作系统是 macOS Monterey v12.1(最近更新)

这是我在运行$ cargo build --release 后遇到的错误:


   ....
   Compiling lru v0.7.1
   Compiling lru v0.6.6
   Compiling rand v0.7.3
   Compiling zeroize_derive v1.2.0
   Compiling parity-util-mem-derive v0.1.0
   Compiling structopt-derive v0.4.18
   Compiling pest_derive v2.1.0
The following warnings were emitted during compilation:

warning: src/helpers.c:1:10: fatal error: 'setjmp.h' file not found
warning: #include <setjmp.h>
warning:          ^~~~~~~~~~
warning: 1 error generated.

error: failed to run custom build command for `wasmtime-runtime v0.31.0`

Caused by:
  process didn't exit successfully: `/Users/tejasvijay/Desktop/MyRepos/others/substrate-node-template/target/release/build/wasmtime-runtime-94ad595a23608fc4/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-changed=src/helpers.c
  TARGET = Some("x86_64-apple-darwin")
  OPT_LEVEL = Some("3")
  HOST = Some("x86_64-apple-darwin")
  CC_x86_64-apple-darwin = None
  CC_x86_64_apple_darwin = None
  HOST_CC = None
  CC = Some("x86_64-apple-darwin13.4.0-clang")
  CFLAGS_x86_64-apple-darwin = None
  CFLAGS_x86_64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = Some("-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe")
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  running: "x86_64-apple-darwin13.4.0-clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-Wall" "-Wextra" "-DCFG_TARGET_OS_macos" "-o" "/Users/tejasvijay/Desktop/MyRepos/others/substrate-node-template/target/release/build/wasmtime-runtime-0c7a2181a8140e90/out/src/helpers.o" "-c" "src/helpers.c"
  cargo:warning=src/helpers.c:1:10: fatal error: 'setjmp.h' file not found
  cargo:warning=#include <setjmp.h>
  cargo:warning=         ^~~~~~~~~~
  cargo:warning=1 error generated.
  exit status: 1

  --- stderr


  error occurred: Command "x86_64-apple-darwin13.4.0-clang" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "--target=x86_64-apple-darwin" "-march=core2" "-mtune=haswell" "-mssse3" "-ftree-vectorize" "-fPIC" "-fPIE" "-fstack-protector-strong" "-O2" "-pipe" "-Wall" "-Wextra" "-DCFG_TARGET_OS_macos" "-o" "/Users/tejasvijay/Desktop/MyRepos/others/substrate-node-template/target/release/build/wasmtime-runtime-0c7a2181a8140e90/out/src/helpers.o" "-c" "src/helpers.c" with args "x86_64-apple-darwin13.4.0-clang" did not execute successfully (status code exit status: 1).


warning: build failed, waiting for other jobs to finish...
The following warnings were emitted during compilation:

warning: In file included from zstd/lib/common/entropy_common.c:18:
warning: In file included from zstd/lib/common/mem.h:24:
warning: zstd/lib/common/zstd_deps.h:29:10: fatal error: 'string.h' file not found
warning: #include <string.h>
warning:          ^~~~~~~~~~
warning: 1 error generated.
warning: In file included from zstd/lib/common/fse_decompress.c:20:
warning: In file included from zstd/lib/common/bitstream.h:29:
warning: In file included from zstd/lib/common/mem.h:24:
warning: zstd/lib/common/zstd_deps.h:29:10: fatal error: 'string.h' file not found
warning: #include <string.h>
warning:          ^~~~~~~~~~
warning: 1 error generated.

The following warnings were emitted during compilation:

warning: In file included from zstd/lib/common/entropy_common.c:18:
warning: In file included from zstd/lib/common/mem.h:24:
warning: zstd/lib/common/zstd_deps.h:29:10: fatal error: 'string.h' file not found
warning: #include <string.h>
warning:          ^~~~~~~~~~
warning: 1 error generated.
warning: In file included from zstd/lib/common/fse_decompress.c:20:
warning: In file included from zstd/lib/common/bitstream.h:29:
warning: In file included from zstd/lib/common/mem.h:24:
warning: zstd/lib/common/zstd_deps.h:29:10: fatal error: 'string.h' file not found
warning: #include <string.h>
warning:          ^~~~~~~~~~
warning: 1 error generated.

error: build failed

我不确定为什么会这样。 我也无法覆盖 Cargo.toml 文件中的包,因为它不接受 [dependencies] 标记。

有没有办法解决这个问题?

谢谢。

【问题讨论】:

  • 使用环境变量设置 WASM 后,$ WASM_BUILD_TOOLCHAIN=nightly-2020-10-05 cargo build --release。仍然出现构建错误,error: failed to run custom build command for 'ring v0.16.20'

标签: rust rust-cargo substrate rust-wasm


【解决方案1】:

我能够使用 conda 环境运行构建。

在 conda 中创建一个环境为 $ conda create -c conda-forge -n rustenv rust

然后使用$ conda activate rustenv激活它

如果其他人面临类似问题,只需回答这个问题。在基础环境中构建仍然失败。任何其他答案也会有所帮助。

【讨论】:

  • 很高兴为您工作。我讨厌 conda 的热情 - 恕我直言,nix 做得更好。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-12-20
  • 1970-01-01
  • 2018-11-21
相关资源
最近更新 更多