[Nix-dev] getting node.js to work on darwin

Sander van der Burg - EWI S.vanderBurg at tudelft.nl
Thu Mar 14 12:22:49 CET 2013


Hello everybody,

Today I was (again) struggling a bit with getting nodejs to work on Darwin. One of the things that make it so hard/annoying is the fact that V8 (the JavaScript engine) uses some kind of weird/stupid meta-build system called gyp (http://code.google.com/p/gyp) developed by Google. No idea, why they think we need yet another solution, but that's a different discussion....

On Darwin, gyp assumes that you want to generate an Xcode project and use xcodebuild to build it. I've dived a bit into the source code of gyp and I couldn't find a (simple) way to instruct gyp to just create Makefiles. In fact, it's not surprising to me if there is no way to do it all.

I have tried various things to solve it. One solution was to use xcodeenv.xcodewrapper -- a wrapper component that exposes the host system's xcodebuild utility (if installed) inside a Nix expression. Unfortunately, the v8 xcodebuild script calls g++ with a parameter: -arch, that does not seem to work with the gcc version in Nixpkgs used on Darwin.

I've also tried replacing gcc by clang on darwin, since that's what Apple is using for recent Xcode releases. Clang seems to accept the -arch parameter and to be able to compile most of the source code. However, when all object files are linked, it stops and reports some weird error showing all kinds of unresolved symbols.

The third solution was to just expose the host's g++ (which is fact clang) to the nodejs expression that's included with xcode. This option seems to compile nodejs on darwin, although it's impure.

I know that the last solution is not elegant, but it's (as far as I know) the only way to get it working on Mac. Do you mind submitting my nodejs expression? On Linux, it should still ignore these impurities.

Regards,

Sander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20130314/2d48d19b/attachment.html 


More information about the nix-dev mailing list