Welcome! Log In Create A New Profile

Advanced

Node.js / nodejs on Pogoplug OX820 with Debian 9

Posted by Dieter 
Node.js / nodejs on Pogoplug OX820 with Debian 9
December 08, 2018 04:33AM
Hello,

I want to use my Pogoplug for my smart home. Unfortunately, I need node.js on it (for e.g. zigbee2mqtt).

However, I can not install is.

Using the Debian Repo I get:
yoot@FHEM:/usr/local/lib/nodejs/node-v10.14.1/bin# apt-get  install nodejs-legacy
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 nodejs-legacy : Depends: nodejs (>= 0.6.19~dfsg1-3~) but it is not installable
E: Unable to correct problems, you have held broken packages.
root@FHEM:/usr/local/lib/nodejs/node-v10.14.1/bin#

Using the binary from https://nodejs.org/en/download/ for ARMv6 I get
root@FHEM:/usr/local/lib/nodejs/node-v10.14.1/bin# node
-bash: /usr/local/lib/nodejs/node-v10.14.1/bin/node: No such file or directory
root@FHEM:/usr/local/lib/nodejs/node-v10.14.1/bin#
but the file does exist and it is executable!

And If I try to compile it from source I get
root@FHEM:~/tmp/node-v10.14.1# make
[...]
make -C out BUILDTYPE=Release V=1
  g++ -o /root/tmp/node-v10.14.1/out/Release/obj.host/v8_libbase/deps/v8/src/base/platform/platform-posix.o ../deps/v8/src/base/platform/platform-posix.cc '-DV8_GYP_BUILD' '-DV8_TYPED_ARRAY_MAX_SIZE_IN_HEAP=0' '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_ARMV7_INSTRUCTIONS' '-DV8_EMBEDDER_STRING="-node.36"' '-DENABLE_DISASSEMBLER' '-DV8_PROMISE_INTERNAL_FIELD_COUNT=1' '-DV8_INTL_SUPPORT' '-DV8_CONCURRENT_MARKING' '-DDISABLE_UNTRUSTED_CODE_MITIGATIONS' -I../deps/v8  -pthread -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -mfpu=vfp -marm -fdata-sections -ffunction-sections -O3 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF /root/tmp/node-v10.14.1/out/Release/.deps//root/tmp/node-v10.14.1/out/Release/obj.host/v8_libbase/deps/v8/src/base/platform/platform-posix.o.d.raw   -c
/tmp/cckOyleQ.s: Assembler messages:
/tmp/cckOyleQ.s:1151: Error: selected processor does not support `bkpt 0' in ARM mode
deps/v8/gypfiles/v8_libbase.host.mk:129: recipe for target '/root/tmp/node-v10.14.1/out/Release/obj.host/v8_libbase/deps/v8/src/base/platform/platform-posix.o' failed
make[1]: *** [/root/tmp/node-v10.14.1/out/Release/obj.host/v8_libbase/deps/v8/src/base/platform/platform-posix.o] Error 1
Makefile:99: recipe for target 'node' failed
make: *** [node] Error 2

Has anyone node.js running on such a system? How have you achieved this, please?

Regards, Dieter
Re: Node.js / nodejs on Pogoplug OX820 with Debian 9
December 08, 2018 04:52PM
I haven't tried to install nodejs, but isn't there just a plain nodejs package (there is for Debian 8)? Is there a reason you're trying to install nodejs-legacy?

-JT
Re: Node.js / nodejs on Pogoplug OX820 with Debian 9
December 09, 2018 05:24AM
Hallo JT,

thank you for your hint.
Yes, but this does not work either:
root@FHEM:~/tmp/node-v10.14.1# apt-get install nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package nodejs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'nodejs' has no installation candidate
root@FHEM:~/tmp/node-v10.14.1# cat /etc/ap
apparmor/   apparmor.d/ apt/
root@FHEM:~/tmp/node-v10.14.1# cat /etc/apt/sources.list
deb http://ftp.debian.org/debian stretch main stretch-backports non-free
deb-src http://ftp.debian.org/debian stretch main

deb http://security.debian.org/ stretch/updates main contrib non-free
deb-src  http://security.debian.org/ stretch/updates main contrib non-free

deb     http://http.debian.net/debian stretch-updates main contrib
deb-src http://http.debian.net/debian stretch-updates main contrib

root@FHEM:~/tmp/node-v10.14.1#

Am I missing a source?

Regards, Dieter

PS: Even adding
deb http://deb.nodesource.com/node_8.x stretch main
deb-src http://deb.nodesource.com/node_8.x stretch main
does not help. :-(



Edited 1 time(s). Last edit at 12/09/2018 09:27AM by Dieter.
Re: Node.js / nodejs on Pogoplug OX820 with Debian 9
December 09, 2018 03:00PM
I can't really help, but I did find this:
https://github.com/nodesource/distributions

It gives instructions for installing node.js.

For what it's worth, I use a Phillips Hue emulator for my home automation. It uses Python. ;-)

-JT
Re: Node.js / nodejs on Pogoplug OX820 with Debian 9
December 10, 2018 11:50AM
Hello,

is it maybe, because I need an armel binary, and all the available binaries are armhf?

I can not change to armhf, I assume, it it a cpu property, right?

Regards, Dieter
Re: Node.js / nodejs on Pogoplug OX820 with Debian 9
December 16, 2018 10:23PM
You might have an issue as the last version of nodejs I've been able to compile/get working was v0.10.48. There's apparently some issue with V8 dropping support for non-armhf processors. If this version is compatible with the software you're trying to run I've taken the liberty of writing up a quick guide to compiling it from source on your pogo:

Prerequisites:
sudo apt-get update
sudo apt-get install build-essential openssl libssl-dev pkg-config

get node source:
wget https://nodejs.org/dist/v0.10.48/node-v0.10.48.tar.gz
untar node-v0.10.48.tar.gz

make build.sh with this info:
#!/bin/sh
export CFLAGS='-march=armv5t'
export CXXFLAGS='-march=armv5t'
./configure --without-snapshot
make install

run build.sh (with sudo)

It's a very slow process (should take a couple hours at the minimum) but it should produce and install an armel compatible binary.



Edited 2 time(s). Last edit at 12/16/2018 10:51PM by alexr.
Re: Node.js / nodejs on Pogoplug OX820 with Debian 9
December 17, 2018 07:22AM
alexr Wrote:
-------------------------------------------------------
> It's a very slow process (should take a couple hours at the minimum) but it should produce and install an armel compatible binary.
>
Does it produce a .deb package for installation?
Re: Node.js / nodejs on Pogoplug OX820 with Debian 9
December 17, 2018 08:16PM
It does not. You'd need to use something like checkinstall for that. I've built it with checkinstall in the past, but I don't think it produces a .deb package that is meant to be redistributed. That said it has installed properly on several Pogoplugs for me before in the past:

https://www.dropbox.com/s/k1zbvqcdtpjpvfn/node_0.10.48-1_armel-stretch.deb?dl=0

I figured i'd provide instructions for how to compile from source yourself rather than trusting a binary I provided.
Re: Node.js / nodejs on Pogoplug OX820 with Debian 9
December 20, 2018 03:32PM
Hello alexr,

thank you very much, it worked for me.
Some hints for others:
- you will need a swap partition/file, without, my Pogo went out of memory!
- install python2.7 and type:
 ln -s /usr/bin/python2.7 /usr/bin/python
Very cool, thanks again.
Regards, Dieter
Hello,
i have Zyxel NSA325 with arm 4 CPU
  • Problem 1 is ./configure with arm CPU lower than 7 it defines CAN_USE_ARMV7_INSTRUCTIONS
  • Problem 2 is DebugBreak(),you can use gcc inline __builtin_trap()

you can try this patch

diff --git a/configure.py b/configure.py
index cfd4207d..e65cffce 100755
--- a/configure.py
+++ b/configure.py
@@ -898,7 +898,7 @@ def configure_arm(o):
     arm_fpu = 'vfpv3'
     o['variables']['arm_version'] = '7'
   else:
-    o['variables']['arm_version'] = '6' if is_arch_armv6() else 'default'
+    o['variables']['arm_version'] = '6' if is_arch_armv6() else '5'

   o['variables']['arm_thumb'] = 0      # -marm
   o['variables']['arm_float_abi'] = arm_float_abi
diff --git a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc
index 8b9e85c0..a3008ade 100644
--- a/deps/v8/src/base/platform/platform-posix.cc
+++ b/deps/v8/src/base/platform/platform-posix.cc
@@ -401,7 +401,8 @@ void OS::Abort() {

 void OS::DebugBreak() {
 #if V8_HOST_ARCH_ARM
-  asm("bkpt 0");
+  //asm("bkpt 0");
+  __builtin_trap();
 #elif V8_HOST_ARCH_ARM64
   asm("brk 0");
 #elif V8_HOST_ARCH_MIPS

Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: