Version
- Node.js
v26.5.0 (Windows x64)
process.config.variables: clang=1, enable_thin_lto=true, enable_lto=false, llvm_version=19.1.5
- node-gyp
12.4.0
- Visual Studio 2026 Insiders / MSVC (
cl / link.exe)
What goes wrong
Building a native addon with node-gyp rebuild on this Node binary injects Clang/lld thin-LTO flags into the MSVC project:
- compiler:
-flto=thin (MSVC warns D9002 and ignores)
- linker:
/opt:lldltojobs=2 → LINK : fatal error LNK1117: 选项“opt:lldltojobs=2”中的语法错误
Reproduced while installing @stoprocent/bluetooth-hci-socket@2.2.6 (dependency of @stoprocent/noble / @stoprocent/bleno). The package binding.gyp does not set these flags; they come from Node’s common.gypi LTO conditions once enable_thin_lto is true in the generated build/config.gypi.
Generated addon config.gypi snippet from the failed build:
"clang": 0,
"enable_lto": "false",
"enable_thin_lto": "true",
"lto_jobs": "2",
So the addon build is treated as non-clang MSVC (clang: 0) while still enabling thin LTO options that only make sense for lld.
Expected
Addon builds on Windows with MSVC should not inherit enable_thin_lto / lld-only linker options from the Node binary’s process config when the toolchain is MSVC.
Either:
- Official Windows Node builds that still use MSVC for addons should ship
enable_thin_lto=false in the config that node-gyp copies, or
common.gypi should gate -flto=thin / /opt:lldltojobs=… on clang==1 (and/or an lld linker), not only on enable_thin_lto.
Impact (downstream)
- Deno/
npm installs of optional BLE stacks fail hard on Windows under Node 26.5.0.
@steve02081504/fount-p2p documents whitelisting only node-datachannel scripts under Deno to avoid pulling these optional builds.
When fixed: re-test npm rebuild @stoprocent/bluetooth-hci-socket (and Deno --allow-scripts for noble/bleno) on Windows Node 26+.
Version
v26.5.0(Windows x64)process.config.variables:clang=1,enable_thin_lto=true,enable_lto=false,llvm_version=19.1.512.4.0cl/link.exe)What goes wrong
Building a native addon with
node-gyp rebuildon this Node binary injects Clang/lld thin-LTO flags into the MSVC project:-flto=thin(MSVC warnsD9002and ignores)/opt:lldltojobs=2→LINK : fatal error LNK1117: 选项“opt:lldltojobs=2”中的语法错误Reproduced while installing
@stoprocent/bluetooth-hci-socket@2.2.6(dependency of@stoprocent/noble/@stoprocent/bleno). The packagebinding.gypdoes not set these flags; they come from Node’scommon.gypiLTO conditions onceenable_thin_ltois true in the generatedbuild/config.gypi.Generated addon
config.gypisnippet from the failed build:So the addon build is treated as non-clang MSVC (
clang: 0) while still enabling thin LTO options that only make sense for lld.Expected
Addon builds on Windows with MSVC should not inherit
enable_thin_lto/ lld-only linker options from the Node binary’s process config when the toolchain is MSVC.Either:
enable_thin_lto=falsein the config that node-gyp copies, orcommon.gypishould gate-flto=thin//opt:lldltojobs=…onclang==1(and/or an lld linker), not only onenable_thin_lto.Impact (downstream)
npminstalls of optional BLE stacks fail hard on Windows under Node 26.5.0.@steve02081504/fount-p2pdocuments whitelisting onlynode-datachannelscripts under Deno to avoid pulling these optional builds.When fixed: re-test
npm rebuild @stoprocent/bluetooth-hci-socket(and Deno--allow-scriptsfor noble/bleno) on Windows Node 26+.