Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node 18.20.0 build failure #52230

Closed
chenrui333 opened this issue Mar 27, 2024 · 9 comments · Fixed by #53028
Closed

node 18.20.0 build failure #52230

chenrui333 opened this issue Mar 27, 2024 · 9 comments · Fixed by #53028
Labels
build Issues and PRs related to build files or the CI. macos Issues and PRs related to the macOS platform / OSX. v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.

Comments

@chenrui333
Copy link

While trying to upgrade node@18 to 18.20.0, but run into some build issue. The error log is as below:

error build log
  clang++ -o /private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/instruction-selector.o ../deps/v8/src/compiler/backend/instruction-selector.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_CERT_STORE' '-DICU_NO_USER_DATA_OVERRIDE' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D_DARWIN_USE_64_BIT_INODE=1' '-DV8_TARGET_ARCH_ARM64' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_MACOS' '-DV8_EMBEDDER_STRING="-node.36"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DOBJECT_PRINT' '-DV8_INTL_SUPPORT' '-DV8_ATOMIC_OBJECT_FIELD_WRITES' '-DV8_ENABLE_LAZY_SOURCE_POSITIONS' '-DV8_USE_SIPHASH' '-DV8_SHARED_RO_HEAP' '-DV8_WIN64_UNWINDING_INFO' '-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH' '-DV8_ENABLE_SYSTEM_INSTRUMENTATION' '-DV8_ENABLE_WEBASSEMBLY' '-DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS' '-DV8_ALLOCATION_FOLDING' '-DV8_ALLOCATION_SITE_TRACKING' '-DV8_SCRIPTORMODULE_LEGACY_LIFETIME' '-DV8_ADVANCED_BIGINT_ALGORITHMS' -I/opt/homebrew/opt/libuv/include -I/opt/homebrew/opt/brotli/include -I/opt/homebrew/opt/c-ares/include -I/opt/homebrew/opt/libnghttp2/include -I/opt/homebrew/opt/openssl@3/include -I/opt/homebrew/Cellar/icu4c/74.2/include -I../deps/v8 -I../deps/v8/include -I/private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/obj/gen/generate-bytecode-output-root -I/private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/obj/gen  -O3 -gdwarf-2 -fstrict-aliasing -mmacosx-version-min=10.15 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++17 -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF /private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/.deps//private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/instruction-selector.o.d.raw   -c
In file included from ../deps/v8/src/compiler/backend/instruction-scheduler.cc:5:
In file included from ../deps/v8/src/compiler/backend/instruction-scheduler.h:10:
In file included from ../deps/v8/src/compiler/backend/instruction.h:13:
In file included from ../deps/v8/src/codegen/external-reference.h:9:
In file included from ../deps/v8/src/runtime/runtime.h:11:
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
  static constexpr T kMax = static_cast<T>(kNumValues - 1);
                            ^
In file included from ../deps/v8/src/compiler/backend/gap-resolver.cc:5:
In file included from ../deps/v8/src/compiler/backend/gap-resolver.h:8:
In file included from ../deps/v8/src/compiler/backend/instruction.h:13:
In file included from ../deps/v8/src/codegen/external-reference.h:9:
In file included from ../deps/v8/src/runtime/runtime.h:11:
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
  static constexpr T kMax = static_cast<T>(kNumValues - 1);
                            ^
In file included from ../deps/v8/src/compiler/backend/frame-elider.cc:5:
In file included from ../deps/v8/src/compiler/backend/frame-elider.h:8:
In file included from ../deps/v8/src/compiler/backend/instruction.h:13:
In file included from ../deps/v8/src/codegen/external-reference.h:9:
In file included from ../deps/v8/src/runtime/runtime.h:11:
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
  static constexpr T kMax = static_cast<T>(kNumValues - 1);
                            ^
In file included from ../deps/v8/src/compiler/backend/instruction-selector.cc:5:
In file included from ../deps/v8/src/compiler/backend/instruction-selector.h:12:
In file included from ../deps/v8/src/compiler/backend/instruction-scheduler.h:10:
In file included from ../deps/v8/src/compiler/backend/instruction.h:13:
In file included from ../deps/v8/src/codegen/external-reference.h:9:
In file included from ../deps/v8/src/runtime/runtime.h:11:
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
  static constexpr T kMax = static_cast<T>(kNumValues - 1);
                            ^
In file included from ../deps/v8/src/compiler/backend/code-generator.cc:5:
In file included from ../deps/v8/src/compiler/backend/code-generator.h:11:
In file included from ../deps/v8/src/codegen/macro-assembler.h:8:
In file included from ../deps/v8/src/codegen/turbo-assembler.h:12:
In file included from ../deps/v8/src/codegen/assembler-arch.h:8:
In file included from ../deps/v8/src/codegen/assembler.h:46:
In file included from ../deps/v8/src/codegen/external-reference.h:9:
In file included from ../deps/v8/src/runtime/runtime.h:11:
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
  static constexpr T kMax = static_cast<T>(kNumValues - 1);
                            ^
1 error generated.
make[1]: *** [/private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/gap-resolver.o] Error 1
make[1]: *** Waiting for unfinished jobs....
1 error generated.
make[1]: *** [/private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/frame-elider.o] Error 1
1 error generated.
make[1]: *** [/private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/instruction-scheduler.o] Error 1
1 error generated.
make[1]: *** [/private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/code-generator.o] Error 1
1 error generated.
make[1]: *** [/private/tmp/nodeA18-20240327-90442-vf33hl/node-v18.20.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/instruction-selector.o] Error 1
rm 57e357e133a048a6f02ea40bcd36a320c2e9472d.intermediate 3c837bd255f9ccaa7124ff49849546d57ec35e5c.intermediate 2fb651989b5c82eb660b2124481795c22232907f.intermediate
make: *** [node] Error 2

full build log, https://github.com/Homebrew/homebrew-core/actions/runs/8443780973/job/23130539115
relates to Homebrew/homebrew-core#167236

@richardlau
Copy link
Member

I presume that will be related to one of the V8 commits in https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V18.md#commits.
FWIW we didn't see those failures on the Node.js CI so I don't know if Homebrew is building Node.js differently.

@LijieZhang1998
Copy link

I also got the same error to build 16.20.1 version on macOS today. Any solution about it? Thanks.

@VoltrexKeyva VoltrexKeyva added the build Issues and PRs related to build files or the CI. label Mar 27, 2024
@chenrui333
Copy link
Author

FWIW we didn't see those failures on the Node.js CI so I don't know if Homebrew is building Node.js differently.

it is not happening for all node 18.20.0 builds, so I think it might be also xcode sdk related.

@richardlau richardlau added the macos Issues and PRs related to the macOS platform / OSX. label Mar 28, 2024
@blair
Copy link

blair commented Mar 28, 2024

I'm also seeing in MacPorts' upgrade of the nodes18 port:

  /usr/bin/clang++ -o /opt/local/var/macports/build/macports-ports.git_devel_nodejs18/nodejs18/work/node-v18.20.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/register-allocator.o ../deps/v8/src/compiler/backend/register-allocator.cc '-D_GLIBCXX_USE_CXX11_ABI=1' '-DNODE_OPENSSL_CONF_NAME=nodejs_conf' '-DNODE_OPENSSL_HAS_QUIC' '-DICU_NO_USER_DATA_OVERRIDE' '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=64' '-D_DARWIN_USE_64_BIT_INODE=1' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DV8_TARGET_ARCH_ARM64' '-DV8_HAVE_TARGET_OS' '-DV8_TARGET_OS_MACOS' '-DV8_EMBEDDER_STRING="-node.36"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DOBJECT_PRINT' '-DV8_INTL_SUPPORT' '-DV8_ATOMIC_OBJECT_FIELD_WRITES' '-DV8_ENABLE_LAZY_SOURCE_POSITIONS' '-DV8_USE_SIPHASH' '-DV8_SHARED_RO_HEAP' '-DV8_WIN64_UNWINDING_INFO' '-DV8_ENABLE_REGEXP_INTERPRETER_THREADED_DISPATCH' '-DV8_ENABLE_SYSTEM_INSTRUMENTATION' '-DV8_ENABLE_WEBASSEMBLY' '-DV8_ENABLE_JAVASCRIPT_PROMISE_HOOKS' '-DV8_ALLOCATION_FOLDING' '-DV8_ALLOCATION_SITE_TRACKING' '-DV8_SCRIPTORMODULE_LEGACY_LIFETIME' '-DV8_ADVANCED_BIGINT_ALGORITHMS' -I/opt/local/var/macports/build/_Users_blair_Code_MacPorts_macports-ports.git_devel_nodejs18/nodejs18/work/zlib-inc -I../deps/v8 -I../deps/v8/include -I/opt/local/var/macports/build/_Users_blair_Code_MacPorts_macports-ports.git_devel_nodejs18/nodejs18/work/node-v18.20.0/out/Release/obj/gen/generate-bytecode-output-root -I/opt/local/var/macports/build/_Users_blair_Code_MacPorts_macports-ports.git_devel_nodejs18/nodejs18/work/node-v18.20.0/out/Release/obj/gen  -O3 -gdwarf-2 -fstrict-aliasing -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++17 -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF /opt/local/var/macports/build/_Users_blair_Code_MacPorts_macports-ports.git_devel_nodejs18/nodejs18/work/node-v18.20.0/out/Release/.deps//opt/local/var/macports/build/_Users_blair_Code_MacPorts_macports-ports.git_devel_nodejs18/nodejs18/work/node-v18.20.0/out/Release/obj.target/v8_compiler/deps/v8/src/compiler/backend/register-allocator.o.d.raw -I/opt/local/include -Os -stdlib=libc++ -I/opt/local/include -c
In file included from ../deps/v8/src/compiler/backend/gap-resolver.cc:5:
In file included from ../deps/v8/src/compiler/backend/gap-resolver.h:8:
In file included from ../deps/v8/src/compiler/backend/instruction.h:13:
In file included from ../deps/v8/src/codegen/external-reference.h:9:
In file included from ../deps/v8/src/runtime/runtime.h:11:
../deps/v8/src/base/bit-field.h:43:29: error: integer value 31 is outside the valid range of values [0, 15] for this enumeration type [-Wenum-constexpr-conversion]
  static constexpr T kMax = static_cast<T>(kNumValues - 1);
                            ^

This is with

$ clang++ --version
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

@LijieZhang1998
Copy link

One workaround is adding -Wno-enum-constexpr-conversion warning flag to mac OS in common.gypi. It build successfully. But I'm not sure of its impact.

@Bo98
Copy link

Bo98 commented Mar 29, 2024

Relevant commit to backport might be v8/v8@d15d49b

richardlau pushed a commit that referenced this issue Apr 17, 2024
Original commit message:

    Make bitfields only as wide as necessary for enums

    clang now complains when a BitField for an enum is too wide.
    We could suppress this, but it seems kind of useful from an
    uninformed distance, so I made a few bitfields smaller instead.

    (For AddressingMode, since its size is target-dependent, I added
    an explicit underlying type to the enum instead, which suppresses
    the diag on a per-enum basis.)

    This is without any understanding of the code I'm touching.
    Especially the change in v8-internal.h feels a bit risky to me.

    Bug: chromium:1348574
    Change-Id: I73395de593045036b72dadf4e3147b5f7e13c958
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3794708
    Commit-Queue: Nico Weber <[email protected]>
    Reviewed-by: Leszek Swirski <[email protected]>
    Reviewed-by: Hannes Payer <[email protected]>
    Auto-Submit: Nico Weber <[email protected]>
    Cr-Commit-Position: refs/heads/main@{#82109}

Refs: v8/v8@d15d49b
PR-URL: #52337
Fixes: #52230
Reviewed-By: Rafael Gonzaga <[email protected]>
@richardlau richardlau linked a pull request May 16, 2024 that will close this issue
@richardlau
Copy link
Member

This should be fixed in Node.js 18.20.3.

@richardlau richardlau added the v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch. label May 21, 2024
@Bo98
Copy link

Bo98 commented Jun 5, 2024

That compiler option is planned to be removed in the next version of LLVM Clang so I strongly recommend planning to update to at least 18.20.3 when possible.

For 16.x and earlier you may need to patch v8 in the future. The patch from 18.x is a good starting point but it may need modifying to be correct on earlier versions (please always check make jstest at least). There were differences between 18.x and 20.x, so differences to 16.x and earlier are easily possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. macos Issues and PRs related to the macOS platform / OSX. v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants
@blair @Bo98 @chenrui333 @richardlau @VoltrexKeyva @LijieZhang1998 and others