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

Enabling ClangCL compilation testing #55784

Closed
wants to merge 2 commits into from

Conversation

StefanStojanovic
Copy link
Contributor

This PR is a draft to discuss the changes needed to run test jobs in the CI for the ClangCL-produced binaries. It is not expected to land like this, just to discuss before opening production-ready PRs:

  1. Enforce MSVC to be used for node-gyp. As far as I can tell, this is the intended way of using node-gyp on Windows. The issue with running the native suites is that now we use Clang to compile Node.js, so config.variables.clang is set to 1, which makes node-gyp generate project files for ClangCL. While we'd like to enable this, that is currently not the priority so for now enforcing MSVC would be the way to go the way I see it. The changes in create-config-gypi.js would be done as a PR in node-gyp and then floated in Node.js until the next node-gyp update.
  2. Disable V8_PRESERVE_MOST on Windows. We already have something similar for V8_NODISCARD as a floating patch, so it should not be a problem as I see it. If left, this results in functions that use it having __swift_2 calling conventions rather than the expected __cdecl. This was noticed in cppgc-object native suites test. This change, if agreed upon, would be come one of our V8 floating patches we use on each V8 update.

Tagging relative teams/people: @nodejs/platform-windows @nodejs/node-gyp @targos

It's causing linker errors with node.lib in node-gyp and potentially
breaks other 3rd party tools
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/security-wg
  • @nodejs/v8-update

@nodejs-github-bot nodejs-github-bot added fast-track PRs that do not need to wait for 48 hours to land. needs-ci PRs that need a full CI run. npm Issues and PRs related to the npm client dependency or the npm registry. v8 engine Issues and PRs related to the V8 dependency. labels Nov 8, 2024

This comment was marked as off-topic.

@richardlau richardlau removed the fast-track PRs that do not need to wait for 48 hours to land. label Nov 8, 2024
@StefanStojanovic StefanStojanovic marked this pull request as ready for review November 20, 2024 13:36
@StefanStojanovic
Copy link
Contributor Author

FYI marked as ready for review so people do not consider it WIP and review it. Still not planning to land it like this, but I want to get the discussion started.

@targos
Copy link
Member

targos commented Nov 21, 2024

Changes SGTM

Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

StefanStojanovic added a commit to JaneaSystems/node-gyp that referenced this pull request Nov 25, 2024
Disables trying to compile with ClangCL on Windows. Was required to enable native tests in the Node.js CI for the ClangCL produced binaries.

Refs: nodejs/node#55784
@StefanStojanovic
Copy link
Contributor Author

Can someone who already approved this approve my PR in node-gyp with the changes already included here (I will port it to Node.js afterward so we do not wait for the next node-gyp release). The CI failures in that PR are not connected to that and the fix for that has landed in gyp-next.

Thanks in advance

StefanStojanovic added a commit to nodejs/node-gyp that referenced this pull request Nov 29, 2024
Disables trying to compile with ClangCL on Windows. Was required to enable native tests in the Node.js CI for the ClangCL produced binaries.

Refs: nodejs/node#55784
@StefanStojanovic
Copy link
Contributor Author

Can someone who already approved this approve my other PR with part of changes from here (the ones from node-gyp). Thanks in advance!

lukekarrys pushed a commit to nodejs/node-gyp that referenced this pull request Dec 2, 2024
Disables trying to compile with ClangCL on Windows. Was required to enable native tests in the Node.js CI for the ClangCL produced binaries.

Refs: nodejs/node#55784
@SuibianP
Copy link

SuibianP commented Dec 3, 2024

Prohibiting ClangCL would prevent nodejs/llnode from working on Windows, which, as an lldb plugin, has to be compiled with the same suite I suppose. I am unsure if node-gyp is capable of correctly generating other types of build descriptions on Windows to compile with unwrapped clang.

@StefanStojanovic
Copy link
Contributor Author

Prohibiting ClangCL would prevent nodejs/llnode from working on Windows, which, as an lldb plugin, has to be compiled with the same suite I suppose. I am unsure if node-gyp is capable of correctly generating other types of build descriptions on Windows to compile with unwrapped clang.

Thanks for the information, I wasn't aware of this. I've investigated it a bit and will open an issue in llnode to discuss this further.

@targos
Copy link
Member

targos commented Dec 5, 2024

The best solution is probably not to prohibit ClangCL, but to prevent it from being inherited as the default from Node.js

@StefanStojanovic
Copy link
Contributor Author

The best solution is probably not to prohibit ClangCL, but to prevent it from being inherited as the default from Node.js

My understanding is that it picks clang variable from the config.gypi generated during the configuration phase of Node.js compilation. One way to do it is to edit the test job or vcbuild.bat, or something like that to ensure we have 'clang': 0, before running tests but that is also not the nicest solution (not saying prohibiting clang from node-gyp is).

Also, from what I saw, llnode generates a project file with <PlatformToolset>v143</PlatformToolset>, and then sets clang-cl as a compiler with msbuild options (which is currently broken), so I do not think this change would affect it.

nodejs-github-bot pushed a commit that referenced this pull request Dec 16, 2024
It's causing linker errors with node.lib in node-gyp and potentially
breaks other 3rd party tools

PR-URL: #56238
Refs: #55784
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@StefanStojanovic
Copy link
Contributor Author

Closing this since all the changes from here landed.

aduh95 pushed a commit that referenced this pull request Dec 18, 2024
It's causing linker errors with node.lib in node-gyp and potentially
breaks other 3rd party tools

PR-URL: #56238
Refs: #55784
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Dec 18, 2024
It's causing linker errors with node.lib in node-gyp and potentially
breaks other 3rd party tools

PR-URL: #56238
Refs: #55784
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Dec 19, 2024
It's causing linker errors with node.lib in node-gyp and potentially
breaks other 3rd party tools

PR-URL: nodejs#56238
Refs: nodejs#55784
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
targos pushed a commit to targos/node that referenced this pull request Dec 20, 2024
It's causing linker errors with node.lib in node-gyp and potentially
breaks other 3rd party tools

PR-URL: nodejs#56238
Refs: nodejs#55784
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
ruyadorno pushed a commit that referenced this pull request Dec 20, 2024
It's causing linker errors with node.lib in node-gyp and potentially
breaks other 3rd party tools

PR-URL: #56238
Refs: #55784
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
ruyadorno pushed a commit that referenced this pull request Dec 21, 2024
It's causing linker errors with node.lib in node-gyp and potentially
breaks other 3rd party tools

PR-URL: #56238
Refs: #55784
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. npm Issues and PRs related to the npm client dependency or the npm registry. v8 engine Issues and PRs related to the V8 dependency.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants