nodejs/build

Ansible `ninja : build Ninja` task fails

richardlau opened this issue · 2 comments

e.g.

TASK [ninja : build Ninja] **************************************************************************************************************************************************************************************
fatal: [test-ibm-rhel8-s390x-2]: FAILED! => {"changed": true, "cmd": "python3 ./configure.py --bootstrap && ./ninja ninja_test && ./ninja_test\n", "delta": "0:00:23.037460", "end": "2024-05-28 09:12:21.776035", "msg": "non-zero return code", "rc": 1, "start": "2024-05-28 09:11:58.738575", "stderr": "\u001b[01m\u001b[K./src/json.cc:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kstd::__cxx11::string EncodeJSONString(const string&)\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/json.cc:36:18:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kcomparison is always true due to limited range of data type [\u001b[01;35m\u001b[K-Wtype-limits\u001b[m\u001b[K]\n     else if (\u001b[01;35m\u001b[K0x0 <= c\u001b[m\u001b[K && c < 0x20) {\n              \u001b[01;35m\u001b[K~~~~^~~~\u001b[m\u001b[K\nninja: error: unknown target 'ninja_test'", "stderr_lines": ["\u001b[01m\u001b[K./src/json.cc:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kstd::__cxx11::string EncodeJSONString(const string&)\u001b[m\u001b[K’:", "\u001b[01m\u001b[K./src/json.cc:36:18:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kcomparison is always true due to limited range of data type [\u001b[01;35m\u001b[K-Wtype-limits\u001b[m\u001b[K]", "     else if (\u001b[01;35m\u001b[K0x0 <= c\u001b[m\u001b[K && c < 0x20) {", "              \u001b[01;35m\u001b[K~~~~^~~~\u001b[m\u001b[K", "ninja: error: unknown target 'ninja_test'"], "stdout": "[1/1] python3 ./configure.py \nwarning: A compatible version of re2c (>= 0.15.3) was not found; changes to src/*.in.cc will not affect your build.\nwrote build.ninja.\n[1/33] INLINE build/browse_py.h\n[2/33] CXX build/browse.o\n[3/33] CXX build/lexer.o\n[4/33] CXX build/debug_flags.o\n[5/33] CXX build/depfile_parser.o\n[6/33] CXX build/clparser.o\n[7/33] CXX build/clean.o\n[8/33] CXX build/disk_interface.o\n[9/33] CXX build/edit_distance.o\n[10/33] CXX build/build_log.o\n[11/33] CXX build/deps_log.o\n[12/33] CXX build/dyndep_parser.o\n[13/33] CXX build/graphviz.o\n[14/33] CXX build/json.o\nsrc/json.cc: In function ‘std::__cxx11::string EncodeJSONString(const string&)’:\nsrc/json.cc:36:18: warning: comparison is always true due to limited range of data type [-Wtype-limits]\n     else if (0x0 <= c && c < 0x20) {\n              ~~~~^~~~\n[15/33] CXX build/dyndep.o\n[16/33] CXX build/line_printer.o\n[17/33] CXX build/eval_env.o\n[18/33] CXX build/parser.o\n[19/33] CXX build/metrics.o\n[20/33] CXX build/graph.o\n[21/33] CXX build/missing_deps.o\n[22/33] CXX build/build.o\n[23/33] CXX build/string_piece_util.o\n[24/33] CXX build/status.o\n[25/33] CXX build/state.o\n[26/33] CXX build/manifest_parser.o\n[27/33] CXX build/version.o\n[28/33] CXX build/subprocess-posix.o\n[29/33] CXX build/util.o\n[30/33] AR build/libninja.a\n[31/33] CXX build/ninja.o\n[32/33] LINK ninja\nbootstrapping ninja...\nwarning: A compatible version of re2c (>= 0.15.3) was not found; changes to src/*.in.cc will not affect your build.\nwrote build.ninja.\nbootstrap complete.  rebuilding...", "stdout_lines": ["[1/1] python3 ./configure.py ", "warning: A compatible version of re2c (>= 0.15.3) was not found; changes to src/*.in.cc will not affect your build.", "wrote build.ninja.", "[1/33] INLINE build/browse_py.h", "[2/33] CXX build/browse.o", "[3/33] CXX build/lexer.o", "[4/33] CXX build/debug_flags.o", "[5/33] CXX build/depfile_parser.o", "[6/33] CXX build/clparser.o", "[7/33] CXX build/clean.o", "[8/33] CXX build/disk_interface.o", "[9/33] CXX build/edit_distance.o", "[10/33] CXX build/build_log.o", "[11/33] CXX build/deps_log.o", "[12/33] CXX build/dyndep_parser.o", "[13/33] CXX build/graphviz.o", "[14/33] CXX build/json.o", "src/json.cc: In function ‘std::__cxx11::string EncodeJSONString(const string&)’:", "src/json.cc:36:18: warning: comparison is always true due to limited range of data type [-Wtype-limits]", "     else if (0x0 <= c && c < 0x20) {", "              ~~~~^~~~", "[15/33] CXX build/dyndep.o", "[16/33] CXX build/line_printer.o", "[17/33] CXX build/eval_env.o", "[18/33] CXX build/parser.o", "[19/33] CXX build/metrics.o", "[20/33] CXX build/graph.o", "[21/33] CXX build/missing_deps.o", "[22/33] CXX build/build.o", "[23/33] CXX build/string_piece_util.o", "[24/33] CXX build/status.o", "[25/33] CXX build/state.o", "[26/33] CXX build/manifest_parser.o", "[27/33] CXX build/version.o", "[28/33] CXX build/subprocess-posix.o", "[29/33] CXX build/util.o", "[30/33] AR build/libninja.a", "[31/33] CXX build/ninja.o", "[32/33] LINK ninja", "bootstrapping ninja...", "warning: A compatible version of re2c (>= 0.15.3) was not found; changes to src/*.in.cc will not affect your build.", "wrote build.ninja.", "bootstrap complete.  rebuilding..."]}

I checked the machine and the ninja binary in /home/iojs/ninja/ninja runs and is of the expected version (currently 1.12.1). Rerunning the playbook passes.

As always the Ansible error output isn't formatted nicely, but the error seems to be:

ninja: error: unknown target 'ninja_test'

I'm leaning towards replacing recompiling ninja ourselves on rhel8-s390x and rhel8-ppc64le and instead using the ninja-build package from the OS.

On ubuntu2204 we do:

- name: install packages required to build V8
ansible.builtin.apt:
name: ['ninja-build', 'python3-httplib2']
state: present

For rhel8-x64 we do:

# ninja-build on RHEL 8 is in the CodeReady Linux Builder repository.
- name: enable codeready-builder repository
community.general.rhsm_repository:
name: codeready-builder-for-rhel-8-x86_64-rpms
state: enabled
# V8 builds still require Python 2.
- name: install packages required to build V8
ansible.builtin.dnf:
name: ['ninja-build', 'python2', 'python2-pip']
state: present
notify: package updated

For some history, ninja used to be part of depot_tools but was removed last year: #3206

As always the Ansible error output isn't formatted nicely, but the error seems to be:

ninja: error: unknown target 'ninja_test'

For reference, this is likely ninja-build/ninja#2447 and if we wanted to continue building ninja ourselves we would either need to pull down a separate source for GoogleTest to build ninja_test or to skip running ninja's tests.

I'll work on updating the playbooks to use the ninja-build package from the OS. I'd like to land #3736 first, otherwise there'll be conflicts in ansible/roles/build-test-v8/tasks/partials/rhel8-s390x.yml.