node icon indicating copy to clipboard operation
node copied to clipboard

build: enable Clang-cl Windows builds

Open targos opened this issue 3 years ago β€’ 77 comments

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

targos avatar Sep 30 '20 18:09 targos

With all the above hacks, I am blocked on this error:

lld-link : error : undefined symbol: public: virtual __cdecl v8::internal::Relocatable::~Relocatable(void) [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]

Related warning in the build output:

..\..\deps\v8\src/objects/objects.h(818,18): warning : inline function 'v8::internal::Relocatable::~Relocatable' is not defined [-Wundefined-inline] [D:\a\node\node\tools\v8_gypfiles\v8_base_without_compiler.vcxproj]
..\..\deps\v8\src/objects/string.h(821,25): message : used here [D:\a\node\node\tools\v8_gypfiles\v8_base_without_compiler.vcxproj]

https://github.com/nodejs/node/blob/4a6005c56acc35981277b1cb017056083c73c311/deps/v8/src/objects/objects.h#L815-L833

https://github.com/nodejs/node/blob/4a6005c56acc35981277b1cb017056083c73c311/deps/v8/src/objects/string.h#L821-L836

targos avatar Sep 30 '20 18:09 targos

/cc @nodejs/v8

targos avatar Oct 02 '20 08:10 targos

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 LIB : LLVM error : IO failure on output stream: no space on device.

gengjiawen avatar Oct 02 '20 14:10 gengjiawen

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 https://github.com/actions/virtual-environments/issues/1341#issuecomment-669204383

dennisameling avatar Oct 03 '20 20:10 dennisameling

@targos Can you rebase this, so we can working on new V8 ?

gengjiawen avatar Oct 19 '20 00:10 gengjiawen

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/virtual-environments#1341 (comment)

I investigate a little bit, looks like not an easy thing to do: https://github.com/actions/checkout/issues/197.

Also, below won't work either on windows CI on github action.

    defaults:
      run:
        working-directory: C:/nodejs

Not sure why they default to drive D with such a limited disk space.

gengjiawen avatar Oct 19 '20 01:10 gengjiawen

Rebased on https://github.com/nodejs/node/pull/35700

targos avatar Oct 19 '20 06:10 targos

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 πŸ˜„

08:23:59 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppBuild.targets(411,5): error MSB8020: The build tools for ClangCL (Platform Toolset = 'ClangCL') cannot be found. To build using the ClangCL build tools, please install ClangCL build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution". [C:\workspace\node-compile-windows\node\node_etw.vcxproj]

targos avatar Oct 19 '20 06:10 targos

@nodejs/build-infra Would it be easy to install ClangCL build tools on the Windows machines?

targos avatar Oct 19 '20 06:10 targos

@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.

gengjiawen avatar Oct 19 '20 06:10 gengjiawen

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:

..\..\deps\v8\src/base/safe_conversions_impl.h(158,46): warning : implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion] [D:\Git\no 
dejs\node\tools\v8_gypfiles\v8_base_without_compiler.vcxproj]
..\..\deps\v8\src/base/safe_conversions_impl.h(213,52): message : in instantiation of member function 'v8::base::internal::DstRangeRelationToSrcRangeImpl<long long, double, v8::base::internal::INTEGER_REPRESENTATION_SIGNE 
D, v8::base::internal::INTEGER_REPRESENTATION_SIGNED, v8::base::internal::NUMERIC_RANGE_NOT_CONTAINED>::Check' requested here [D:\Git\nodejs\node\tools\v8_gypfiles\v8_base_without_compiler.vcxproj]
..\..\deps\v8\src/base/safe_conversions.h(44,21): message : in instantiation of function template specialization 'v8::base::internal::DstRangeRelationToSrcRange<long long, double>' requested here [D:\Git\nodejs\node\tools 
\v8_gypfiles\v8_base_without_compiler.vcxproj]
..\..\deps\v8\src/base/platform/time.h(228,20): message : in instantiation of function template specialization 'v8::base::saturated_cast<long long, double>' requested here [D:\Git\nodejs\node\tools\v8_gypfiles\v8_base_wit 
hout_compiler.vcxproj]

Then it fails with 3 errors (related warnings included):

lld-link : error : undefined symbol: public: virtual __cdecl v8::internal::Relocatable::~Relocatable(void) [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-win.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\mksnapshot.obj
  >>> referenced by v8_base_without_compiler.lib(stack-guard.obj)

..\..\deps\v8\src/objects/objects.h(818,18): warning : inline function 'v8::internal::Relocatable::~Relocatable' is not defined [-Wundefined-inline] [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
..\..\deps\v8\src/objects/string.h(832,25): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
lld-link : error : undefined symbol: public: class v8::internal::Object __cdecl v8::internal::FixedArray::get(int) const [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-win.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\mksnapshot.obj
  >>> referenced by v8_base_without_compiler.lib(flush-instruction-cache.obj)

..\..\deps\v8\src/objects/fixed-array.h(102,17): warning : inline function 'v8::internal::FixedArray::get' is not defined [-Wundefined-inline] [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
..\..\deps\v8\src/objects/ordered-hash-table.h(88,23): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
lld-link : error : undefined symbol: public: void __cdecl v8::internal::FixedArray::set(int, class v8::internal::Smi) [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-win.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\mksnapshot.obj
  >>> referenced by v8_base_without_compiler.lib(flush-instruction-cache.obj)

..\..\deps\v8\src/objects/fixed-array.h(134,15): warning : inline function 'v8::internal::FixedArray::set' is not defined [-Wundefined-inline] [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
..\..\deps\v8\src/objects/ordered-hash-table.h(210,5): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]

targos avatar Oct 19 '20 06:10 targos

Looks like all related to inline function on windows platform.

gengjiawen avatar Oct 19 '20 06:10 gengjiawen

Codecov Report

Merging #35433 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #35433   +/-   ##
=======================================
  Coverage   96.40%   96.40%           
=======================================
  Files         220      220           
  Lines       73681    73681           
=======================================
  Hits        71031    71031           
  Misses       2650     2650           

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update c55f661...647f0a6. Read the comment docs.

codecov-io avatar Oct 19 '20 07:10 codecov-io

Now stucks with

  ..\..\out\Release\obj\v8_libsampler\\deps\v8\src\libsampler\sampler.obj: no such file or directory
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(1309,5): error MSB6006: "llvm-lib.exe" exited with code 1. [D:\code\node\tools\v8_gypfiles\v8_libsampler.vcxproj]
  ..\..\out\Release\obj\v8_zlib\\deps\v8\third_party\zlib\adler32.obj: no such file or directory
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(1309,5): error MSB6006: "llvm-lib.exe" exited with code 1. [D:\code\node\tools\v8_gypfiles\v8_zlib.vcxproj]

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.

gengjiawen avatar Nov 09 '20 07:11 gengjiawen

Just for the record, Visual Studio 16.8 was released yesterday and has the following mentioned in its release notes:

Support for ARM64 projects using clang-cl.

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 πŸ‘

dennisameling avatar Nov 11 '20 08:11 dennisameling

Just tried to build using .\vcbuild.bat noetw on x64 with Visual Studio 16.8, getting the same errors as @targos regarding mksnapshot, but there are actually quite some things that build correctly, so that's promising πŸš€

@gengjiawen Does it make any difference if you update to Visual Studio 16.8, which was released yesterday?

image

dennisameling avatar Nov 11 '20 10:11 dennisameling

@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.

I have a Surface Pro X based on the arm64 architecture

Have you tried the official arm64 build for windows. Will it run ? (I have no device to test it)

gengjiawen avatar Nov 11 '20 11:11 gengjiawen

Have you tried the official arm64 build for windows. Will it run ? (I have no device to test it)

Yes (see https://github.com/nodejs/build/issues/2450#issuecomment-703536106), and it's blazing fast πŸš€ I use it on a daily basis and to work on things like an arm64 build for GitHub Desktop: https://github.com/desktop/desktop/pull/9691

dennisameling avatar Nov 11 '20 11:11 dennisameling

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.

gengjiawen avatar Dec 01 '20 09:12 gengjiawen

Rebased. Failures are still the same:

lld-link : error : undefined symbol: public: class v8::internal::Object __cdecl v8::internal::FixedArray::get(int) const [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj
]
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-aix.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-generic.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-mac.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-win.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\mksnapshot.obj
  >>> referenced by v8_base_without_compiler.lib(flush-instruction-cache.obj)
  >>> referenced by v8_base_without_compiler.lib(stack-guard.obj)
  >>> referenced by v8_base_without_compiler.lib(thread-local-top.obj)
  >>> referenced by v8_base_without_compiler.lib(flags.obj)
  >>> referenced by v8_base_without_compiler.lib(base-space.obj)
  >>> referenced 111 more times

lld-link : error : undefined symbol: public: void __cdecl v8::internal::FixedArray::set(int, class v8::internal::Smi) [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-aix.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-generic.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-mac.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-win.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\mksnapshot.obj
  >>> referenced by v8_base_without_compiler.lib(flush-instruction-cache.obj)
  >>> referenced by v8_base_without_compiler.lib(stack-guard.obj)
  >>> referenced by v8_base_without_compiler.lib(thread-local-top.obj)
  >>> referenced by v8_base_without_compiler.lib(flags.obj)
  >>> referenced by v8_base_without_compiler.lib(base-space.obj)
  >>> referenced 111 more times

lld-link : error : undefined symbol: public: virtual __cdecl v8::internal::Relocatable::~Relocatable(void) [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-win.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\mksnapshot.obj
  >>> referenced by v8_base_without_compiler.lib(stack-guard.obj)
  >>> referenced by v8_base_without_compiler.lib(thread-local-top.obj)
  >>> referenced by v8_base_without_compiler.lib(flags.obj)
  >>> referenced by v8_base_without_compiler.lib(base-space.obj)
  >>> referenced by v8_base_without_compiler.lib(heap-write-barrier.obj)
  >>> referenced by v8_base_without_compiler.lib(memory-chunk-layout.obj)
  >>> referenced by v8_base_without_compiler.lib(cancelable-task.obj)
  >>> referenced by v8_base_without_compiler.lib(ostreams.obj)
  >>> referenced 107 more times

targos avatar Feb 20 '21 11:02 targos

Examples of warnings during compilation:

..\..\deps\v8\src/objects/ordered-hash-table.h(256,43): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  In file included from ..\..\deps\v8\src\snapshot\mksnapshot.cc:12:
  In file included from ..\..\deps\v8\src/codegen/assembler-arch.h:8:
  In file included from ..\..\deps\v8\src/codegen/assembler.h:47:
  In file included from ..\..\deps\v8\src/codegen/reloc-info.h:10:
  In file included from ..\..\deps\v8\src/objects/code.h:11:
  In file included from ..\..\deps\v8\src/objects/contexts.h:8:
  In file included from ..\..\deps\v8\src/objects/fixed-array.h:10:
..\..\deps\v8\src/objects/objects.h(832,18): warning : inline function 'v8::internal::Relocatable::~Relocatable' is not defined [-Wundefined-inline] [D:\Git\nodejs\node\tools\v8
_gypfiles\mksnapshot.vcxproj]
..\..\deps\v8\src/objects/string.h(878,25): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  In file included from ..\..\deps\v8\src\snapshot\mksnapshot.cc:12:
  In file included from ..\..\deps\v8\src/codegen/assembler-arch.h:8:
  In file included from ..\..\deps\v8\src/codegen/assembler.h:47:
  In file included from ..\..\deps\v8\src/codegen/reloc-info.h:10:
  In file included from ..\..\deps\v8\src/objects/code.h:11:
  In file included from ..\..\deps\v8\src/objects/contexts.h:8:
..\..\deps\v8\src/objects/fixed-array.h(103,17): warning : inline function 'v8::internal::FixedArray::get' is not defined [-Wundefined-inline] [D:\Git\nodejs\node\tools\v8_gypfi
les\mksnapshot.vcxproj]
..\..\deps\v8\src/objects/ordered-hash-table.h(97,23): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  In file included from ..\..\deps\v8\src\snapshot\mksnapshot.cc:12:
  In file included from ..\..\deps\v8\src/codegen/assembler-arch.h:8:
  In file included from ..\..\deps\v8\src/codegen/assembler.h:47:
  In file included from ..\..\deps\v8\src/codegen/reloc-info.h:10:
  In file included from ..\..\deps\v8\src/objects/code.h:11:
  In file included from ..\..\deps\v8\src/objects/contexts.h:8:
..\..\deps\v8\src/objects/fixed-array.h(135,15): warning : inline function 'v8::internal::FixedArray::set' is not defined [-Wundefined-inline] [D:\Git\nodejs\node\tools\v8_gypfi
les\mksnapshot.vcxproj]
..\..\deps\v8\src/objects/ordered-hash-table.h(256,43): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]

targos avatar Feb 20 '21 11:02 targos

I don't know why, but I'm still unable to create V8 issues. Could someone please do the report for me (https://bugs.chromium.org/p/v8/issues/entry?template=Node.js+upstream+bug)?

Here's the filled template:

V8 fails to link if compiled with clang-cl on Windows
Version: 8.8
OS: Windows
Architecture: x64
GitHub issue: https://github.com/nodejs/node/pull/35433

What steps will reproduce the problem?

Compile on Visual Studio with clang-cl

What is the expected output?

Successful compilation

What do you see instead?

  In file included from ..\..\deps\v8\src\snapshot\mksnapshot.cc:12:
  In file included from ..\..\deps\v8\src/codegen/assembler-arch.h:8:
  In file included from ..\..\deps\v8\src/codegen/assembler.h:47:
  In file included from ..\..\deps\v8\src/codegen/reloc-info.h:10:
  In file included from ..\..\deps\v8\src/objects/code.h:11:
  In file included from ..\..\deps\v8\src/objects/contexts.h:8:
..\..\deps\v8\src/objects/fixed-array.h(103,17): warning : inline function 'v8::internal::FixedArray::get' is not defined [-Wundefined-inline] [D:\Git\nodejs\node\too
les\mksnapshot.vcxproj]
..\..\deps\v8\src/objects/ordered-hash-table.h(97,23): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  In file included from ..\..\deps\v8\src\snapshot\mksnapshot.cc:12:
  In file included from ..\..\deps\v8\src/codegen/assembler-arch.h:8:
  In file included from ..\..\deps\v8\src/codegen/assembler.h:47:
  In file included from ..\..\deps\v8\src/codegen/reloc-info.h:10:
  In file included from ..\..\deps\v8\src/objects/code.h:11:
  In file included from ..\..\deps\v8\src/objects/contexts.h:8:
..\..\deps\v8\src/objects/fixed-array.h(135,15): warning : inline function 'v8::internal::FixedArray::set' is not defined [-Wundefined-inline] [D:\Git\nodejs\node\too
les\mksnapshot.vcxproj]
..\..\deps\v8\src/objects/ordered-hash-table.h(242,5): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  In file included from ..\..\deps\v8\src\snapshot\mksnapshot.cc:12:
  In file included from ..\..\deps\v8\src/codegen/assembler-arch.h:8:
  In file included from ..\..\deps\v8\src/codegen/assembler.h:47:
  In file included from ..\..\deps\v8\src/codegen/reloc-info.h:10:
  In file included from ..\..\deps\v8\src/objects/code.h:11:
  In file included from ..\..\deps\v8\src/objects/contexts.h:8:
..\..\deps\v8\src/objects/fixed-array.h(122,15): warning : inline function 'v8::internal::FixedArray::set' is not defined [-Wundefined-inline] [D:\Git\nodejs\node\too
les\mksnapshot.vcxproj]
..\..\deps\v8\src/objects/ordered-hash-table.h(256,43): message : used here [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
lld-link : error : undefined symbol: public: class v8::internal::Object __cdecl v8::internal::FixedArray::get(int) const [D:\Git\nodejs\node\tools\v8_gypfiles\mksnaps
]
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-aix.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-generic.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-mac.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-win.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\mksnapshot.obj
  >>> referenced by v8_base_without_compiler.lib(flush-instruction-cache.obj)
  >>> referenced by v8_base_without_compiler.lib(stack-guard.obj)
  >>> referenced by v8_base_without_compiler.lib(thread-local-top.obj)
  >>> referenced by v8_base_without_compiler.lib(flags.obj)
  >>> referenced by v8_base_without_compiler.lib(base-space.obj)
  >>> referenced 111 more times

lld-link : error : undefined symbol: public: void __cdecl v8::internal::FixedArray::set(int, class v8::internal::Smi) [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-aix.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-generic.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-mac.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-win.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\mksnapshot.obj
  >>> referenced by v8_base_without_compiler.lib(flush-instruction-cache.obj)
  >>> referenced by v8_base_without_compiler.lib(stack-guard.obj)
  >>> referenced by v8_base_without_compiler.lib(thread-local-top.obj)
  >>> referenced by v8_base_without_compiler.lib(flags.obj)
  >>> referenced by v8_base_without_compiler.lib(base-space.obj)
  >>> referenced 111 more times

lld-link : error : undefined symbol: public: virtual __cdecl v8::internal::Relocatable::~Relocatable(void) [D:\Git\nodejs\node\tools\v8_gypfiles\mksnapshot.vcxproj]
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\embedded\platform-embedded-file-writer-win.obj
  >>> referenced by ..\..\out\Release\obj\mksnapshot\\deps\v8\src\snapshot\mksnapshot.obj
  >>> referenced by v8_base_without_compiler.lib(stack-guard.obj)
  >>> referenced by v8_base_without_compiler.lib(thread-local-top.obj)
  >>> referenced by v8_base_without_compiler.lib(flags.obj)
  >>> referenced by v8_base_without_compiler.lib(base-space.obj)
  >>> referenced by v8_base_without_compiler.lib(heap-write-barrier.obj)
  >>> referenced by v8_base_without_compiler.lib(memory-chunk-layout.obj)
  >>> referenced by v8_base_without_compiler.lib(cancelable-task.obj)
  >>> referenced by v8_base_without_compiler.lib(ostreams.obj)
  >>> referenced 107 more times

Please use labels and text to provide additional information.

targos avatar Feb 20 '21 11:02 targos

I don't know why, but I'm still unable to create V8 issues. Could someone please do the report for me (bugs.chromium.org/p/v8/issues/entry?template=Node.js+upstream+bug)?

Here's the filled template:

V8 fails to link if compiled with clang-cl on Windows

Same here. I used can create V8 issues. Months ago I start can't submit issues.

I create a normal bug in https://bugs.chromium.org/p/v8/issues/detail?id=11481.

gengjiawen avatar Feb 20 '21 14:02 gengjiawen

@targos, what is the current status of this? FYI, Electron have made the decision to use only clang on Windows which means that currently it is not possible to use node-gyp to build a native module on Windows because of a V8 API (GetBackingStore) that returns a shared_ptr - these are not compatible between MSVC and the clang runtime.

https://github.com/electron/electron/issues/29893

mmomtchev avatar May 31 '22 11:05 mmomtchev

Status hasn't changed. There are some issues and I don't have the knowledge or time to fix them.

targos avatar May 31 '22 11:05 targos

https://ci.nodejs.org/job/node-test-commit-windows-fanned/51194/

targos avatar Oct 22 '22 10:10 targos

Temporary ready for review to trigger GitHub CI

targos avatar Oct 22 '22 10:10 targos

clang-cl : warning : argument unused during compilation: '-std:c++17' [-Wunused-command-line-argument] [D:\a\node\node\deps\uvwasi\uvwasi.vcxproj]

Many errors in the new base64 dep:

base64\lib\arch\ssse3/enc_reshuffle.c(7,7): error : always_inline function '_mm_shuffle_epi8' requires target feature 'ssse3', but would be inlined into function 'enc_reshuffle' that is compiled without support for 'ssse3' [D:\a\node\node\deps\base64\base64_ssse3.vcxproj]
  In file included from base64\lib\arch\ssse3\codec.c:17:
base64\lib\arch\ssse3/enc_translate.c(32,26): error : always_inline function '_mm_shuffle_epi8' requires target feature 'ssse3', but would be inlined into function 'enc_translate' that is compiled without support for 'ssse3' [D:\a\node\node\deps\base64\base64_ssse3.vcxproj]
  In file included from base64\lib\arch\ssse3\codec.c:15:
base64\lib\arch\ssse3/dec_loop.c(91,29): error : always_inline function '_mm_shuffle_epi8' requires target feature 'ssse3', but would be inlined into function 'dec_loop_ssse3_inner' that is compiled without support for 'ssse3' [D:\a\node\node\deps\base64\base64_ssse3.vcxproj]
base64\lib\arch\ssse3/dec_loop.c(92,29): error : always_inline function '_mm_shuffle_epi8' requires target feature 'ssse3', but would be inlined into function 'dec_loop_ssse3_inner' that is compiled without support for 'ssse3' [D:\a\node\node\deps\base64\base64_ssse3.vcxproj]
base64\lib\arch\ssse3/dec_loop.c(101,24): error : always_inline function '_mm_shuffle_epi8' requires target feature 'ssse3', but would be inlined into function 'dec_loop_ssse3_inner' that is compiled without support for 'ssse3' [D:\a\node\node\deps\base64\base64_ssse3.vcxproj]
...

targos avatar Oct 22 '22 10:10 targos

@bnoordhuis fyi

targos avatar Oct 22 '22 10:10 targos

You probably need to turn on -msse3 or -msse4.2 for clang-cl.

(_mm_shuffle_epi8 corresponds to PABSB and that's an SSE3 instruction but I expect it also uses newer instructions.)

bnoordhuis avatar Oct 22 '22 10:10 bnoordhuis