Skip to content

doc: add instructions about using Visual Studio #58094

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joyeecheung
Copy link
Member

@joyeecheung joyeecheung commented May 1, 2025

I am not sure why but locally using vcbuild.bat never gives me real incremental builds - I am on a fairly old laptop, running vcbuild.bat again on an already built project would still try to rebuild the binary and take ~15min to finish even if I do not change the source code at all (IIRC this was also the case ~5 years ago when I still used Windows for a while). It also floods the shell with warnings and buries any compilation errors in the warnings. On the other hand when I load node.sln into Visual Studio I am able to have better incremental build (if I do not change anything it takes <1min for it to finish the process. If I only touch some .cc files it also only takes around 1min to finish building) and the warnings are minimal, allowing me to actually see compilation errors. So I think it's worth mentioning how to use Visual Studio for people developing on Windows.

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. doc Issues and PRs related to the documentations. labels May 1, 2025
@targos
Copy link
Member

targos commented May 1, 2025

Did you try vcbuild.bat noprojgen? To avoid rerunning the configure script, which may be one of the reasons it recompiles stuff.

@joyeecheung
Copy link
Member Author

joyeecheung commented May 2, 2025

Did you try vcbuild.bat noprojgen?

I tried running with noprojgen in a project that has not been changed and it still did a bunch of building and took ~8 minutes to complete. On the other hand, building again in Visual Studio in a project with no source changes took 2 seconds to recognize that there is no changes. Adding a comment in node.cc and building it again took ~40 seconds.

@joyeecheung
Copy link
Member Author

cc @nodejs/platform-windows @nodejs/build

@StefanStojanovic
Copy link
Contributor

I tested on my machine. I was using the latest main, so ClangCL was forced, but I can rerun it with the v23 branch (or a bit older main) to see if MSVC makes any difference. Here is what I found:

  • Running vcbuild.bat for the first time takes 14 minutes and 10 seconds, where msbuild node.sln ... takes 14 minutes
  • Running it for the second time takes 55 seconds, where 45 seconds are used for the msbuild command
  • Running it another time with noprojgen cuts down time to a bit under 30 seconds, where the majority of the time is used for executing the msbuild command
  • Running the build from VS takes 1-2 seconds if it is already built.

On another note, when I run the build for the second time (regardless of noprojgen usage), I see no warnings or anything similar. This is the output of the build:

  histogram.vcxproj -> ..\..\out\Release\lib\histogram.lib
  abseil.vcxproj -> ..\..\out\Release\lib\abseil.lib
  v8_libbase.vcxproj -> ..\..\out\Release\lib\v8_libbase.lib
  icuucx.vcxproj -> ..\..\out\Release\lib\icuucx.lib
  icui18n.vcxproj -> ..\..\out\Release\lib\icui18n.lib
  v8_libplatform.vcxproj -> ..\..\out\Release\lib\v8_libplatform.lib
  v8_zlib.vcxproj -> ..\..\out\Release\lib\v8_zlib.lib
  highway.vcxproj -> ..\..\out\Release\lib\highway.lib
  simdutf.vcxproj -> ..\..\out\Release\lib\simdutf.lib
  nbytes.vcxproj -> ..\..\out\Release\lib\nbytes.lib
  ncrypto.vcxproj -> ..\..\out\Release\lib\ncrypto.lib
  zlib.vcxproj -> ..\..\out\Release\lib\zlib.lib
  llhttp.vcxproj -> ..\..\out\Release\lib\llhttp.lib
  cares.vcxproj -> ..\..\out\Release\lib\cares.lib
  libuv.vcxproj -> ..\..\out\Release\lib\libuv.lib
  icutools.vcxproj -> ..\..\out\Release\lib\icutools.lib
  uvwasi.vcxproj -> ..\..\out\Release\lib\uvwasi.lib
  genccode.vcxproj -> ..\..\out\Release\\genccode.exe
  node_js2c.vcxproj -> out\Release\\node_js2c.exe
  icudata
  nghttp2.vcxproj -> ..\..\out\Release\lib\nghttp2.lib
  ada.vcxproj -> ..\..\out\Release\lib\ada.lib
  generating object code for ../../deps/icu-tmp/icudt77l.dat 
  genccode: using architecture cpu=34404 bits=64 big-endian=0
  simdjson.vcxproj -> ..\..\out\Release\lib\simdjson.lib
  brotli.vcxproj -> ..\..\out\Release\lib\brotli.lib
  icudata.vcxproj -> ..\..\out\Release\lib\icudata.lib
  sqlite.vcxproj -> ..\..\out\Release\lib\sqlite.lib
  zstd.vcxproj -> ..\..\out\Release\lib\zstd.lib
  bytecode_builtins_list_generator.vcxproj -> ..\..\out\Release\\bytecode_builtins_list_generator.exe
  torque_base.vcxproj -> ..\..\out\Release\lib\torque_base.lib
  torque.vcxproj -> ..\..\out\Release\\torque.exe
  crdtp.vcxproj -> ..\..\out\Release\lib\crdtp.lib
  zlib_inflate_chunk_simd.vcxproj -> ..\..\out\Release\lib\zlib_inflate_chunk_simd.lib
  Assemble
  Assemble
  Assemble
  zlib_adler32_simd.vcxproj -> ..\..\out\Release\lib\zlib_adler32_simd.lib
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  Assemble
  openssl.vcxproj -> ..\..\out\Release\lib\openssl.lib
  openssl-cli.vcxproj -> ..\..\out\Release\\openssl-cli.exe
  v8_init.vcxproj -> ..\..\out\Release\lib\v8_init.lib
  v8_initializers_slow.vcxproj -> ..\..\out\Release\lib\v8_initializers_slow.lib
  node_js2c
  gen-regexp-special-case.vcxproj -> ..\..\out\Release\\gen-regexp-special-case.exe
  run_gen-regexp-special-case_action
  libnode.vcxproj -> out\Release\lib\libnode.lib
  Assembling ..\..\deps\v8\src\heap\base\asm\x64\push_registers_masm.asm...
  v8_base_without_compiler.vcxproj -> ..\..\out\Release\lib\v8_base_without_compiler.lib
  v8_compiler.vcxproj -> ..\..\out\Release\lib\v8_compiler.lib
  v8_initializers.vcxproj -> ..\..\out\Release\lib\v8_initializers.lib
  mksnapshot.vcxproj -> ..\..\out\Release\\mksnapshot.exe
  generating: "..\..\out\Release\obj\v8_snapshot\/snapshot.cc" "..\..\out\Release\obj\v8_snapshot\/embedded.S"
  v8_snapshot.vcxproj -> ..\..\out\Release\lib\v8_snapshot.lib
  node_mksnapshot.vcxproj -> out\Release\\node_mksnapshot.exe
  node_mksnapshot
  node.vcxproj -> out\Release\\node.exe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. doc Issues and PRs related to the documentations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants