Skip to content

Commit

Permalink
Merge #263847: nodejs_18: fix build with clang 16
Browse files Browse the repository at this point in the history
...into staging-next
  • Loading branch information
vcunat committed Oct 31, 2023
2 parents 6ccab17 + b034e4c commit 80d84b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 129 deletions.
126 changes: 0 additions & 126 deletions pkgs/development/web/nodejs/enum-width-fix-backport.patch

This file was deleted.

16 changes: 13 additions & 3 deletions pkgs/development/web/nodejs/v18.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{ callPackage, fetchpatch, openssl, python3, enableNpm ? true }:
{ callPackage, lib, overrideCC, pkgs, buildPackages, fetchpatch, openssl, python3, enableNpm ? true }:

let
# Clang 16+ cannot build Node v18 due to -Wenum-constexpr-conversion errors.
# Use an older version of clang with the current libc++ for compatibility (e.g., with icu).
ensureCompatibleCC = packages:
if packages.stdenv.cc.isClang && lib.versionAtLeast (lib.getVersion packages.stdenv.cc.cc) "16"
then overrideCC packages.llvmPackages_15.stdenv (packages.llvmPackages_15.stdenv.cc.override {
inherit (packages.llvmPackages) libcxx;
extraPackages = [ packages.llvmPackages.libcxxabi ];
})
else packages.stdenv;

buildNodejs = callPackage ./nodejs.nix {
inherit openssl;
stdenv = ensureCompatibleCC pkgs;
buildPackages = buildPackages // { stdenv = ensureCompatibleCC buildPackages; };
python = python3;
};
in
Expand All @@ -16,7 +28,5 @@ buildNodejs {
./revert-arm64-pointer-auth.patch
./node-npm-build-npm-package-logic.patch
./trap-handler-backport.patch
# Fix for enum width error when compiling with clang 16.
./enum-width-fix-backport.patch
];
}

0 comments on commit 80d84b4

Please sign in to comment.