chore: bump nan to 2.23.0 (#48591)

* chore: bump nan to 2.23.0

* Fix C++ flags passed to C compiler in NAN spec runner

Passing C++-specific flags to the C compiler caused failures building native test modules.

NAN uprgaded the version of node-gyp it uses, triggering a new codepath with the C compiler that didn't occur before. In that new branch, the C++ flags present in the CFLAGS environment variable we were passing in caused the C compiler to error out:

```
error: invalid argument '-std=c++20' not allowed with 'C'
```

The fix is to only pass C++-specific flags to the C++ compiler, and not the C compiler. This is done by separating out the CFLAGS and CXXFLAGS environment variables in our nan-spec-runner.js script.

I'm curious to know more about why each of these flags are necessary, but for now this change restores the previous behavior where native test modules could be built successfully.

* test: use v8 version check instead of node version check (patch)

* Re-enable `methodswithdata-test`
This commit is contained in:
Calvin
2025-10-23 12:58:40 -06:00
committed by GitHub
parent 717eb0dca5
commit 418b8235bc
14 changed files with 90 additions and 566 deletions

View File

@@ -65,6 +65,12 @@ async function main () {
platformFlags.push(`-isysroot ${path.resolve(sdkPath, sdkToUse)}`);
}
const cflags = [
'-Wno-trigraphs',
'-fPIC',
...platformFlags
].join(' ');
const cxxflags = [
'-std=c++20',
'-Wno-trigraphs',
@@ -92,10 +98,10 @@ async function main () {
if (process.platform !== 'win32') {
env.CC = cc;
env.CFLAGS = cxxflags;
env.CFLAGS = cflags;
env.CXX = cxx;
env.LD = ld;
env.CXXFLAGS = cxxflags;
env.LD = ld;
env.LDFLAGS = ldflags;
}
@@ -129,9 +135,9 @@ async function main () {
const DISABLED_TESTS = new Set([
'nannew-test.js',
'buffer-test.js',
// we can't patch this test because it uses CRLF line endings
'methodswithdata-test.js',
// these two are incompatible with crrev.com/c/4733273
// These two are incompatible with crrev.com/c/4733273
// They are disabled upstream starting in "Node.js 24" (note: the incompatible change above
// landed in V8 v13.7), so we can remove them from this list once we upgrade Node.js to 24.
'weak-test.js',
'weak2-test.js'
]);