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_18: fix build with clang 16 #263847

Merged
merged 2 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
];
}