buildchromiumninja

chromium checkout build: Could not find Ninja


Trying to build webview for android in the docker container from ubuntu 18.04.

Do everything according to instruction and last version is built okay with command:

autoninja -C out/Default system_webview_apk

But I need an older version. So I do:

git checkout 80.0.3987.99 -b 80-version

After that run sync:

gclient sync

And it also by default runs hooks after sync. Then again I start build with the same cmd:

autoninja -C out/Default system_webview_apk

But this time on checkout build it gives me error, which I can't fix for hours:

user@0bb1627b6f62:~/workdir/chromium/src$ autoninja -c out/Default/ system_webview_apk
depot_tools/ninja.py: Could not find Ninja in the third_party of the current project, nor in your PATH.
Please take a following action to install Ninja.
- If your project has DEPS, Add a CIPD Ninja dependency to DEPS.
- Otherwise, add Ninja to your PATH *after* depot_tools.

But when I switch again to the main branch, do sync, it is built fine!

What I do wrong? gn args runs okay in both cases.

On the main branch there is src/third_party/ninja/. On the checkout branch after gclient sync this folder disappears. Before sync autoninja run gives error unknown function because ninja's version doesn't correspond to the checkout version.


Solution

  • Well, it turned out that for some reason sync doesn't fetch ninja for my checkout even with gclient sync --with_branch_heads command. And I was confused by

    Ninja is included in depot_tools so there's nothing to install.

    from chromium docs. Moreover I thought that ninja version should correspond to my chromium checkout, but as far as I found out it concerns with gn tool only.

    So, my solution was just to add to my docker file

    apt install ninja-build
    

    and every checkout started to build with no problem.