Skip to content

nodejs can't be built with python3 and ninja #32170

@dylanaraps

Description

@dylanaraps
  • Node Version: v13.10.1
  • Platform: Linux KISS 5.5.6-cat Make 0.6.x work node-gyp#1 SMP Mon Feb 24 18:18:34 EET 2020 x86_64 GNU/Linux
  • Compiler:
Using built-in specs.
COLLECT_GCC=/usr/bin/cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-musl/10.0.1/lto-wrapper
Target: x86_64-pc-linux-musl
Configured with: ../gcc/configure --prefix=/usr --disable-multilib --disable-symvers --disable-libmpx --disable-libmudflap --disable-libsanitizer --disable-werror --disable-fixed-point --disable-libstdcxx-pch --disable-nls --without-included-gettext --enable-checking=release --mandir=/usr/share/man --infodir=/usr/share/info --with-system-zlib --enable-__cxa_atexit --enable-default-pie --enable-default-ssp --enable-shared --enable-threads --enable-tls --enable-languages=c,c++ --build=x86_64-pc-linux-musl --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.1 20200301 (experimental) (GCC)
  • Module: nodejs

Nodejs fails to build with Python3 when using '--ninja'.

Node.js configure: Found Python 3.8.2...
INFO: configure completed successfully
ninja: invalid pool depth '1.4507365226745605'

It seems as though there's a missing Python 3 fix in node-gyp. Here's a patch to fix the issue:

diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py
index d5006bf84a..33e1c98b2a 100644
--- a/tools/gyp/pylib/gyp/generator/ninja.py
+++ b/tools/gyp/pylib/gyp/generator/ninja.py
@@ -1786,7 +1786,7 @@ def GetDefaultConcurrentLinks():
           if not match:
             continue
           # Allow 8Gb per link on Linux because Gold is quite memory hungry
-          return max(1, int(match.group(1)) / (8 * (2 ** 20)))
+          return max(1, int(match.group(1)) // (8 * (2 ** 20)))
     return 1
   elif sys.platform == 'darwin':
     try:

More information here: kisslinux/repo#167 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    gypIssues and PRs related to the GYP tool and .gyp build files

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions