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: Enable building with Ninja #6780

Closed
wants to merge 1 commit into from
Closed

build: Enable building with Ninja #6780

wants to merge 1 commit into from

Conversation

ehsan
Copy link
Contributor

@ehsan ehsan commented May 16, 2016

Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • documentation is changed or added
  • the commit message follows commit guidelines
Affected core subsystem(s)

build

Description of change

Ninja is a build backend supported by gyp which is much faster than make
and is able to parallelize builds across all of the available cores very
well. On my machine, this reduces the average build time from 5:14
minutes to 4:33 minutes.

@jbergstroem
Copy link
Member

@nodejs/build

@mscdex mscdex added the build Issues and PRs related to build files or the CI. label May 16, 2016
@MylesBorins
Copy link
Contributor

I know there is a guide that @Fishrock123 was working on.

@rvagg
Copy link
Member

rvagg commented May 16, 2016

/cc @thlorenz

I didn't think we needed anything new to make it work with ninja?

@bnoordhuis
Copy link
Member

For background/posterity, configure had a --ninja switch until 16 months ago. It was removed in de224d6 because the way it was wired up in the top-level Makefile was very inefficient.

That's not an issue when you run it as ninja -C out/Release but then you don't get the ./node symlink in the top-level directory.

@Fishrock123
Copy link
Contributor

The guide landed in core about two months ago: https://github.com/nodejs/node/blob/master/doc/guides/building-node-with-ninja.md

The above is a more reliable way of running Ninja, without having to interact with make.

On my machine, this reduces the average build time from 5:14
minutes to 4:33 minutes.

Sounds about right. If you really care about compile times, using ccache, even with make, will usually be drastically faster.


I'm not opposed to adding the configure flag for it, but you'll still need to be doing other stuff manually.

@Fishrock123
Copy link
Contributor

Fishrock123 commented May 16, 2016

Actually, in the grand scheme of things, won't you still need to run tools.gyp_node.py manually?

If so... there's not much difference:

./configure --ninja
tools/gyp_node.py
ninja -C out/Release
ln -fs out/Release/node node

vs...

./configure
tools/gyp_node.py -f ninja
ninja -C out/Release
ln -fs out/Release/node node

@ehsan
Copy link
Contributor Author

ehsan commented May 18, 2016

Actually, in the grand scheme of things, won't you still need to run tools.gyp_node.py manually?

No, configure runs it at the very end, so with this patch the second step would be unnecessary.

I'm wondering if it's possible to express creating the node symlink in the source tree root directory in gyp so that the last step would be unnecessary too? And continuing on that though train, things such as the test make target can also be expressed in gyp, so that it would work with both make and ninja as a target. But I'm digressing from the topic at hand!

FWIW, I'd be fine with just closing this PR, I was basically unaware of the guide you linked to. :)

@Fishrock123
Copy link
Contributor

Hey, I'd be all for removing a step -- this seems like a good idea to me.

@ehsan
Copy link
Contributor Author

ehsan commented May 19, 2016

Hey, I'd be all for removing a step -- this seems like a good idea to me.

Great!

So what else should I do here? I tried to move symlinking srcdir/node into gyp but the fact that for debug builds we create node_g makes that super difficult, and I haven't found the correct way to do that in gyp yet.

Should I also update the guide for building with Ninja?

@Fishrock123
Copy link
Contributor

@ehsan I'd be ok with updating the guide here with just this for now, and the investigating the other things after.

@Fishrock123
Copy link
Contributor

@nodejs/build any objections even if the configure option doesn't work with make?

@jbergstroem
Copy link
Member

@Fishrock123 seeing how the configure option refers to ninja I don't think a user should expect make to work. I guess the help text could refer to "build system" or similar to make it slightly more obvious.

@ehsan
Copy link
Contributor Author

ehsan commented May 20, 2016

Updated the guide in the new version of the patch.

parser.add_option('--ninja',
action='store_true',
dest='use_ninja',
help='generate a Ninja based build system')
Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds like it produces the build system itself, could we clarify this to be like the xcode one? (Also per @jbergstroem's comment)

@Fishrock123
Copy link
Contributor

LGTM minus a nit. :)

@ehsan
Copy link
Contributor Author

ehsan commented May 25, 2016

@Fishrock123 I originally had the string message say "generate build files for use with Ninja" to mirror the xcode message, and changed it according to my understanding of @jbergstroem's comment. Can you please let me know what string you'd prefer me to use here? Thanks!

@Fishrock123
Copy link
Contributor

I think "generate build files for use with Ninja" should be fine. If it was the originally, oops. It was probably a reaction to my comment which wasn't well grounded anyways.

Ninja is a build backend supported by gyp which is much faster than make
and is able to parallelize builds across all of the available cores very
well.  On my machine, this reduces the average build time from 5:14
minutes to 4:33 minutes.
@ehsan
Copy link
Contributor Author

ehsan commented May 26, 2016

Addressed the comment in 55321ab.

@Fishrock123
Copy link
Contributor

LGTM

Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request May 27, 2016
Ninja is a build backend supported by gyp which is much faster than
Make and is able to parallelize builds across all of the available
cores very well. On my machine, this reduces the average build time
from 5:14 minutes to 4:33 minutes.

Refs: nodejs#467
Refs: de224d6
PR-URL: nodejs#6780
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@Fishrock123
Copy link
Contributor

Fishrock123 commented May 27, 2016

Thanks! Landed in de50202 with an updated commit message of build: re-add --ninja option to configure and fixed some lines in the commit description that were beyond 72 columns wide.

Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request May 30, 2016
Ninja is a build backend supported by gyp which is much faster than
Make and is able to parallelize builds across all of the available
cores very well. On my machine, this reduces the average build time
from 5:14 minutes to 4:33 minutes.

Refs: nodejs#467
Refs: de224d6
PR-URL: nodejs#6780
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
rvagg pushed a commit that referenced this pull request Jun 2, 2016
Ninja is a build backend supported by gyp which is much faster than
Make and is able to parallelize builds across all of the available
cores very well. On my machine, this reduces the average build time
from 5:14 minutes to 4:33 minutes.

Refs: #467
Refs: de224d6
PR-URL: #6780
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@MylesBorins
Copy link
Contributor

@Fishrock123 lts?

@MylesBorins
Copy link
Contributor

ping @Fishrock123

@Fishrock123
Copy link
Contributor

lts could be good

MylesBorins pushed a commit that referenced this pull request Oct 10, 2016
Ninja is a build backend supported by gyp which is much faster than
Make and is able to parallelize builds across all of the available
cores very well. On my machine, this reduces the average build time
from 5:14 minutes to 4:33 minutes.

Refs: #467
Refs: de224d6
PR-URL: #6780
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this pull request Oct 10, 2016
Ninja is a build backend supported by gyp which is much faster than
Make and is able to parallelize builds across all of the available
cores very well. On my machine, this reduces the average build time
from 5:14 minutes to 4:33 minutes.

Refs: #467
Refs: de224d6
PR-URL: #6780
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
rvagg pushed a commit that referenced this pull request Oct 18, 2016
Ninja is a build backend supported by gyp which is much faster than
Make and is able to parallelize builds across all of the available
cores very well. On my machine, this reduces the average build time
from 5:14 minutes to 4:33 minutes.

Refs: #467
Refs: de224d6
PR-URL: #6780
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
MylesBorins pushed a commit that referenced this pull request Oct 26, 2016
Ninja is a build backend supported by gyp which is much faster than
Make and is able to parallelize builds across all of the available
cores very well. On my machine, this reduces the average build time
from 5:14 minutes to 4:33 minutes.

Refs: #467
Refs: de224d6
PR-URL: #6780
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@MylesBorins MylesBorins mentioned this pull request Oct 26, 2016
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants