OpenWrt Forum Archive

Topic: anyone found way to install nodeJS on openWRT?

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Really want to have nodeJS installed so it is much easier to develop

This Wiki on nodeJS seems to explain how to enable to build nodeJS. However, the link on the wiki seems to be broken. Nevertheless, you can do a search nodejs openwrt on Github and find a lot of nodeJS packages for OpenWRT. It looks to me the ones from xinpascal, lixuande, and AlexMarlo seem to include the OpenWRT Makefile for the nodeJS package. To use one of them to build your own, do the following:

  1. Edit your feeds.conf file to include one of the git repos. For instance, if you choose the git repo from xinpascal, then add this line src-git xinpascal git://github.com/xinpascal/openwrt-nodejs.git to your feeds.conf file.

  2. Once you have done the above, you can execute scripts/feeds update xinpascal; scripts/feeds install nodejs

  3. Execute make menuconfig to select the nodJS packag.

  4. Run make package/nodejs/compile to compile nodeJS package.

That's all there to it.

I build Nodejs 0.12.2 for Barrier Breaker just a few days ago.
Two minor patches where required for my platform (ARM / Raspberry Pi).

You can read about it here:
  http://techfindings.one/archives/1954


The build script clearly contains stuff that is not needed there. Also, I would like to build without SSL but I had problems with that.
If you can improve (the build script) and/or replicate on other targets, please let us know smile

(Last edited by zo0ok on 27 Sep 2015, 15:23)

I have a MIPS based system and modified the makefile to remove the ARM|X86 dependencies.
I can't build it though - I guess there is a reason MIPS is excluded. Can anybody elaborate or have some tips on how I can build it for a MIPS target?


----
[...]
v8.cc:(.text+0x3c): undefined reference to `v8::internal::CPU::SetUp()'
v8.cc:(.text+0x44): undefined reference to `v8::internal::CPU::SupportsCrankshaft()'
/home/pgerten/build/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v0.10.25/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a(platform-posix.o): In function `v8::internal::init_fast_sin_function()':
platform-posix.cc:(.text+0x638): undefined reference to `v8::internal::CreateTranscendentalFunction(v8::internal::TranscendentalCache::Type)'
/home/pgerten/build/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v0.10.25/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a(platform-posix.o): In function `v8::internal::init_fast_cos_function()':
platform-posix.cc:(.text+0x690): undefined reference to `v8::internal::CreateTranscendentalFunction(v8::internal::TranscendentalCache::Type)'
/home/pgerten/build/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v0.10.25/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a(platform-posix.o): In function `v8::internal::init_fast_tan_function()':
platform-posix.cc:(.text+0x6e8): undefined reference to `v8::internal::CreateTranscendentalFunction(v8::internal::TranscendentalCache::Type)'
/home/pgerten/build/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v0.10.25/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a(platform-posix.o): In function `v8::internal::init_fast_log_function()':
platform-posix.cc:(.text+0x740): undefined reference to `v8::internal::CreateTranscendentalFunction(v8::internal::TranscendentalCache::Type)'
/home/pgerten/build/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v0.10.25/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a(platform-posix.o): In function `v8::internal::init_fast_sqrt_function()':
platform-posix.cc:(.text+0x794): undefined reference to `v8::internal::CreateSqrtFunction()'
collect2: error: ld returned 1 exit status
make[5]: *** [/home/pgerten/build/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v0.10.25/out/Release/node] Error 1
make[5]: Leaving directory `/home/pgerten/build/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v0.10.25/out'
make[4]: *** [node] Error 2
make[4]: Leaving directory `/home/pgerten/build/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v0.10.25'
make[3]: *** [/home/pgerten/build/openwrt/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/node-v0.10.25/.built] Error 2
make[3]: Leaving directory `/home/pgerten/build/openwrt/feeds/nodejs/nodejs'
make[2]: *** [package/feeds/nodejs/nodejs/compile] Error 2
make[2]: Leaving directory `/home/pgerten/build/openwrt'
make[1]: *** [/home/pgerten/build/openwrt/staging_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/stamp/.package_compile] Error 2
make[1]: Leaving directory `/home/pgerten/build/openwrt'
make: *** [world] Error 2

(Last edited by peterg on 8 May 2015, 09:05)

I don't know if this will help or not. it is also a MIPs platform.

(Last edited by mazilo on 8 May 2015, 17:11)

If we get node js running in conjunction with luciexpress then we can have a completely javascript based control. I'm a bit concerned though about the resource consumption of node under openwrt. On a desktop node can sometimes eat up a lot of memory, specially when your project depends on a bunch of npm libraries which in turn depend on others and so on. So when you launch your app you have to keep thousands of lines of javascript code in memory.

If you run node, it is probably a good idea to restrict usage to only things that are currently done in bash scripts (except node is not bash and some things are actually much easier to do in bash). So you don't have node daemons running but only start scripts that exit as soon as they are done.

I am running on a RT5350 platform. Would that be binary compatible to AR9331?

peterg wrote:

I am running on a RT5350 platform. Would that be binary compatible to AR9331?

Sorry that I can't help you on that. sad

You can try this

http://giorgiocefaro.com/blog/installin … rduino-yun

I have build node.js with my custom openwrt from source.

download node.js package from https://github.com/giorrrgio/nodejs-linino. Put it under package folder of wrt source.
make menuconfig
select node under languages sub menu (http://wiki.openwrt.org/doc/howto/nodejs#build)
save & exit
make

N.B. You must have a live internet connection while running make.

/jags

(Last edited by jagspaul on 9 May 2015, 11:29)

I have entertained myself trying to build Node.js 0.12.2 for ar71xx (same way as I successfully built for brcm2708 mentioned above).

I run into floating point problems though...
V8 is not supposed to support "soft floats" since a while ago.
I anyway attempted to build it for soft floats, but I always end up with:

# dmesg | tail -n 1
[16489.990000] FPU emulator disabled, make sure your toolchainwas compiled with software floating point support (soft-float)

In config.ar71xx_generic (for BB):
CONFIG_SOFT_FLOAT=y

As I see it there are two possible ways to get Nodejs.running
1) Building it to not use floats (unsupported by V8, but may work for a while)
2) Building it to use floats, and let Linux kernel handle that via exceptions

In the second case... do I need to
1) Rebuild toolchain and firmware from scratch?
2) Build/obtain/load just a kernel module?
3) Just active/enable FPU emulator somehow?
4) Give up, becuase this can never work anyway?

Any suggestions are appreciated. Thanks.

mkschreder wrote:

If we get node js running in conjunction with luciexpress then we can have a completely javascript based control.

I'd very much dislike a dependency on node.js. Seriously, this is embedded stuff, at some point you have to deal with low level languages, be it scripts, C or uncommon languages like Lua. I'm specifically worried about the portability of node.js to other architectures besides vanilla ARM, x86 or MIPS.

In my opinion it is the wrong approach to shove all the web environment stuff onto OpenWrt just because it is more familiar, one should work with and understand the limitations of small embedded environments and make proper tradeoffs.

jow, I agree to 100%.
OpenWrt should not be dependent on Node.js.
Node.js depends rather heavily on FPU, and typical OpenWrt targets lack FPU.

However, I find OpenWrt an interesting platform for deploying Node.js services.

Someone should contribute a Makefile to the packages feed on GitHub.

roger_ wrote:

Someone should contribute a Makefile to the packages feed on GitHub.

I think someone would, unless
- it was seriously hard to build Node.js (esp current release) for most OpenWrt targets
- many/most OpenWrt targets will never have Node.js because of lack of V8 support
- Node.js had quite poor performance on typical OpenWrt targets
- Node.js is ~15Mb when build, and does not deploy well to most OpenWrt targets

It is quite easy to build a static Node.js for x86, x86_64 and perhaps some newer ARMs using the toolchain.

In case anyone care, I built and run Node.js v0.10.38 for ramips/mt7620:
http://techfindings.one/archives/2064

Perhaps LuaNode would be more suitable for OpenWrt?

(Last edited by zo0ok on 27 Sep 2015, 15:22)

The discussion might have continued from here.