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

Use clang-cl for Windows #3072

Open
SuibianP opened this issue Sep 25, 2024 · 2 comments
Open

Use clang-cl for Windows #3072

SuibianP opened this issue Sep 25, 2024 · 2 comments
Labels

Comments

@SuibianP
Copy link

I am trying to build the llnode module on Windows, which can only be built with clang-cl. The project previously (ab)used the passthrough of arguments to msbuild to configure the CLToolPath and CLToolExe properties, which has hence been fixed in #1164. (nodejs/llnode#321, nodejs/llnode#377)

I have attempted the following to no avail,

  1. Add in binding.gyp
"msbuild_settings": {
    "ClCompile": {
        "CLToolPath": "<(cl_tool_path)",
        "CLToolExe": "<(cl_tool_exe)",
    },
},

This does put the properties into the vcxproj, but in the ClCompile section. https://stackoverflow.com/a/31362960/12385184

  1. CC and CXX environment variables (Build defaults to x86 on a x64 Windows machine. How to force an x64 build? #2813 (comment))

This does have some effect on the configure phase, but only accepts GCC (not CL) compatible compilers, and it has no effect on the building phase which still uses CL.exe.


This issue might be a case of #1537 if there is no special way to specify the compiler executable on Windows.

  • Node Version: node v18.20.4 npm 10.7.0
  • Platform: Microsoft Windows 11 Enterprise 10.0.22631 N/A Build 22631 x64-based PC
  • Compiler: MSBuild version 17.11.2+c078802d4 for .NET Framework 17.11.2.32701 MSVC 19.41.34120 for x64
  • Module: https://github.com/nodejs/llnode
@SuibianP
Copy link
Author

SuibianP commented Nov 4, 2024

Without changes to gyp and without breaking backward compatibility, the only way I can think of to pass arbitrary parameters is to prepend some character illegal in msbuild target names, such as ? or (. It is going to be rather ugly that way though... node-gyp build target1 target2 ?/p:CLToolExe="C:\bin\LLVM\clang-cl.exe" ?/p:CLToolPath="C:\bin\LLVM"

A reasonable compromise might be to pass through all arguments beginning with / to msbuild, on the assumption that target names rarely begins with a slash (although it is probably legal).

@cclauss any comments?

@cclauss
Copy link
Contributor

cclauss commented Nov 4, 2024

Sorry, I am not a Windows user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants