The file 'build.ninja' is missing

I tried to ./run the anki, but fails with the following error:

~/ $ git clone https://github.com/ankitects/anki.git
~/ $ cd anki
~/anki (main)$ git checkout refs/tags/24.04.1
~/anki ((24.04.1))$ ./run
    ...
    Finished release [optimized] target(s) in 0.19s
thread 'main' panicked at build/runner/src/build.rs:82:39:
ninja not installed: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
~/anki ((24.04.1))$ ninja
ninja: error: loading 'build.ninja': No such file or directory

It seems the ninja command has failed to find the build.ninja file. How to find or generate it?

Have you tried with n2 instead? Do commands like ./ninja check work?

I really don’t know, just throwing out some ideas.

Thanks. I tried, but it also requires build.ninja.

$ n2 check
n2: error: read build.ninja: No such file or directory (os error 2)

What OS are you on?

For what it’s worth, none of n2 check, ./n2 check or ninja check work for me either, only ./ninja check

I use Ubuntu 22.04. Could you run the following to locate build.ninja in your environment?

$ find . -name 'build.ninja'

You must use ./ninja or ./run. The error in your original post implies that the ninja or n2 binary is not in the PATH when running bash, which is what ./ninja / ./run uses.

Hmm. ./ninja is available but fails with the same error. I also explicitly added the source directory to $PATH, but it does not help.

$ ./ninja 
    Finished release [optimized] target(s) in 0.14s
thread 'main' panicked at build/runner/src/build.rs:78:39:
ninja not installed: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It’s the system ninja binary that needs to be on the bash PATH.

It is on the PATH.

$ whereis ninja
ninja: /usr/bin/ninja /usr/share/man/man1/ninja.1.gz
$ ninja
ninja: error: loading 'build.ninja': No such file or directory

You’ll need to poke around run_build and figure out why the PATH used there doesn’t include ninja on your machine.

I inspected the environment variables of running ./run process and confirmed that /usr/bin is specified in PATH.