1

First, I have looked at several previous posts regarding similar build errors but have yet to get the substrate template to build locally successfully. The exact error I encounter is:

error: failed to run custom build command for `librocksdb-sys v0.8.0+7.4.4`

Caused by:
  process didn't exit successfully: `/home/brandon/workspace/substrate-node-template/target/release/build/librocksdb-sys-c7956af65347884b/build-script-build` (exit status: 101)
  --- stderr
  thread 'main' panicked at '"enum_(unnamed_at_rocksdb/include/rocksdb/c_h_981_1)" is not a valid Ident', /home/brandon/.cargo/registry/src/GitHub.com-1ecc6299db9ec823/proc-macro2-1.0.47/src/fallback.rs:756:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

I do have clang and llvm installed. I have even compiled clang + llvm from sources and installed them on the computer in an attempt to make sure the build system should work. I have the librocksdb-dev package installed as well. I am running on Debian Sid and have followed all the steps in the Linux Development Environment guide.

The output of rustup +nightly show:

Default host: x86_64-unknown-Linux-gnu
rustup home:  /home/brandon/.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
----------------

nightly-x86_64-unknown-Linux-gnu (overridden by +toolchain on the command line)
rustic 1.67.0-nightly (b3bc6bf31 2022-11-24)

I noticed some people reported issues with the M1 processor; However, I am running a 12900K Intel Processor, so I doubt that is the issue.

I have entirely uninstalled librocksdb-dev llvm clang and even rust and then reinstalled them. I am unsure how to continue as I am brand new to the substrate platform.

5
  • 1
    Try to follow these steps (:docs.substrate.io/install/linux) closely and you should be good the go! Nov 25, 2022 at 15:36
  • To clarify, I have followed all the steps in that document. I uninstalled everything, removed everything, and then did each of those steps again, and I still have this same issue.
    – Brandon
    Nov 25, 2022 at 20:16
  • Is this still a problem? Its not something that the ecosystem is able to reproduce, since we would be hearing many more problems from the community.
    – Shawn Tabrizi
    Dec 1, 2022 at 15:46
  • 1
    Still an issue, I filed a bug report with rocksdb, I am not the only person encountering it according to the bug report. github.com/rust-rocksdb/rust-rocksdb/issues/713
    – Brandon
    Dec 4, 2022 at 4:41
  • use this command this works for me for exact same issue brew install openssl cmake llvm
    – go11li
    Feb 27, 2023 at 11:58

8 Answers 8

1

I have exactly the same error while building Substrate. The issue is not in Substrate, but rust-rocksdb.

More: https://github.com/rust-rocksdb/rust-rocksdb/issues/713

1
  • 1
    This is what it ended up being for me. I am marking this as solved, as the issue seems to have been fixed in the latest versions.
    – Brandon
    May 7, 2023 at 19:57
1

I recently came across this issue on a fresh Mac with an M2 chip.

After running the following commands, it seems to have been resolved:

  • cargo clean
  • cargo update
  • rustup update
1

What solved my problem related with build of frontier, but I believe that is related with librocksdb-sys too, was when I ran these commands which update system packages and add g++ that is a open source version of c++:

sudo apt-get update
sudo apt-get install g++

Full solution
https://stackoverflow.com/questions/66583720/some-error-failed-to-run-custom-build-command-for-librocksdb-sys-v6-11-4/76791499#76791499

0

That's an issue I came across in Windows 11. And turns out it might have something to do with your machine running out of RAM.

In my windows machine I was building projects using WSL and it was capped at 2,5GB to avoid WSL from allocating all the RAM for itself. When trying to build a substrate node, the process needed more RAM to compile large dependencies like librocksdb-sys and would exit with and error.

If anyone is running into this issue while using Windows, check the RAM cap of WSL.

0

had exactly the same problem with opensuse tumbleweed because of clang and llvm, you actually need an older version not a new one, try with installing v14 of clang and llvm

0

The error message "failed to run custom build command for librocksdb-sys" usually indicates that there is a problem with the RocksDB library or its dependencies. I had the same error while building Substrate, since I changed the linux distro it's done, for example in Fedora it works ok.

0

I ran into this error on M1 and was able to solve it by downgrading to clang 14 as suggested by @kevindong on GitHub

brew install llvm@14
export PATH="/opt/homebrew/opt/llvm@14/bin:$PATH" 
clang --version # Should return 14

See: https://github.com/rust-rocksdb/rust-rocksdb/issues/768#issuecomment-1767143727

0

I use wsl to build the node in release mode and get this error. I got over this issue by creating a file that is configured to act as a swap space for my system. Normally I do something like.

sudo allocate -l 4G /swapfile

Adjust the size according to your needs(not necessarily 4GB). File name need not be swapfile

sudo mkswap /swapfile
sudo swapon /swapfile

Now you can check the configured swapfile using

sudo swapon --show

Try building the node again.

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.