nodejs/node

build,windows: solve build file disparity

refack opened this issue · 10 comments

  • Version: All
  • Platform: Windows
  • Subsystem: build

Up till now we have been using two mechanism to build node, on windows vcbuild.bat that triggers configure and then msbuild. And on all other platforms a direct call to configure and then an explicit call to make. Having two mechanisms, leads to divergence, as often bugs-fixes/improvements are done on one and not the other. I wish we could eliminate this disparity by using a tool that works on both platforms.
A few proposed solutions:

  1. build using ninja as chromium and V8 does (generate .ninja files with GYP)
  2. build using cmake which is now MSVS supported (generate CMakeLists.txt files with GYP)
  3. investigation build with make on Windows

Laudable goal. Some comments:

  1. build using ninja as chromium and V8 does (generate .ninja files with GYP)

Possible, but complicates the build prerequisites unless we bundle ninja. make is an apt-get install build-essential away, ninja not so much. Might be unfriendly towards users.

(Bundling ninja is acceptable though, IMO.)

  1. build using cmake which is now MSVS supported (generate CMakeLists.txt files with GYP)

Probably a non-starter. GYP's cmake support is very basic and buggy.

  1. investigation build with make on Windows

Don't know Windows enough to comment.

Possible, but complicates the build prerequisites unless we bundle ninja. make is an apt-get install build-essential away, ninja not so much. Might be unfriendly towards users.

investigation build with make on Windows

Don't know Windows enough to comment.

I think there will need to be a compromise either way, or adding ninja for all, or adding make to windows...

(also concerning #12310)

Sorry, this may be a silly question. But why not to build Node.js with... Node.js?

Node.js is already promoted as integration tool: http://www.infoworld.com/article/3187923/application-development/5-reasons-node-js-rules-for-complex-integrations.html

Sorry, this may be a silly question. But why not to build Node.js with... Node.js?

Yay, I love it that I'm not the only one with "silly" question. More power to you my friend!

I like the idea, and @indutny is bringing us closer to it (https://github.com/indutny/dukgyp).
At the current time we're missing two key components that I know of, a module to "eat" .gyp and a module to manage the build. @eljefedelrodeodeljefe 's platform-tools has set it's goal to solve these too.

Also there is the notion of bootstrapping, that is building without a previous existing product. It seems negligible on established platforms, but it is important for porting node into new platforms.

Why GYP, short answer, we're stuck with it for now, since it holds too much "institutional knowledge" nodejs/CTC#2

Short example of the merits of ninja
Recompilation after a change in a .js file in /lib

VS2015

~16 minutes

C:\code\node>time < nul&vcbuild > nul&time < nul
The current time is: 14:07:53.76
Enter the new time: The current time is: 14:23:41.10
Enter the new time:

ninja

56 seconds

c:\code\node\out.ninja\out\Debug$ time < nul &echo.""&ninja -j 3 -v -f build.ninja node&time < nul
The current time is: 18:50:11.05
Enter the new time: ""
[1/5] C:\bin\dev\python27\python.exe gyp-win-tool action-wrapper environment.x64 node_js2c_target_node_js2c_bce0facc3e66b523ccf35ab2d859c2d9..rsp ..\..\..\
[2/5] C:\bin\dev\python27\python.exe gyp-win-tool stamp obj\node.actions_depends.stamp
[3/5] C:\bin\dev\python27\python.exe gyp-win-tool stamp obj\node.compile_depends.stamp
[4/5] ninja -t msvc -e environment.x64 -- "D:\bin\dev\VS\2017\BuildTools\VC\Tools\MSVC\14.10.25017\bin\HostX64\x64\cl.exe" /nologo /showIncludes /FC @obj\gen\node.node_javascript.obj.rsp /c gen\node_javascript.cc /Foobj\gen\node.node_javascript.obj /Fdobj\node.cc.pdb
[5/5] C:\bin\dev\python27\python.exe gyp-win-tool link-with-manifests environment.x64 True node.exe "C:\bin\dev\python27\python.exe gyp-win-tool link-wrapper environment.x64 False link.exe /nologo /OUT:node.exe @node.exe.rsp" 1 mt.exe rc.exe "obj\node.node.exe.intermediate.manifest" obj\node.node.exe.generated.manifest ..\..\..\src\res\node.exe.extra.manifest
The current time is: 18:51:07.85
Enter the new time:
Trott commented

@refack Is this still in progress? Should this remain open?

I'm going to remove the discuss label but feel free to add it back if you think that's misguided.

I would love to see cmake support. It has better IDE support.

wrong thread

There's been no further progress on this. Closing. Can reopen if it is picked back up.