I'm trying to build the latest substrate node template (without any modifications so far) and I'm getting the following error:

error: failed to run custom build command for `node-template-runtime v4.0.0-dev (/home/adam/substrate-node-template/runtime)`

Caused by:
  process didn't exit successfully: `/home/adam/substrate-node-template/target/release/build/node-template-runtime-ad88fbc205f4690c/build-script-build` (exit status: 1)
  --- stdout
  Information that should be included in a bug report.
  Executing build command: "rustup" "run" "nightly" "cargo" "rustc" "--target=wasm32-unknown-unknown" "--manifest-path=/home/adam/substrate-node-template/target/release/wbuild/node-template-runtime/Cargo.toml" "--color=always" "--profile" "release"
  Using rustc version: rustc 1.63.0-nightly (c35035cef 2022-05-30)


  error: could not write output to /home/adam/substrate-node-template/target/release/wbuild/node-template-runtime/target/wasm32-unknown-unknown/release/deps/node_template_runtime.pallet_transaction_payment_rpc_runtime_api-437328d54dff4516.pallet_transaction_payment_rpc_runtime_api.abf1d522-cgu.0.rcgu.o.rcgu.o: File name too long

  error: could not compile `node-template-runtime-wasm` due to previous error


$ git rev-parse HEAD
$ cargo -V
cargo 1.61.0 (a028ae4 2022-04-29)
$ rustc -V
rustc 1.61.0 (fe5b13d68 2022-05-18)
$ lsb_release -d
Description:    Ubuntu 22.04 LTS

1 Answer 1


Turned out it was caused by ecryptfs file name length limit which is only 143 characters (compared to 255 in most filesystems). I applied a (kinda ugly) workaround described here and mounted a new ext4 filesystem for the target directory.

$ df -Th
/home/adam/.Private ecryptfs  432G   34G  377G   9% /home/adam
/dev/loop18         ext4      9,8G  3,5G  5,8G  38% /home/adam/substrate-node-template/target
  • 1
    other options also could be: a) just moving project dir somewhere out of the home dir, or b) set build.target-dir to be some path outside your home dir Commented May 31, 2022 at 16:44

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.