Build nodejs with an alternative build system?

429 views
Skip to first unread message

Kevin Ingwersen

unread,
Mar 2, 2014, 12:42:57 AM3/2/14
to nod...@googlegroups.com
Hey.

I am thinking forth and back about an issue I have.
When somebody on windows wants to build nodejs, they need python - and python is all but small (100mb, to build a 20kb file…haha). So I was wondering: is nodejs also build-able with an alternative build system? o.o

Kind regards, Ingwie

Austin William Wright

unread,
Mar 5, 2014, 3:27:25 AM3/5/14
to nod...@googlegroups.com, ingwi...@googlemail.com
About six months ago I ported the build system to a single Makefile, less than 200 lines. The system became immensely more flexible and portable, but it became hard to keep up with the build system changes, and it's nearly impossible to compile V8 without python (I was linking against a shared library so compiling V8 wasn't necessary).

I even rewrote tools/js2c.py in bash (157 lines - not foolproof, but good enough for all the files in lib/). While the Makefile is awesome, this I did just to be crazy. The entire thing is a complete hack.

I posted the files I wrote up at https://gist.github.com/Acubed/9363269

Please let me know what you think.

Austin Wright.

Kevin Ingwersen

unread,
Mar 5, 2014, 8:36:34 AM3/5/14
to Austin William Wright, nod...@googlegroups.com
Thats very cool! :)

Why is it that V8 can barely built without Python? Its just a bunch of C++ sources - or what makes it difficult?

I am currently trying to port nodejs + deps to a build system I am contributing to.

Kind regards, Ingwie

Angel Java Lopez

unread,
Mar 5, 2014, 8:54:22 AM3/5/14
to nod...@googlegroups.com
V8 is using Gyp

"GYP is a meta build system of sorts, as it generates build files for a number of other build systems. How you build therefore depends on what "back-end" build system and compiler you're using."




--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com
To unsubscribe from this group, send email to
nodejs+un...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

---
You received this message because you are subscribed to the Google Groups "nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Kevin Ingwersen

unread,
Mar 5, 2014, 9:42:52 AM3/5/14
to nod...@googlegroups.com
That I noticed. But isnt it possible to use v8 with autotools or similar - or does it really completely rely on gyp?
I myself can’t really make myself a big fan of gyp, when python is a horrendus dependency o-o...

Ryan Dahl

unread,
Mar 5, 2014, 12:51:05 PM3/5/14
to nodejs
On Wed, Mar 5, 2014 at 9:42 AM, Kevin Ingwersen <ingwi...@googlemail.com> wrote:
That I noticed. But isnt it possible to use v8 with autotools or similar - or does it really completely rely on gyp?
I myself can’t really make myself a big fan of gyp, when python is a horrendus dependency o-o...

I agree that the python dependency is annoying, but gyp is (arguably) the most modern and established meta-build system. Aside from the fact that V8 defines it's build in gyp, gyp is revolutionary in that it defines a module system for building C libraries. GYP allows Node to generate files for working with various toolchains like visual studio, and generally abstracts a lot of difficult platform problems.

It's cute to rewrite the system with a Makefile and linking to pre-generated V8 binary, but you're ignoring large engineering goals that Node's build system solves.

Build systems are deceptively difficult. The depth of the problems are not apparent until you try to manage the build of a large x-platform app like Node.

if you're interested in learning more about this, here is a couple random readings to get you started, including some mailing list links to what I consider to be the state of the art: the recently canceled 'gn' project. (gn, btw, is the proper way to work towards moving away from the python build dependency, but even then it would be very difficult)
http://freecode.com/articles/stop-the-autoconf-insanity-why-we-need-a-new-build-system (why autoconf needs to die, written more than a decade ago)

Ryan

Ryan Graham

unread,
Mar 6, 2014, 2:31:49 PM3/6/14
to nod...@googlegroups.com
Thanks for the great list of links (and Node, btw).

I was thinking recently about the problem of cross-platform tools in general and came to the conclusion that Node (core) is doing extremely well in this regard and it is due in part to these build-time complexities. It is no small feat for an open source language/runtime to have a download page with 11 different first party binaries covering multiple options for four different operating systems.

~Ryan

--
http://twitter.com/rmgraham

Austin William Wright

unread,
Mar 16, 2014, 6:46:26 PM3/16/14
to nod...@googlegroups.com, r...@tinyclouds.org

On Wednesday, March 5, 2014 10:51:05 AM UTC-7, Ryan Dahl wrote:
On Wed, Mar 5, 2014 at 9:42 AM, Kevin Ingwersen <ingwi...@googlemail.com> wrote:
That I noticed. But isnt it possible to use v8 with autotools or similar - or does it really completely rely on gyp?
I myself can’t really make myself a big fan of gyp, when python is a horrendus dependency o-o...

I agree that the python dependency is annoying, but gyp is (arguably) the most modern and established meta-build system. Aside from the fact that V8 defines it's build in gyp, gyp is revolutionary in that it defines a module system for building C libraries. GYP allows Node to generate files for working with various toolchains like visual studio, and generally abstracts a lot of difficult platform problems.

And I rewrote most all of it in 160 or so lines of Makefile, with several additional features (casual examiners should notice I added a few variables to the Makefile to do wicked things). The output of gyp -- Makefiles supposedly built for my platform -- is several times longer than that, never mind the actual gyp files themselves.

Whatever benefits gyp might have, it doesn't seem to be helping Node.js.
 

It's cute to rewrite the system with a Makefile and linking to pre-generated V8 binary, but you're ignoring large engineering goals that Node's build system solves.

I must dissent, what I think is cute is that after we abandoned porting Node.js to Autotools, we instead settled for converting libuv. I mean, seriously?

The ability to link dynamic libraries is, of course, nothing new to Node.js, and I use it because it drops by build time down to seconds.

Likewise, I wrote that Makefile because I was solving some very real engineering goals that Node.js ignores. (js2c.sh, on the other hand, was done purely to prove a cute point.)
 

Build systems are deceptively difficult. The depth of the problems are not apparent until you try to manage the build of a large x-platform app like Node.

if you're interested in learning more about this, here is a couple random readings to get you started, including some mailing list links to what I consider to be the state of the art: the recently canceled 'gn' project. (gn, btw, is the proper way to work towards moving away from the python build dependency, but even then it would be very difficult)
http://freecode.com/articles/stop-the-autoconf-insanity-why-we-need-a-new-build-system (why autoconf needs to die, written more than a decade ago)

Ryan


I'm no fan of the current state of affairs either. Build systems still seem to be in the state that revision control systems were a decade ago. In particular, Makefiles are not by themselves a build system because they're not declarative at that the required level of abstraction.

But I haven't seen anything better.

The fact that a general purpose build system needs to be written in python is a travesty, and defining your build data with it completely violates the rule of least power.

Austin.

Reply all
Reply to author
Forward
0 new messages