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

nodejs-22/22.12.0 package update #35767

Merged
merged 4 commits into from
Dec 23, 2024

Conversation

octo-sts[bot]
Copy link
Contributor

@octo-sts octo-sts bot commented Dec 3, 2024

A recent fix was added to our node-16 package as part of this PR:

Believe this should also fix the build error here, so i've ported over the change


@octo-sts octo-sts bot added request-version-update request for a newer version of a package automated pr labels Dec 3, 2024
Copy link
Contributor Author

octo-sts bot commented Dec 3, 2024

Gen AI suggestions to solve the build error:

• Detected Error: Template-id related C++20 compatibility warnings leading to build failure:

warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor]

• Error Category: Build Configuration

• Failure Point: V8 engine compilation during Node.js build process

• Root Cause Analysis: The build is failing due to C++20 compatibility issues in V8's template usage, specifically in the object-macros.h and fixed-array.h files. The compiler is treating template-id syntax in constructors as errors under C++20 standards.

• Suggested Fix:
Add C++ standard version flag to force C++17 in the configure/build step:

  - name: Configure and build
    runs: |
      export CXXFLAGS="${CXXFLAGS} -std=c++17"
      # Rest of the existing configure and build commands...

• Explanation:

  • Node.js 22.x uses V8 engine code that was written targeting C++17
  • The build environment is defaulting to C++20 which has stricter rules about template-ids in constructors
  • Forcing C++17 standard will maintain compatibility with V8's code patterns
  • This is a known issue when building newer Node.js versions with newer compiler versions

• Additional Notes:

  • This is a temporary workaround until V8 updates its codebase for C++20 compatibility
  • The warnings are coming from V8's internal object system implementation
  • The fix doesn't impact Node.js functionality or performance
  • Alternative would be to patch V8 source, but using C++17 is simpler and safer

• References:

@mamccorm mamccorm force-pushed the wolfictl-7f814573-1816-4693-9a4b-083ddb595954 branch from e792b8e to 8910678 Compare December 12, 2024 01:30
Copy link
Contributor Author

octo-sts bot commented Dec 12, 2024

Gen AI suggestions to solve the build error:

• Detected Error: Template-id warnings and compilation failure in V8's object macros:

warning: template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor]

• Error Category: Build Configuration/Compiler

• Failure Point: V8 compilation during Node.js build process

• Root Cause Analysis:
The error occurs because V8's code uses template constructor syntax that's no longer allowed in C++20. This is a known issue with newer GCC versions that enforce stricter C++20 compliance.

• Suggested Fix:
Add compiler flags to force C++17 mode by modifying the configure/build step:

  - name: Configure and build
    runs: |
      export CXXFLAGS="${CXXFLAGS} -std=c++17"
      export CFLAGS="${CFLAGS/-Os/-O2} $common_flags"
      export CXXFLAGS="${CXXFLAGS/-Os/-O2} $common_flags"
      # Rest of the existing configure command...

• Explanation:

  • V8's codebase was written targeting C++17
  • GCC 13+ defaults to C++20 which deprecates certain template syntax
  • Forcing C++17 mode allows the code to compile with the original syntax
  • This is a temporary fix until V8 updates their codebase for C++20 compatibility

• Additional Notes:

  • This is a common issue when building Node.js 22.x with newer GCC versions
  • The fix maintains compatibility while not affecting runtime performance
  • Alternative would be to patch V8 source directly, but using compiler flags is less invasive

• References:

Signed-off-by: wolfi-bot <121097084+wolfi-bot@users.noreply.github.com>
@mamccorm mamccorm force-pushed the wolfictl-7f814573-1816-4693-9a4b-083ddb595954 branch from 8910678 to 9ef38ab Compare December 12, 2024 23:17
Copy link
Contributor Author

octo-sts bot commented Dec 12, 2024

Gen AI suggestions to solve the build error:

• Detected Error: Template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor]

• Error Category: Build Configuration

• Failure Point: V8 engine compilation during Node.js build process

• Root Cause Analysis: The error occurs because the V8 engine's code uses template constructor syntax that's no longer allowed in C++20. This is a compatibility issue between the V8 codebase and newer C++ standards.

• Suggested Fix: Add the following to the "Configure and build" step to force using C++17:

export CXXFLAGS="${CXXFLAGS} -std=c++17"

Modified section should look like:

  - name: Configure and build
    runs: |
      # Add defines recommended in libuv readme.
      common_flags="-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64"

      # Force C++17 to avoid C++20 template constructor issues
      export CXXFLAGS="${CXXFLAGS} -std=c++17"

      # Existing optimization flags
      export CFLAGS="${CFLAGS/-Os/-O2} $common_flags"
      export CXXFLAGS="${CXXFLAGS/-Os/-O2} $common_flags"
      export CPPFLAGS="${CPPFLAGS/-Os/-O2} $common_flags"

• Explanation: The V8 engine's codebase uses template constructor syntax that was deprecated and removed in C++20. By explicitly setting the C++ standard to C++17, we avoid these compatibility issues while maintaining functionality. This is a known issue with V8 when building with newer compiler versions that default to C++20.

• Additional Notes:

  • This is a temporary fix until V8 updates their codebase to be C++20 compatible
  • The fix doesn't impact functionality or performance
  • Alternative would be to patch V8 source directly, but using C++17 is simpler

• References:

Signed-off-by: Mark McCormick <mark.mccormick@chainguard.dev>
Copy link
Contributor Author

octo-sts bot commented Dec 13, 2024

Gen AI suggestions to solve the build error:

• Detected Error: Template-id not allowed for constructor in C++20 [-Wtemplate-id-cdtor]

• Error Category: Build Configuration

• Failure Point: V8 compilation during Node.js build process

• Root Cause Analysis: The error occurs because V8's code uses template constructor syntax that's no longer allowed in C++20. This is a compatibility issue between V8's codebase and newer C++ standards.

• Suggested Fix: Add the following to the "Configure and build" step, before the python3 configure.py command:

export CXXFLAGS="$CXXFLAGS -std=gnu++17"

• Explanation:

  • The error occurs because the build is defaulting to C++20 standard
  • Node.js v22.12.0's V8 engine contains code that isn't compatible with C++20's stricter template rules
  • Forcing GNU C++17 standard will allow the code to compile as it was originally designed
  • This matches the existing sed command that changes gnu++14 to gnu++17 in common.gypi

• Additional Notes:

  • This is a known issue with V8 when building with newer GCC versions that default to C++20
  • The fix ensures consistency with the C++ standard throughout the build
  • Alternative approach would be to patch V8 source, but using C++17 is simpler and maintains upstream compatibility

• References:

Signed-off-by: Debasish Biswas <debasishbsws.dev@gmail.com>
@debasishbsws debasishbsws self-assigned this Dec 23, 2024
@octo-sts octo-sts bot added the bincapz/pass bincapz/pass Bincapz (aka. malcontent) scan didn't detect any CRITICALs on the scanned packages. label Dec 23, 2024
…e code, nodejs-22 already using gnu++17

Signed-off-by: Debasish Biswas <debasishbsws.dev@gmail.com>
@cpanato cpanato merged commit b872b2d into main Dec 23, 2024
14 checks passed
@cpanato cpanato deleted the wolfictl-7f814573-1816-4693-9a4b-083ddb595954 branch December 23, 2024 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automated pr bincapz/pass bincapz/pass Bincapz (aka. malcontent) scan didn't detect any CRITICALs on the scanned packages. request-version-update request for a newer version of a package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants