Re: [SOLVED] node.js on qnap?
Posted: Thu Dec 29, 2011 5:59 am
Hi,
finally I've found a way to compile nodejs on QNAP for armv5te (TS-419P+ maybe also TS-419P and others using arm processors).
Just a short description, if I have some more time I will write a little howto.
The trick was to compile the v8 engine delivered with NodeJs standalone.
I downloaded the current source code from http://nodejs.org/ (v0.6.6) and followed this guide for cross compiling v8 on arm: Guide how to compile v8 on arm
meet some requirements:
Set environment:
In the sources go to:
now copy v8 to a place you want
compile and install nodejs
A little hint:
PATH variable and /etc/ld.so.conf are reset after reboot to defaults. So I used the optware init mechanism to set config and $PATH on reboot with a little init script.
Next step, build etherpad-lite on arm-QNAP
Hopes this helps someone.
Best regards,
zyclon
finally I've found a way to compile nodejs on QNAP for armv5te (TS-419P+ maybe also TS-419P and others using arm processors).
Just a short description, if I have some more time I will write a little howto.
The trick was to compile the v8 engine delivered with NodeJs standalone.
I downloaded the current source code from http://nodejs.org/ (v0.6.6) and followed this guide for cross compiling v8 on arm: Guide how to compile v8 on arm
meet some requirements:
Code: Select all
ipkg install openssl openssl-dev make gcc python27 scons
Code: Select all
## add /opt/bin to PATH
export PATH=$PATH:/opt/bin
## add /opt/lib to ldconfig
echo "/opt/lib" >> /etc/ld.so.conf
ldconfig
Code: Select all
cd deps/v8
## export the CCFLAGS to match architecture here armv5te
export CCFLAGS="-march=armv5te"
## now run scons with the following params to build v8
## armeabi=soft uses emulated software floating point unit, important for armv5te
## sample=shell builds a v8 shell (so you can test if v8 works)
scons wordsize=32 snapshot=off arch=arm armeabi=soft library=shared
scons wordsize=32 snapshot=off arch=arm armeabi=soft library=shared sample=shell
## test shell
./shell
V8 version 3.6.6.14 [sample shell]
>
Code: Select all
pwd
/share/Download/NodeJS/node-v0.6.6/deps/v8
cd ..
cp -a v8 /opt/share/.
## add library to ldconfig
echo "/opt/share/v8" >> /etc/ld.so.conf
ldconfig
Code: Select all
## go to node js src dir
cd /share/Download/NodeJS/node-v0.6.6
## run configure
./configure --shared-v8 --shared-v8-libpath=/opt/share/v8 --shared-v8-includes=/opt/share/v8/include --prefix=/opt/share/nodejs
Checking for program g++ or c++ : /opt/bin/g++
Checking for program cpp : /opt/bin/cpp
Checking for program ar : /opt/bin/ar
Checking for program ranlib : /opt/bin/ranlib
Checking for g++ : ok
Checking for program gcc or cc : /opt/bin/gcc
Checking for program ar : /opt/bin/ar
Checking for program ranlib : /opt/bin/ranlib
Checking for gcc : ok
Checking for library dl : yes
Checking for openssl : yes
Checking for library util : yes
Checking for library rt : yes
Checking for header v8.h : yes
Checking for fdatasync(2) with c++ : yes
'configure' finished successfully (2.606s)
## build
make
[...]
Waf: Leaving directory `/share/MD0_DATA/Download/NodeJS/node-v0.6.6/out'
'build' finished successfully (4m19.194s)
-rwxr-xr-x 1 admin administ 3.2M Dec 28 22:51 out/Release/node
## check if node runs :)
out/Release/node
>
make install
/opt/share/nodejs/bin/node
>
PATH variable and /etc/ld.so.conf are reset after reboot to defaults. So I used the optware init mechanism to set config and $PATH on reboot with a little init script.
Next step, build etherpad-lite on arm-QNAP
Hopes this helps someone.
Best regards,
zyclon