[GUIDE] Compile NodeJS to ARMv7

Post Reply
insid3r
Posts: 7
Joined: Thu Jan 23, 2014 7:18 pm
languages_spoken: english
ODROIDs: XU-Lite + 8Gb eMMC
Contact:

[GUIDE] Compile NodeJS to ARMv7

Unread post by insid3r » Thu Jan 23, 2014 8:02 pm

What is NodeJS
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
@http://nodejs.org/

How To Install
This installation was performed on ODROID XU Lite running Ubuntu Server 13.09

Install dependencies

Code: Select all

sudo apt-get install python build-essential
Download NodeJS

Code: Select all

wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
tar xzvf node-v0.10.24.tar.gz
Configure

Code: Select all

cd node-v0.10.24
./configure --without-snapshot
Compile

Code: Select all

make
./node -v #If version is returned than 'make' was OK
make install
Hope this guide helps you get the last NodeJS version to work on odroid device.

kibergus
Posts: 401
Joined: Sat Feb 23, 2013 11:23 pm
languages_spoken: english, russian
ODROIDs: U2 X2
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by kibergus » Thu Jan 23, 2014 9:01 pm

Using make install for installing packages is not the right way in modern distributions. Consider using
https://help.ubuntu.com/community/CheckInstall
which is not the right way too, but at leas is much more safer.

User avatar
peepo
Posts: 76
Joined: Mon Feb 03, 2014 7:01 am
languages_spoken: English
ODROIDs: U3 eMMC, XU lite emmc
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by peepo » Wed Feb 26, 2014 1:41 am

what tests can one run to make sure node is working properly?

I ran a js script on oDroid U3, a web server known to work on another box,

segfault

cheers

Jonathan

User avatar
venkatbo
Posts: 494
Joined: Mon Feb 25, 2013 3:10 pm
languages_spoken: english
ODROIDs: C0/C1+/C2; U3+; XU3-Lite/XU4; H2; VU/VU7+; Touchscreen Show TFT Cloudshell SmartPower mAHRS DAC GPS Multiscope Ocam
Location: Bay Area, California
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by venkatbo » Wed Sep 17, 2014 3:30 pm

Here is an updated version of this guide...

Update system:
Install essential build tools and environment (even if partially missing), using the single-line command:

Code: Select all

# one-line
$ sudo apt-get install python g++ make auto-apt checkinstall fakeroot build-essential
Fetch the recent version is (0.10.29 as of testing the steps):
In your home directory, create the following sub-directories and change to the deepest level:

Code: Select all

$ mkdir nodejs && cd nodejs/
$ mkdir src && cd src/
Then fetch the recent source tar-ball, and unpack it, using the following commands:

Code: Select all

$ wget -N http://nodejs.org/dist/node-latest.tar.gz
$ tar xzvf node-latest.tar.gz
$ cd node-v0.10.29/
The latest version may be different from above.

Configure & build package:
Configure the source tree using the command (shows output):

Code: Select all

$ sudo auto-apt run ./configure

Entering auto-apt mode: ./configure
Exit the command to leave auto-apt mode.
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'arm_fpu': 'vfpv3',
                 'arm_neon': 0,
                 'armv7': 1,
                 'clang': 0,
                 'gcc_version': 48,
                 'host_arch': 'arm',
                 'node_install_npm': 'true',
                 'node_prefix': '',
                 'node_shared_cares': 'false',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_unsafe_optimizations': 0,
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'node_use_systemtap': 'false',
                 'python': '/usr/bin/python',
                 'target_arch': 'arm',
                 'v8_enable_gdbjit': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_use_arm_eabi_hardfloat': 'true',
                 'v8_use_snapshot': 'true'}}
creating  ./config.gypi
creating  ./config.mk
Build and install using the following single-line command (shows output):

Code: Select all

# one-line
$ sudo fakeroot checkinstall -y --install=no --pkgversion $(echo $(pwd) | sed -n -re's/.+node-v(.+)$/\1/p') make -j$(($(nproc)+1)) install
....
 Done. The new package has been saved to

 /home/odroid/nodejs/src/node-v0.10.29/node_0.10.29-1_armhf.deb
 You can install it in your system anytime using:

      dpkg -i node_0.10.29-1_armhf.deb
....
Note that all commands, if not explicitly listed in multiple lines, are always in one single line. Also note the use of tools such as auto-apt, faketool, checkinstall, including enablement of openssl, etc.

Install built package:
First, check to ensure that the debian package is created ok, using the command:

Code: Select all

$ ls -ltr
...
-rw-r--r--  1 root   root    3688430 Jul 30 15:03 node_0.10.29-1_armhf.deb
...
Then install it using the command:

Code: Select all

$ sudo dpkg -i node_0.10.29-1_armhf.deb
If all is well so far, you can skip the rest of this section.

However, in case you encounter problems with the above process, you can an option involving the following commands:

Code: Select all

$ sudo apt-get install python g++ make checkinstall fakeroot
$ src=$(mktemp -d) && cd $src
$ wget -N http://nodejs.org/dist/node-latest.tar.gz
$ tar xzvf node-latest.tar.gz && cd node-v*
$ ./configure

# one-line
$ sudo fakeroot checkinstall -y --install=no --pkgversion $(echo $(pwd) | sed -n -re's/.+node-v(.+)$/\1/p') make -j$(($(nproc)+1)) install
$ sudo dpkg -i node_*
Check installation:
Check the successful installation using the commands:

Code: Select all

$ which node
/usr/local/bin/node

$ node --version
v0.10.29
Create test sample:
Create a subdirectory and the sample javascript file to be run, using the commands:

Code: Select all

$ mkdir sample
$ cd sample/
$ touch hello-world.js
$ chmod +x hello-world.js
$ medit hello-world.js
Add the following file contents to the sample javascript file:

Code: Select all

var http = require('http');

http.createServer(function (req, res) {

  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello Odroid World\n');
 
}).listen(8090, 'your-u3-ip-address');

console.log('Server running at http://your-u3-ip-address:8090/');
Note the use of port 8090 in this case.

Test the sample:

From another device, point a browser to the url:

Code: Select all

http://your-u3-ip-address:8090/
You should see the following basic page (coded in the sample javascript file above):
node-hw.jpg
node-hw.jpg (14.91 KiB) Viewed 8566 times
Figure 1: node.js in action

HTH...

blackbee045
Posts: 2
Joined: Tue Oct 21, 2014 1:58 pm
languages_spoken: english
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by blackbee045 » Tue Oct 21, 2014 2:08 pm

what tests can one run to make sure node is working properly?

User avatar
recliq
Posts: 111
Joined: Mon Feb 25, 2013 6:07 pm
languages_spoken: english, german
ODROIDs: 2xU2 + U3 + XU3 + 2xXU4 + C2
Location: Germany
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by recliq » Tue Oct 21, 2014 8:16 pm

blackbee045 wrote:what tests can one run to make sure node is working properly?
The post before yours contains a small sample...

New2LinuxOnARM
Posts: 4
Joined: Thu Sep 03, 2015 6:05 am
languages_spoken: english
ODROIDs: Odroid C1+,
Odroid XU4
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by New2LinuxOnARM » Wed Nov 11, 2015 10:37 am

Does this guide still fit for current odroid models like xu4 and c1(+)?

thx in advance for answer

New2

User avatar
peepo
Posts: 76
Joined: Mon Feb 03, 2014 7:01 am
languages_spoken: English
ODROIDs: U3 eMMC, XU lite emmc
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by peepo » Wed Nov 11, 2015 2:09 pm

have no definitive answer, ie send me the box... but

"The XU4 is fully software compatible with XU3!"

if you have no experience with nodeJS may be worth testing first on another system

I found XU3 lite very stable with nodeJS over some years and upgrades

wongda
Posts: 2
Joined: Wed Nov 18, 2015 6:41 am
languages_spoken: english
ODROIDs: xu4
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by wongda » Sun Nov 22, 2015 12:49 am

what's wrong with just using nvm?

curl -o- https://raw.githubusercontent.com/creat ... install.sh | bash

kbsymanz
Posts: 18
Joined: Mon Nov 10, 2014 7:36 pm
languages_spoken: english
ODROIDs: XU3 Lite, C1
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by kbsymanz » Tue Aug 02, 2016 10:08 am

For anyone who wants NodeJS on an ODroid, NodeJS now has binaries for various ARM architectures.

Verify the architecture with

Code: Select all

uname -m
then download as appropriate from https://nodejs.org/dist/

For example, getting one of the v4.x versions. (The latest v6.x is also available.)

Code: Select all

wget -c https://nodejs.org/dist/latest-v4.x/node-v4.4.4-linux-armv7l.tar.gz
Then install with this:

Code: Select all

sudo tar -xzf node-v4.4.4-linux-armv7l.tar.gz --strip-components=1 --group=root --no-same-owner -C /usr/local/

Gabdev
Posts: 22
Joined: Thu Oct 27, 2016 11:43 pm
languages_spoken: english
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by Gabdev » Thu Oct 27, 2016 11:50 pm

I've pushed the binary for ARMv7 on ODROID XU4 but when I try to run it, I keep getting the message : "./node: No such file or directory"
Does anyone have an idea of the cause? How could I solve that issue?

danielo515
Posts: 1
Joined: Tue Mar 15, 2016 2:42 am
languages_spoken: english, spanish
ODROIDs: C1
Contact:

Re: [GUIDE] Compile NodeJS to ARMv7

Unread post by danielo515 » Mon Dec 26, 2016 5:54 pm

kbsymanz wrote:For anyone who wants NodeJS on an ODroid, NodeJS now has binaries for various ARM architectures.

Verify the architecture with

Code: Select all

uname -m
then download as appropriate from https://nodejs.org/dist/

For example, getting one of the v4.x versions. (The latest v6.x is also available.)

Code: Select all

wget -c https://nodejs.org/dist/latest-v4.x/node-v4.4.4-linux-armv7l.tar.gz
Then install with this:

Code: Select all

sudo tar -xzf node-v4.4.4-linux-armv7l.tar.gz --strip-components=1 --group=root --no-same-owner -C /usr/local/
Worked perfectly for me. Installed v7 without problems. Thank you very much.

Post Reply

Return to “Ubuntu (All Linux'es)”

Who is online

Users browsing this forum: No registered users and 3 guests