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
build: enable Clang-cl Windows builds #35433
base: main
Are you sure you want to change the base?
Conversation
| # else | ||
| *pCPU = IMAGE_FILE_MACHINE_UNKNOWN; | ||
| *pCPU = IMAGE_FILE_MACHINE_AMD64; |
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.
This is for #34201
| #include <smmintrin.h> | ||
| #include <tmmintrin.h> |
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.
I opened https://chromium-review.googlesource.com/c/chromium/src/+/2281008 for this
| # 'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h', | ||
| # 'msvs_precompiled_source': 'tools/msvs/pch/node_pch.cc', | ||
| # 'sources': [ | ||
| # '<(_msvs_precompiled_header)', | ||
| # '<(_msvs_precompiled_source)', | ||
| # ], |
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.
I get an error about non-portable includes if precompiled headers are enabled.
| @@ -2799,7 +2799,7 @@ def _GetMSBuildLocalProperties(msbuild_toolset): | ||
| if msbuild_toolset: | ||
| properties = [ | ||
| ['PropertyGroup', {'Label': 'Locals'}, | ||
| ['PlatformToolset', msbuild_toolset], | ||
| ['PlatformToolset', 'ClangCL'], |
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.
This obviously has to come from configuration in the end
|
With all the above hacks, I am blocked on this error: Related warning in the build output: node/deps/v8/src/objects/objects.h Lines 815 to 833 in 4a6005c
node/deps/v8/src/objects/string.h Lines 821 to 836 in 4a6005c
|
|
/cc @nodejs/v8 |
|
Another tricky thing is that we can't even test this on github action due to space limit https://github.com/nodejs/node/pull/35433/checks?check_run_id=1189469828 |
|
Regarding the disk space issue: the D:\ drive on Windows VMs apparently has 14GB available - this is also described in the official docs. A workaround is to move things to the C:\ drive which has 80GB+ as described in actions/runner-images#1341 (comment) |
|
@targos Can you rebase this, so we can working on new V8 ? |
I investigate a little bit, looks like not an easy thing to do: actions/checkout#197. Also, below won't work either on windows CI on github action. Not sure why they default to drive D with such a limited disk space. |
|
Rebased on #35700 |
|
I don't know if CI has clang-cl. Let's try: https://ci.nodejs.org/job/node-test-commit-windows-fanned/38888/ Edit: well, it doesn't |
|
@nodejs/build-infra Would it be easy to install ClangCL build tools on the Windows machines? |
Not sure this will help: https://github.com/appveyor/build-images/blob/27bde614bc60d7ef7a8bc46182f4d7582fa11b56/scripts/Windows/install_vs2019.ps1#L192. |
|
So I tried to build it on my local machine. There's one warning that is very noisy (I think it's printed for every V8 source file: Then it fails with 3 errors (related warnings included): |
|
Looks like all related to inline function on windows platform. |
This comment has been minimized.
This comment has been minimized.
|
Now stucks with Maybe related: https://developercommunity.visualstudio.com/content/problem/1110835/clangcl-ltcg-is-passed-to-llvm-lib.html This occurred when I update my visual studio to latest. I also get some ideas to patch V8 to make the windows build works. |
|
Just for the record, Visual Studio 16.8 was released yesterday and has the following mentioned in its release notes:
Thought I'd mention it here as it might help for this PR. I have a Surface Pro X based on the arm64 architecture, let me know if you'd like me to test something |
|
Just tried to build using @gengjiawen Does it make any difference if you update to Visual Studio 16.8, which was released yesterday? |
I forget to remove '/P'. I should try my build now.
Have you tried the official arm64 build for windows. Will it run ? (I have no device to test it) |
Yes (see nodejs/build#2450 (comment)), and it's blazing fast |
|
This is more likely a bug from what I test (refactor the inline implementation). Not sure this need to reported to clang team or msvc team. |
|
@targos, what is the current status of this? |
|
Status hasn't changed. There are some issues and I don't have the knowledge or time to fix them. |
|
Temporary ready for review to trigger GitHub CI |
Many errors in the new |
|
@bnoordhuis fyi |
|
You probably need to turn on ( |
I have no idea how to do that. |
|
Just add it to cflags. If plain |
|
The errors are still here after 74f916b but I'm not sure |
|
Oh! Sorry about that, the way to do that with gyp is this: 'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': ['-msse3'],
},
}, |
|
Next error is from V8: |
|
This warning appears thousands of times: |
|
The build ended up failing with "No space left on device" |
|
Hm, that's regrettable. Maybe it's possible to build on C:\ instead of D:? GitHub's machines have two disks/mounts. The second one has about 10-15 GB free space, the first one is about twice the size when you remove a couple of big packages; .NET SDK + Android SDK + GHC is around 30 GB. A full list is here: https://github.com/actions/runner-images/blob/main/images/win/Windows2019-Readme.md |



This is very hacky at the moment. I'm trying to find out what needs to be done to enable it and where.
I'm opening a PR to discuss the changes and seek some help, because it doesn't work yet!
To try it:
.\vcbuild.bat noetw