nodejs / nodejs/node-gyp

Use clang-cl for Windows

Open
#3,072 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Windows
Dominant language
Python
Stars
10.7k
Forks
1.9k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

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 (https://github.com/nodejs/node-gyp/issues/2813#issuecomment-1462523117)

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the llnode binding.gyp configuration and review the related changes in #1164 and #1537. Trace how Windows MSBuild properties and compiler environment variables reach the generated vcxproj and build phase. Done means llnode can select clang-cl on Windows without relying on the fixed MSBuild argument passthrough.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs
Domain
build-system, operating-systems, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.