Title: Windows Node 26 enable_thin_lto=true breaks MSVC native addon builds (lldltojobs / -flto=thin) · Issue #64674 · nodejs/node · GitHub
Open Graph Title: Windows Node 26 enable_thin_lto=true breaks MSVC native addon builds (lldltojobs / -flto=thin) · Issue #64674 · nodejs/node
X Title: Windows Node 26 enable_thin_lto=true breaks MSVC native addon builds (lldltojobs / -flto=thin) · Issue #64674 · nodejs/node
Description: 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 add...
Open Graph Description: 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.ex...
X Description: 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.ex...
Opengraph URL: https://github.com/nodejs/node/issues/64674
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Windows Node 26 enable_thin_lto=true breaks MSVC native addon builds (lldltojobs / -flto=thin)","articleBody":"### Version\n\n- Node.js `v26.5.0` (Windows x64)\n- `process.config.variables`: `clang=1`, `enable_thin_lto=true`, `enable_lto=false`, `llvm_version=19.1.5`\n- node-gyp `12.4.0`\n- Visual Studio 2026 Insiders / MSVC (`cl` / `link.exe`)\n\n### What goes wrong\n\nBuilding a native addon with `node-gyp rebuild` on this Node binary injects **Clang/lld thin-LTO flags** into the MSVC project:\n\n- compiler: `-flto=thin` (MSVC warns `D9002` and ignores)\n- linker: `/opt:lldltojobs=2` → **`LINK : fatal error LNK1117: 选项“opt:lldltojobs=2”中的语法错误`**\n\nReproduced 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`.\n\nGenerated addon `config.gypi` snippet from the failed build:\n\n```text\n\"clang\": 0,\n\"enable_lto\": \"false\",\n\"enable_thin_lto\": \"true\",\n\"lto_jobs\": \"2\",\n```\n\nSo the addon build is treated as **non-clang MSVC** (`clang: 0`) while still enabling thin LTO options that only make sense for lld.\n\n### Expected\n\nAddon 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.\n\nEither:\n\n1. Official Windows Node builds that still use MSVC for addons should ship `enable_thin_lto=false` in the config that node-gyp copies, or\n2. `common.gypi` should gate `-flto=thin` / `/opt:lldltojobs=…` on `clang==1` (and/or an lld linker), not only on `enable_thin_lto`.\n\n### Impact (downstream)\n\n- Deno/`npm` installs of optional BLE stacks fail hard on Windows under Node 26.5.0.\n- `@steve02081504/fount-p2p` documents whitelisting only `node-datachannel` scripts under Deno to avoid pulling these optional builds.\n\nWhen fixed: re-test `npm rebuild @stoprocent/bluetooth-hci-socket` (and Deno `--allow-scripts` for noble/bleno) on Windows Node 26+.\n","author":{"url":"https://github.com/steve02081504","@type":"Person","name":"steve02081504"},"datePublished":"2026-07-22T11:33:24Z","url":"https://github.com/nodejs/node/issues/64674"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0348db61-48ec-445a-29d0-983779a1617f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9A38:10572B:336ED5:42C3D1:6AED1DB8 |
| html-safe-nonce | 7660c9b0856c6ad9ae16fe82b027a2bb7e2cd708cf2a11341bcd829a96562bc8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTM4OjEwNTcyQjozMzZFRDU6NDJDM0QxOjZBRUQxREI4IiwidmlzaXRvcl9pZCI6IjQ2NTk5ODU1MzAyMTUwMTM4MTYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 92cf57461193bcd717010b0ce89005a0e3a0e62f523c8f1b4f4c7cdf954f0022 |
| hovercard-subject-tag | issue:4948454734 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/64674/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a29e826c1d1805cf58c8c3cc94cd497a60a273aaa5ece172d409050ce20bdad4/nodejs/node/issues/64674 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a29e826c1d1805cf58c8c3cc94cd497a60a273aaa5ece172d409050ce20bdad4/nodejs/node/issues/64674 |
| og:image:alt | 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.ex... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | steve02081504 |
| hostname | github.com |
| expected-hostname | github.com |
| None | e3e0f7f63e50c6fe879198a93a0a023a648ecc0a5e9bc3b5e033ac57172237e6 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 707a24b346ac8a82878b9c084efaa38a997660cb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width