nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
105.05k stars 28.46k forks source link

Makefile dependency tree is incomplete, makefiles do not build only as necessary #25135

Open sam-github opened 5 years ago

sam-github commented 5 years ago

The makefiles generated by gyp are not working for development (they work better for single-shot CI builds). Perhaps I'm missing something, please tell me if I am, but I've done some asking around to people who know the gyp system, and have some agreement on these points.

Ninja notes:

Ninja (./configure --ninja) doesn't have the above problems for building, its dependency tree is correct (it builds nothing when nothing has changed, and it reruns js2c when js files have changed).

However, it is either incomplete or not integrated with the rest of the build (I'm not sure how its intended to work). It doesn't make the top-level node symlink (at least test-doc relies on this), so a ln -s out/Release/node node is required for make test-doc. As for make test, it won't use the ninja build output, because it relies on .PHONY targets, so it always (effectively) does a make -C out all.

sam-github commented 5 years ago

An additional issue:

sam-github commented 5 years ago

An additional issue:

sam-github commented 4 years ago

This is pretty painful on machines with slow link times while testing CI builds (so, not allowed to use ninja), because make test does a relink every time.

I have been poking at this a bit, and it appears to be a bug in the V8 gyp files (@nodejs/v8-update), they seem to do some actions without considering whether deps have changed. Following is a rebuild (after just having done 5 clean builds). Is the root cause of this that Generating inspector protocol sources from protocol json has no deps?

% make -C out -j1
make: Entering directory '/home/sam/w/core/lts/out'
  TOUCH dc2a6a8f2bf222b5a02a9df3d748ab02b9f73ccf.intermediate
  ACTION _home_sam_w_core_lts_tools_v8_gypfiles_v8_gyp_run_torque_target_run_torque_action dc2a6a8f2bf222b5a02a9df3d748ab02b9f73ccf.intermediate
  TOUCH 8ce4ae39fa160c52d3938e994929629c6a3c704e.intermediate
  ACTION Generating inspector protocol sources from protocol json 8ce4ae39fa160c52d3938e994929629c6a3c704e.intermediate
  TOUCH f12aef6ca9be3b6903ccca9065c46321958e5d57.intermediate
  ACTION generating: "/home/sam/w/core/lts/out/Release/obj.target/v8_version/geni/snapshot.cc" "/home/sam/w/core/lts/out/Release/obj.target/v8_version/geni/embedded.S" f12aef
6ca9be3b6903ccca9065c46321958e5d57.intermediate
  CXX(target) /home/sam/w/core/lts/out/Release/obj.target/v8_snapshot/geni/snapshot.o
  CC(target) /home/sam/w/core/lts/out/Release/obj.target/v8_snapshot/geni/embedded.o
  AR(target) /home/sam/w/core/lts/out/Release/obj.target/tools/v8_gypfiles/libv8_snapshot.a
  TOUCH /home/sam/w/core/lts/out/Release/obj.target/tools/v8_gypfiles/v8_maybe_snapshot.stamp
  TOUCH d91d7401cc24d87f844dbc275fc67fb1cbbc9681.intermediate
  ACTION Generating node protocol sources from protocol json d91d7401cc24d87f844dbc275fc67fb1cbbc9681.intermediate
  LINK(target) /home/sam/w/core/lts/out/Release/cctest
  LINK(target) /home/sam/w/core/lts/out/Release/mkcodecache
  LINK(target) /home/sam/w/core/lts/out/Release/node_mksnapshot
  ACTION _home_sam_w_core_lts_node_gyp_node_target_run_mkcodecache /home/sam/w/core/lts/out/Release/obj/gen/node_code_cache.cc
  ACTION _home_sam_w_core_lts_node_gyp_node_target_node_mksnapshot /home/sam/w/core/lts/out/Release/obj/gen/node_snapshot.cc
  CXX(target) /home/sam/w/core/lts/out/Release/obj.target/node/gen/node_code_cache.o
  CXX(target) /home/sam/w/core/lts/out/Release/obj.target/node/gen/node_snapshot.o
  LINK(target) /home/sam/w/core/lts/out/Release/node
rm f12aef6ca9be3b6903ccca9065c46321958e5d57.intermediate dc2a6a8f2bf222b5a02a9df3d748ab02b9f73ccf.intermediate 8ce4ae39fa160c52d3938e994929629c6a3c704e.intermediate d91d7401c
c24d87f844dbc275fc67fb1cbbc9681.intermediate
make: Leaving directory '/home/sam/w/core/lts/out'