Skip to content
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,win: re-enable ninja & multiple build optimizations #22698

Merged
merged 3 commits into from
Sep 12, 2018

Conversation

refack
Copy link
Contributor

@refack refack commented Sep 5, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform. labels Sep 5, 2018
@refack refack changed the title build,win: multiple build optimizations build,win: re-enable ninja & multiple build optimizations Sep 5, 2018
vcbuild.bat Outdated Show resolved Hide resolved
@refack refack force-pushed the win-build-cleanup branch 2 times, most recently from a8638d0 to e705961 Compare September 5, 2018 00:37
@@ -269,23 +269,11 @@
'msvs_settings': {
'VCCLCompilerTool': {
'StringPooling': 'true', # pool string literals
'DebugInformationFormat': 3, # Generate a PDB
'DebugInformationFormat': 1, # /Z7 embed info in .obj files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently publish the pdb, e.g. https://nodejs.org/dist/v10.9.0/win-x64/node_pdb.zip so this is semver-major?

cc @nodejs/platform-windows @nodejs/diagnostics

Copy link
Member

@richardlau richardlau Sep 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also

node/vcbuild.bat

Lines 372 to 378 in 4cea01a

echo Creating node_pdb.7z
del node_pdb.7z > nul 2> nul
7z a -mx9 -t7z node_pdb.7z node.pdb > nul
echo Creating node_pdb.zip
del node_pdb.zip > nul 2> nul
7z a -mx9 -tzip node_pdb.zip node.pdb > nul

which is only run on the CI for releases (not for regular PR's).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh. This generates a .pdb file but only a single one during linking.

vcbuild.bat Outdated
set "msbcpu=/m:2"
if "%NUMBER_OF_PROCESSORS%"=="1" set "msbcpu=/m:1"
set "msbcpu=/maxcpucount"
if defined NUMBER_OF_PROCESSORS set "msbcpu=%msbcpu%:%NUMBER_OF_PROCESSORS%"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will exhaust the memory available in some machines (including our CI). Ref 6cfedf0 and #12184 (comment) . I tested this extensively when I made this change, to find the best combination that uses a reasonable number of threads, and this was the best. CL will use one thread for each processor, but since some of our projects are quite small this helps a lot. If we did it the other way around, not limiting here and limiting in CL, V8 would keep compiling long after everything else finished.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my 4 CPU box this does not affect compilation time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll continue testing this, but meanwhile I'll remove this from this PR.

node.gyp Outdated

# - "C4244: conversion from 'type1' to 'type2', possible loss of data"
# Ususaly safe. Disable for `dep`, enable for `src`
'msvs_disabled_warnings!': [4244],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test yet, but this looks quite nice. Is it possible to simply set a much lower warning level for deps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been thinking about that, the problem is common.gypi is used by node-gyp so I didn't want to make a big change without further testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was needed in L482 as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test yet, but this looks quite nice.

output is filled with:

d:\code\node\src\node_internals.h(321): warning C4244: 'argument': conversion from 'const uint64_t' to 'const NativeT', possible loss of data

@refack refack force-pushed the win-build-cleanup branch 2 times, most recently from 209a88a to 84bed12 Compare September 5, 2018 13:45
@refack
Copy link
Contributor Author

refack commented Sep 5, 2018

@Fishrock123
Copy link
Contributor

Could you describe this a bit more? Why are these required to re-enable ninja builds?

@refack
Copy link
Contributor Author

refack commented Sep 6, 2018

Could you describe this a bit more? Why are these required to re-enable ninja builds?

  1. 'DebugInformationFormat': 1, # /Z7 embed info in .obj files
    That's to enable clcache (https://github.com/frerich/clcache#how-clcache-works)
  2. Merging the msvs_disabled_warnings, and adding 4244 to all targets, except node and
    node_lib
  3. removing the \lib\ prefix from /WHOLEARCHIVE:<(PRODUCT_DIR)\\lib\\:
    1. It's unnecessary, WHOLEARCHIVE just needs the name of the library, not it's full path
    2. when building with ninja (instead of MSBuild) the libraries are outputted to: <(PRODUCT_DIR)\\obj\\, so having a wrong full path breaks linking.

@joaocgreis
Copy link
Member

This looks mostly good. @refack just two notes about the commit messages:

  • build,win: enable clcache: can you reword this to describe what it actually does? Something like build,win: generate a single PDB at link time and then mention clcache in the description.
  • build,win: unify warning exclusion: Focusing on the removed warning makes more sense to me here, something like: build,win: remove C4244 only for deps.

@refack
Copy link
Contributor Author

refack commented Sep 11, 2018

https://ci.nodejs.org/job/node-test-commit-windows-fanned/20664/

@joaocgreis updated messages
@nodejs/platform-windows @nodejs/build-files PTAL

Copy link
Member

@joaocgreis joaocgreis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @refack!

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 11, 2018
* Fixes ninja build

PR-URL: nodejs#22698
Reviewed-By: João Reis <reis@janeasystems.com>
* previusly set to generate a .pdb file for each .obj file
* enables clcache

PR-URL: nodejs#22698
Reviewed-By: João Reis <reis@janeasystems.com>
* also unify warning exclusion directive

PR-URL: nodejs#22698
Reviewed-By: João Reis <reis@janeasystems.com>
@refack
Copy link
Contributor Author

refack commented Sep 11, 2018

landed in
e85007f
7a10b86
54e76fb

@refack refack merged commit 54e76fb into nodejs:master Sep 12, 2018
@refack refack deleted the win-build-cleanup branch September 12, 2018 00:01
targos pushed a commit that referenced this pull request Sep 12, 2018
* Fixes ninja build

PR-URL: #22698
Reviewed-By: João Reis <reis@janeasystems.com>
targos pushed a commit that referenced this pull request Sep 12, 2018
* previusly set to generate a .pdb file for each .obj file
* enables clcache

PR-URL: #22698
Reviewed-By: João Reis <reis@janeasystems.com>
targos pushed a commit that referenced this pull request Sep 12, 2018
* also unify warning exclusion directive

PR-URL: #22698
Reviewed-By: João Reis <reis@janeasystems.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants