Skip to content

Commit

Permalink
nodejs_18: fix build with clang 16 mk2
Browse files Browse the repository at this point in the history
Trying to backport the fixes from v8 caused crashes with npm when
building other packages, so just build it with clang 15.
  • Loading branch information
reckenrode committed Oct 29, 2023
1 parent 81d2db9 commit b034e4c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion 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 Down

0 comments on commit b034e4c

Please sign in to comment.