LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Running Node.js in Debian Chroot on Android (https://www.linuxquestions.org/questions/linux-software-2/running-node-js-in-debian-chroot-on-android-4175577143/)

Lop3 04-10-2016 10:16 PM

Running Node.js in Debian Chroot on Android
 
This might be solved, see bottom of my 2nd post in this thread.

I've been playing around with running Debian on my Android phone. It's running in a Chroot using the lil'debi app from F-Droid.

After sorting out a few hiccups, now I'm stuck trying to run node.js.

I'll start by showing node running on my bananaPi which is also an ARM CPU also running an armv7l kernel and has the exact same node binary.

$ uname -a
Linux my-bpi 3.x.xxx-bananian #1 SMP PREEMPT xxx xxx x xx:xx:xx xxx xxxx armv7l GNU/Linux

$ ls -l node
-rwxr-xr-x 1 n n 22620686 Apr 5 23:46 node

~/.nvm/versions/node/v5.10.1/bin$ ./node --version
v5.10.1

$ md5sum node
70bd7821b1c45facab2ed5b3b4016434 node

$ sha512sum node
0844256fb5b469d180cc0cee05d0ffd572d03c97f09d7e031f8f4a248ade977420c431584bd6c8308f4963cb4f6f9a9494c0 96fe561fae00d9978fcb1fb47527

$ file --version
file-5.11

$ file node
node: ELF 32-bit LSB executable, ARM, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0xbb627e23ee82b1e1579120eb4d87347e422b92b5, not stripped

interesting parts of /proc/cpuinfo
Processor : ARMv7 Processor rev 4 (v7l)
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt

================================

Now when I try this on my Android phone

$ uname -a
Linux my-android 3.x.xx-xx-xxxxxxxx #1 SMP PREEMPT xxx xxx xx xx:xx:xx xxx xxxx armv7l GNU/Linux

~/.nvm/versions/node/v5.10.1/bin$ ls -l node
-rwxr-xr-x. 1 n n 22620686 Apr 5 21:46 node

~/.nvm/versions/node/v5.10.1/bin$ ./node --version
bash: ./node: No such file or directory

$ md5sum node
70bd7821b1c45facab2ed5b3b4016434 node

$ sha512sum node
0844256fb5b469d180cc0cee05d0ffd572d03c97f09d7e031f8f4a248ade977420c431584bd6c8308f4963cb4f6f9a9494c0 96fe561fae00d9978fcb1fb47527

$ file --version
file-5.22

$ file node
node: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.26, BuildID[sha1]=237e62bbe1b182eeeb2091577e34874db5922b42, not stripped

interesting parts of /proc/cpuinfo
Processor : ARMv7 Processor rev 0 (v7l)
Features : swp half thumb fastmult vfp edsp neon vfpv3 tls


========================================================

The BananaPi can run Node.js, and my android phone can't. Why? How can I get it working?

I see that my BananaPi has some features that my Android phone lacks: vfpv4 idiva idivt ... features regarding to arithmetic and numbers.

So I guess I've gotta compile node.js myself for this phone.

Why is it possible that debian jessie runs on both, yet node doesn't?
Is it that node.js was compiled assuming it would run on a CPU with more features than Jessie?

Lop3 04-11-2016 06:39 AM

I tried to build node.js 5.10.1 from source now (on one core) and after a few seconds it said:
g++ '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_ARMV7_INSTRUCTIONS' '-DENABLE_DISASSEMBLER' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-DICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC' -I../deps/v8 -pthread -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -mfpu=vfp -marm -O3 -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -std=gnu++0x -MMD -MF

error: #error "Your CPU's ARM architecture is not supported yet"

Hopefully I've figured it out. I've been compiling on 4 cores for about 10 mins without any errors. (it's still busy)
https://github.com/nodejs/node/issues/6144

Update:
make[1]: Leaving directory '/home/n/node-v5.10.1/out' ln -fs out/Release/node node
~/node-v5.10.1$ cd out/Release/
$ ./node --version
v5.10.1


BOOM!


All times are GMT -5. The time now is 03:40 AM.