GeezerVison is showing github.com — build: keep PGO settings out of addon builds by vmoroz · Pull Request #67638 · nodejs/node
Conversation
Node.js 26.13 Windows releases are built with PGO (profile-guided optimization). common.gypi adds the PGO compiler and linker flags to every target. node-gyp builds addons with the same common.gypi and the same settings that Node.js was built with, so on Windows every addon gets these flags too, even though they are meant only for building Node.js itself.
We hit this in the node-addon-api CI on Windows. MSVC does not know -fprofile-use, so every addon build prints warnings. Worse, the flag points to $(SolutionDir)node.profdata without quotes. When the addon path has a space, the flag is split in two and the build fails:
error C1083: Cannot open source file: 'addon\build\node.profdata'
node-addon-api worked around this by turning PGO off in its CI (nodejs/node-addon-api#1763), but other addons in such paths still fail to build.
This change:
- adds the PGO flags only when building Node.js itself (when
configuring_node is set), the same way the Linux PIE flags work;
- leaves the PGO flags for Node.js builds unchanged.
Because node-gyp takes common.gypi from the Node.js headers, the fix works with any node-gyp version once it is in a release.
Tested on Windows with Node.js 26.13.1: an addon in a folder with a space fails to build with the current common.gypi, and builds and loads with this change. Also compared the generated build settings for Linux, macOS, and Windows: Node.js builds get the same flags as before, and addons get no PGO flags. The full test suite was not run.
AI-assisted work. All changes reviewed by a human.
Refs: nodejs/node-addon-api#1763
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Gate PGO generation and use flags on configuring_node so native addons
do not inherit Node.js-specific profiling settings from process.config.
The inherited Windows profile-use option is unquoted and breaks addon
builds when their paths contain spaces.
Preserve Node.js PGO flags and the Windows host-toolset exclusion.
Expand configuring_node early for the Windows target condition.
Refs: nodejs/node-addon-api#1763
Signed-off-by: Vladimir Morozov <[email protected]>
Assisted-by: AI coding assistant
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Commit Queue failed
✖ 1 GitHub CI job(s) cancelled:
✖ - aarch64-darwin: with shared libraries / build: CANCELLED (https://github.com/nodejs/node/actions/runs/44688155601/job/136329546425)
The pull request was removed from the Commit Queue and labeled
commit-queue-failed
PRs whose Commit Queue landing failed and need manual intervention before retrying.
. After resolving the failure, remove that label and add
commit-queue
PRs queued for automated landing through the Commit Queue.
to retry.
Full Commit Queue output
�[36m⠋�[39m Loading data for nodejs/node/pull/67638
�[36m⠋�[39m Loading data for nodejs/node/pull/67638
�[36m⠋�[39m Getting collaborator contacts from README of nodejs/node
�[36m⠋�[39m Getting PR from nodejs/node/pull/67638
�[36m⠋�[39m Getting reviews from nodejs/node/pull/67638
�[36m⠋�[39m Getting comments from nodejs/node/pull/67638
�[36m⠋�[39m Getting commits from nodejs/node/pull/67638
✔ Done loading data for nodejs/node/pull/67638
----------------------------------- PR info ------------------------------------
Title build: keep PGO settings out of addon builds (#67638)
Author Vladimir Morozov <[email protected]> (@vmoroz)
Branch vmoroz:PR/fix-addon-pgo -> nodejs:main
Labels build, author ready, needs-ci, commit-queue
Commits 1
- build: keep PGO settings out of addon builds
Committers 1
- Vladimir Morozov <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/67638
Refs: https://github.com/nodejs/node-addon-api/pull/1763
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Gürgün Dayıoğlu <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/67638
Refs: https://github.com/nodejs/node-addon-api/pull/1763
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Gürgün Dayıoğlu <[email protected]>
--------------------------------------------------------------------------------
ℹ This PR was created on Fri, 20 Nov 2026 06:29:24 GMT
✔ Approvals: 3
✔ - Chengzhong Wu (@legendecas) (TSC): https://github.com/nodejs/node/pull/67638#pullrequestreview-5993765402
✔ - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/67638#pullrequestreview-6007773967
✔ - Gürgün Dayıoğlu (@gurgunday): https://github.com/nodejs/node/pull/67638#pullrequestreview-6008051224
✖ 1 GitHub CI job(s) cancelled:
✖ - aarch64-darwin: with shared libraries / build: CANCELLED (https://github.com/nodejs/node/actions/runs/44688155601/job/136329546425)
ℹ Last Full PR CI on 2026-11-20T14:08:12Z: https://ci.nodejs.org/job/node-test-pull-request/79353/
�[36m⠙�[39m Querying data for job/node-test-pull-request/79353/
�[36m⠙�[39m Querying data for job/node-test-pull-request/79353/
�[36m⠙�[39m Querying API for job/node-test-pull-request/79353/
✔ Build data downloaded
✔ Last Jenkins CI successful
--------------------------------------------------------------------------------
✔ Aborted `git node land` session in /home/runner/work/node/node/.ncu
View workflow run
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
aduh95
pushed a commit
that referenced
this pull request
Nov 24, 2026
Gate PGO generation and use flags on configuring_node so native addons
do not inherit Node.js-specific profiling settings from process.config.
The inherited Windows profile-use option is unquoted and breaks addon
builds when their paths contain spaces.
Preserve Node.js PGO flags and the Windows host-toolset exclusion.
Expand configuring_node early for the Windows target condition.
Refs: nodejs/node-addon-api#1763
Signed-off-by: Vladimir Morozov <[email protected]>
Assisted-by: AI coding assistant
PR-URL: #67638
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Gürgün Dayıoğlu <[email protected]>
Reviewed-By: Stefan Stojanovic <[email protected]>
gabylb
pushed a commit
to gabylb/node
that referenced
this pull request
Nov 27, 2026
Gate PGO generation and use flags on configuring_node so native addons
do not inherit Node.js-specific profiling settings from process.config.
The inherited Windows profile-use option is unquoted and breaks addon
builds when their paths contain spaces.
Preserve Node.js PGO flags and the Windows host-toolset exclusion.
Expand configuring_node early for the Windows target condition.
Refs: nodejs/node-addon-api#1763
Signed-off-by: Vladimir Morozov <[email protected]>
Assisted-by: AI coding assistant
PR-URL: nodejs#67638
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Gürgün Dayıoğlu <[email protected]>
Reviewed-By: Stefan Stojanovic <[email protected]>
Reviewers
lpinca
lpinca approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
author ready
PRs with CI started, the required approvals, and no outstanding review comments.
build
Issues and PRs related to Node.js builds or CI infrastructure.
needs-ci
PRs that need a full CI run.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|