ninja-build / ninja

a small build system with a focus on speed

Home Page:https://ninja-build.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"ninja: build stopped: subcommand failed." - which subcommand ? No clue in log.

JVD66 opened this issue · comments

Please, improve ninja to say WHAT subcommand failed ; simply exiting with
"ninja: build stopped: subcommand failed."
is useless - it doesn't tell people WHAT failed.

My log file, for a GCC build, shows NO error messages from GCC, so I'm stuck.

I have to run the whole build with 'strace -s8192 -f -e trace=execve' and tediously
analyse this log to find which sub-processes / commands have failed.

This is unacceptable - I'd recommend converting projects from ninja use to plain GNU Make
use or CMake use because of this issue (and many others).

You may be misunderstood. Ninja already prints the subcommand which failed before this message (as well as the combined stdout + stderr of that command). You can verify that by writing the following to a build.ninja file the invoking Ninja in the same directory:

rule foo
  command = echo "to_stdout"; echo >&2 "to_stderr"; exit 1

build out: foo

You will get:

[1/1] echo "to_stdout"; echo >&2 "to_stderr"; exit 1
FAILED: out 
echo "to_stdout"; echo >&2 "to_stderr"; exit 1
to_stdout
to_stderr
ninja: build stopped: subcommand failed.

However, the failed command + its outputs are sent to stderr, while the "ninja: build stopped: subcommand failed" message is sent to stdout.

Did you redirect stderr to a different file before invoking Ninja? That would explain what you're are seeing.