简体   繁体   中英

Substrate node template build failed (using macbook pro)

I am trying to create my first substrate chain . My OS is macOS Monterey v12.1 (recently updated)

This is the error that i am getting after running $ 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

I am not sure why this is happening. Also i am not able to override the package in Cargo.toml file as its not accepting [dependencies] tag.

Is there any way to fix this issue?

Thank you.

I was able to run the build using conda environment.

Create an environment in conda as $ conda create -c conda-forge -n rustenv rust

Then activate it using $ conda activate rustenv

Just answering this if anyone else is facing a similar issue. The build still fails on base environment. Any other answer will also be helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM