Wednesday, June 08, 2011

Node.js on Solaris, part 2

Here's a followup and slight correction to my notes on building node.js on Solaris 10.

If you read carefully, you'll notice that I specified --without-ssl to the configure command. This makes it build, as it looks like there's a dependency on a newer openssl than is shipped with Solaris 10. While this is good enough for some purposes, it turns out the the expresss module wants ssl (it's required, even if you don't use https, although all you have to do is delete the references).

So, a better way is to build a current openssl first and then get node to link against that. So for the openssl build:

gzcat openssl-1.0.0d.tar.gz | gtar xf -
cd openssl-1.0.0d
env CC=cc CXX=CC ./Configure --prefix=/opt/Node solaris-x86-cc shared
gmake -j 8
gmake install
I'm using the Studio compilers here, as I normally do with things like openssl that provide libraries that might be used by other tools, although gcc should work fine. The important parts here are that it matches the architecture of your other components (so 32-bit, ie x86) and you build shared libraries.

Then you can unpack and patch node as before, then configure with

env LDFLAGS=-R/opt/Node/lib CFLAGS=-std=gnu99 ./configure --prefix=/opt/Node --openssl-includes=/opt/Node/include --openssl-lib=/opt/Node/lib


Unknown said...

I have installed a few versions from and a few of your packages on my Solaris 10 box. They are all pre-built (I don't configure and build myself). When I run npm it says node is not executable, when it is, and when I run node it always gives an "Invalid Argument" error, when I have successfully tested with the same JavaScript file on Windows and Linux.

Peter Tribble said...

The most likely thing here is that you're trying to do this on a SPARC system, which won't work - Node (and v8) and the resulting prebuilt SunOS binaries are x86 only.

Scott said...

I've downloaded your package for Node.js v0.10.29 and installed it, and added /opt/Node/bin to my path. There seems to be a problem with npm:

$ node -v
$ sudo npm -v
Abort (core dumped)

Peter Tribble said...

Hm. That's clearly not right. However, I use npm and it works fine for me. I notice you're using sudo (which doesn't seem right, by the way) - does it fail when run normally?

Scott said...

I tossed in the sudo in case npm (being a package manager) needed permission to write to its package store. But it made no difference. Now I'm trying to compile it from source. I think the compilation is going ok now that I installed gcc 4.9, but the build is supplying GNU loader arguments and invoking the Sun loader.

Peter Tribble said...


Years ago, I used to have to patch the build to call the linker correctly, but that's not been necessary for a while as they added compatibility falgs to the Sun linker. So I suspect your system is well behind on patches, which might also cause binary compatibility issues.