Unfortunately, building node-webrtc from source on Windows is a bit trickier than on Linux or MacOS, because there is not a reproducible build environment. Also because libwebrtc itself seems a bit broken on this platform.
These are things I had to do to get npm run build working on Windows. If you miss a step, the build might fail.
- Add the Visual Studio Clang directory to your
%PATH%. The directory isC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\Llvm\x64\bin\. - Add the Windows SDK installation directory to your
%PATH%. An example would beC:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x64. - Modify
C:\Program Files\CMake\share\cmake-3.26\Modules\Windows-Clang.cmaketo not have-fuse-ld=lld-link. - Modify
node_modules/cmake-js/lib/toolset.js, line 184, to have the flag-DELAYLOAD:NODE.EXEinstead of/DELAYLOAD:NODE.EXE. - Set the environment variables
CC=clang.exeandCXX=clang++.exe.
- In
build-win32-x64/external/libwebrtc/download/src:- In
third_party/abseil-cpp/absl/meta/type_traits.h, lines 482 and 493, comment out the assertions that trigger for the "std::pairis not trivially constructible" error. - In
rtc_base/third_party/sigslot/sigslot.h, line 295, makepmethodalways be an array size 24.
- In
- In
build-win32-x64/external/catch2/src:- In
single_include/catch2/catch.hpp, line 8722, modify this to always be 32768.
- In
You'll need to set the environment variable DEBUG=1 if you want symbols. On PowerShell, this can be done with $env:DEBUG=1. Note that CMake will build these into the same directory, which is a bit annoying. TODO come up with a better way to switch between debug/release builds.