paritytech / srtool

A fork of chevdor's srtool
MIT License
65 stars 18 forks source link

Error Message `No such file or directory` #33

Closed boundless-forest closed 2 years ago

boundless-forest commented 2 years ago

Error Report in the build process:

$ srtool build --package pangoro-runtime --profile release
Found 1.56.1, we will be using paritytech/srtool:1.56.1 for the build
_____________________________________________________________________________________

  You are using srtool v0.9.18. A newer version: v is now available.
  You should upgrade asap with the following command:
    docker images | grep srtool | awk '{ print $3 }' | xargs docker rmi --force
_____________________________________________________________________________________
🧰 Substrate Runtime Toolbox - srtool v0.9.18 🧰
              - by Chevdor -
info: using existing install for '1.56.1-x86_64-unknown-linux-gnu'
info: override toolchain for '/build' set to '1.56.1-x86_64-unknown-linux-gnu'

  1.56.1-x86_64-unknown-linux-gnu unchanged - rustc 1.56.1 (59eed8a2a 2021-11-01)

🏗  Building pangoro-runtime as release using rustc 1.56.1 (59eed8a2a 2021-11-01)
⏳ That can take a little while, be patient... subsequent builds will be faster.
   Since you have to wait a little, you may want to learn more about Substrate runtimes:
   https://docs.substrate.io/v3/getting-started/architecture/
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
!!! The PACKAGE 'pangoro-runtime' does not match the crate name at 'runtime/pangoro'. Did you mean ''?

Looks like the reason is our crate name does not match "xxx-runtime"? How can I fix this case?

chevdor commented 2 years ago

Hello @AsceticBear,

srtoolactually hints what the issue is:

!!! The PACKAGE 'pangoro-runtime' does not match the crate name at 'runtime/pangoro'

As you see, srtool makes the assumption that your runtime lives in runtime/pangoro but that's not the case.

You need to:

You may also check srtool build --help for more details:

srtool-build 0.7.1
chevdor <chevdor@gmail.com>
Start a new srtool container to build your runtime

USAGE:
    srtool build [FLAGS] [OPTIONS] --package <package> [path]

ARGS:
    <path>    By default, srtool will work in the current folder. If your project is located in
              another location, you can pass it here [default: .]

...
    -r, --runtime-dir <runtime-dir>
            If your runtime is not in the standard location runtime/<chain_name> you can pass this
            args to help srtool find it [env: RUNTIME_DIR=]   

The following will work for you:

srtool build --package pangoro-runtime --runtime-dir node/runtime/pangoro

I am closing this issue since I tested the solution, feel free to re-open if you still run into troubles.