-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Build and gyp fixes #23156
Build and gyp fixes #23156
Conversation
/CC @nodejs/build-files @nodejs/gyp @nodejs/python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the gyp
changes being upstreamed/applicable to node-gyp
?
common.gypi
Outdated
@@ -367,7 +367,6 @@ | |||
'ldflags': [ '-pthread' ], | |||
}], | |||
[ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', { | |||
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these are also set for mac on L466-L471.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved them
@@ -24,6 +24,7 @@ | |||
}, | |||
'force_load%': '<(force_load)', | |||
}, | |||
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be in an OS
conditional as it was in common.gypi
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT GYP knows what to do, so no need to exclude win and mac.
I'll investigate the CI output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll investigate the CI output
- On freebsd (which uses clang)
ccache c++ -o /out/Release/obj.target/node_lib/src/callback_scope.o ... -m64 -Wall -Wextra -Wno-unused-parameter
- On Mac (which is clang bu via XCODE):
/usr/local/bin/ccache c++ -o out/Release/obj.target/node_lib/src/callback_scope.o ../src/callback_scope.cc ... -Wall -Wendif-labels -W -Wno-unused-parameter
(only the old set, this run was before I moved it)
- On Windows
https://gist.github.com/refack/aa6d6bac65bcd0ab4187aa86bfc27fce
No mention of any of the cflags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's probably a good idea to add a few comments in the gypfiles mentioning they are actually maintained by us as we keep adding our own patches to the files...
node.gyp
Outdated
'dependencies': [ | ||
'node_js2c#host', | ||
'mkssldef', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this is made a dependency? It looks like an action in the same spirit of js2c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short answer is, no reason not to.
The situation that we got these two changes was done in two independant steps (so I didn't notice that it looks like a switch):
- If
mkssldef
in not there, the build breaks on windows if building with more than 2 threads. - If
node_js2c#host
is a target and not an action, it leads to unnecessary reruns (then compilation) onmake
based systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved.
8bb3463
to
a12c082
Compare
I moved some more v8.gyp refactoring from #22920 |
I'm going to move them to |
35cb103
to
f0725e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since all of these seem more or less independent of each other, maybe it’s best to split them into one PR each?
.gitignore
Outdated
@@ -4,6 +4,7 @@ | |||
!test/fixtures/**/.* | |||
!tools/node_modules/**/.* | |||
!tools/doc/node_modules/**/.* | |||
!deps/npm/node_modules |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably not go in the dotfiles section?
src/inspector/node_inspector.gypi
Outdated
], | ||
}, | ||
], | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing newline
'<(SHARED_INTERMEDIATE_DIR)', | ||
'<(SHARED_INTERMEDIATE_DIR)/src', # for inspector | ||
], | ||
'includes' : [ 'src/inspector/node_inspector.gypi' ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would be more consistent if we also had e.g. the main sources list for src/
in src/node.gypi
or similar…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's high on my backlog.
Might also have a compile only target for /src/
similar to v8_base
, then do the linking in node_lib
. So you can run compile with no dependencies by running make -C out node_base
common.gypi
Outdated
@@ -367,7 +367,6 @@ | |||
'ldflags': [ '-pthread' ], | |||
}], | |||
[ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', { | |||
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this disable the warnings by default for addons? That would be pretty bad…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't exactly disable, it "un-enables", but yes it changes default behaviour.
This does bring up the issue of common.gypi
not exactly being the right fix for addons (nodejs/node-gyp#1118)
Authors could set their own warning level in the addons binding.gyp
.
If you think this should not change for addons, I could try to figure out another mechanism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you okay with leaving that out of this PR? We can revisit it once something has happened along the lines of the PR you linked…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
They were all developed together as a basis for #22920, but I figured they could benefit |
A number of small PRs are usually a lot easier to review than a single PR with an impressive +679/−777 diff, especially when the commits in it are largely independent. |
Ohh it grew that big because of the moves. |
4c766d6
to
9ee211e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM.
Single windows fail (not ok 582 sequential/test-gc-http-client) is #22336 Another resume: https://ci.nodejs.org/job/node-test-commit/21946/ |
node.gyp
Outdated
], | ||
}, | ||
], | ||
}, # end node_js2c | ||
}, # node_lib_target_name | ||
{ # generate ETW header and resource files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nit: This comment might look better in the previous line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.WriteLn('%s: %s' % ('.INTERMEDIATE', intermediate)) | ||
self.WriteLn('%s: %s%s' % | ||
(intermediate, ' '.join(inputs), force_append)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
force_append
is actually printed in all the other control paths of this if..else
ladder. Why remove it only here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if clause if for an action with multiple outputs (the only case that uses an intermediate target). This structure causes the action to always rerun.
AFAICT it's because the XXXXXX.intermediate
file doesn't have a build rule, it is always touched which causes the targets that depend of it to be re made.
Prerequisite 'FORCE_DO_CMD' of target '19ae1b9357ee828c575655f479c768b510a5ca14.intermediate' does not exist.
Must remake target '19ae1b9357ee828c575655f479c768b510a5ca14.intermediate'.
make: Entering directory '/mnt/d/code/node/out'
touch 19ae1b9357ee828c575655f479c768b510a5ca14.intermediate
Prerequisite '19ae1b9357ee828c575655f479c768b510a5ca14.intermediate' is newer than target '/mnt/d/code/node/out/Debug/obj/gen/src/inspector/protocol/Forward.h'.
Must remake target '/mnt/d/code/node/out/Debug/obj/gen/src/inspector/protocol/Forward.h'.
Successfully remade target file '/mnt/d/code/node/out/Debug/obj/gen/src/inspector/protocol/Forward.h'.
Prerequisite '19ae1b9357ee828c575655f479c768b510a5ca14.intermediate' is newer than target '/mnt/d/code/node/out/Debug/obj/gen/src/inspector/protocol/Protocol.cpp'.
Must remake target '/mnt/d/code/node/out/Debug/obj/gen/src/inspector/protocol/Protocol.cpp'.
Successfully remade target file '/mnt/d/code/node/out/Debug/obj/gen/src/inspector/protocol/Protocol.cpp'.
I tested the generated makefile, and it seems to still work as expected after this change. (touching a dependency of the action, touching an output, and deleting a generated output).
Anyway I'll document this.
e603a9b
to
5d8373a
Compare
Don't add `force_append` (FORCE_DO_CMD) to the intermediate sentinal. Adding it makes the action run alway, even when there are no changes. (refack): AFAICT because `*.intermediate` files don't have build rules. PR-URL: #23156 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Puts the compilation target upfront for easy reading. PR-URL: #23156 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
PR-URL: #23156 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Run `node_js2c` and `mkssldef` as actions and not as targets makes sure they are run only once, just before processing the rest of `node_lib`. This helps `make` based dependency change detection be more accurate. Add comments with tagrget names for readability. Use `process_outputs_as_sources` for automatic inclution of outputs. PR-URL: #23156 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
* Make inspector.gypi and v8_external_snapshot.gypi includible targets. * Make `v8_dump_build_config` an action * Better separate `js2c` and `natives_blob` * process action outputs as sources * trigger v8.gyp:postmortem-metadata from v8.gyp PR-URL: nodejs#23182 Refs: nodejs#23156 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
* explicitly unignore files that we track. The following are not created anymore (only as subdirs of v8/gypfiles) /deps/v8/src/debug/obj deps/v8/src/Debug/ deps/v8/src/Release/ deps/v8/src/inspector/Debug/ deps/v8/src/inspector/Release/ PR-URL: nodejs#23180 Refs: nodejs#23156 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* Make inspector.gypi and v8_external_snapshot.gypi includible targets. * Make `v8_dump_build_config` an action * Better separate `js2c` and `natives_blob` * process action outputs as sources * trigger v8.gyp:postmortem-metadata from v8.gyp PR-URL: #23182 Refs: #23156 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
* explicitly unignore files that we track. The following are not created anymore (only as subdirs of v8/gypfiles) /deps/v8/src/debug/obj deps/v8/src/Debug/ deps/v8/src/Release/ deps/v8/src/inspector/Debug/ deps/v8/src/inspector/Release/ PR-URL: #23180 Refs: #23156 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* explicitly unignore files that we track. The following are not created anymore (only as subdirs of v8/gypfiles) /deps/v8/src/debug/obj deps/v8/src/Debug/ deps/v8/src/Release/ deps/v8/src/inspector/Debug/ deps/v8/src/inspector/Release/ PR-URL: #23180 Refs: #23156 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
* Make inspector.gypi and v8_external_snapshot.gypi includible targets. * Make `v8_dump_build_config` an action * Better separate `js2c` and `natives_blob` * process action outputs as sources * trigger v8.gyp:postmortem-metadata from v8.gyp PR-URL: #23182 Refs: #23156 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
* explicitly unignore files that we track. The following are not created anymore (only as subdirs of v8/gypfiles) /deps/v8/src/debug/obj deps/v8/src/Debug/ deps/v8/src/Release/ deps/v8/src/inspector/Debug/ deps/v8/src/inspector/Release/ PR-URL: #23180 Refs: #23156 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This is a spin off from work I did for integrating V8 7.1 (#22920), but this part works with
master
to reduce cases of unneeded rebuildmake && make
will do a lot of work twice.This also fixes a few small bugs.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes