Npm -v and node.js by throwing an illegal instruction on a cross compiled nodejs

I cross-compiled nodejs 0.12.2 for Atmel SAMA5D36 using the following toolchain

export AR=arm-linux-gnueabihf-ar export CC=arm-linux-gnueabihf-gcc export CXX=arm-linux-gnueabihf-g++ export LINK=arm-linux-gnueabihf-g++ 

and configured and constructed as follows

./configure --without-snapshot --dest-cpu = arm --dest-os = linux --prefix = / home / root / nodejs-v0.12.2

makeup make install DESTDIR = / home / user / Desktop / nodejs_arm / nodebins

The compiled folder is created inside / home / user / Desktop / nodejs _arm / nodebins / home / root

I compressed this folder into a tar file and transferred to the armmart AtmelSAMA5D36 board. I did not compress it on the board in the directory / home / root and created the following symbolic link

 ln -s /home/root/nodejs-v0.12.2/bin/npm /bin/npm ln -s /home/root/nodejs-v0.12.2/bin/node /bin/node 

when I test it using "node -v" and "npm -v"

"node -v" gives the correct output, but

"npm -v" throws an error "illegal instruction"

same with "node".

However, compiled nodejs 0.10.40 works completely fine.

Any help is appreciated.

Update:

 (gdb) run Starting program: /usr/bin/node [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". Program received signal SIGILL, Illegal instruction. 0xb6edfec0 in _armv7_neon_probe () from /usr/lib/libcrypto.so.1.0.0 (gdb) c Continuing. Program received signal SIGILL, Illegal instruction. 0xb6edfec8 in _armv7_tick () from /usr/lib/libcrypto.so.1.0.0 (gdb) c Continuing. [New Thread 0xb65ca4c0 (LWP 3774)] [New Thread 0xb67ca4c0 (LWP 3773)] [New Thread 0xb69ca4c0 (LWP 3772)] [New Thread 0xb6bca4c0 (LWP 3771)] Program received signal SIGILL, Illegal instruction. 0x0054b504 in v8::internal::ComputeFlagListHash() () (gdb) c Continuing. [Thread 0xb65ca4c0 (LWP 3774) exited] [Thread 0xb67ca4c0 (LWP 3773) exited] [Thread 0xb69ca4c0 (LWP 3772) exited] [Thread 0xb6bca4c0 (LWP 3771) exited] Program terminated with signal SIGILL, Illegal instruction. The program no longer exists. (gdb) q # gdb node -e 0 GNU gdb (GDB) 7.9.1 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-buildroot-linux-uclibcgnueabihf". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from node... (gdb) (gdb) run Starting program: /usr/bin/node [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". [New Thread 0xb64f84c0 (LWP 14382)] [New Thread 0xb66f84c0 (LWP 14381)] [New Thread 0xb68f84c0 (LWP 14380)] [New Thread 0xb6af84c0 (LWP 14379)] Program received signal SIGILL, Illegal instruction. 0x0054b504 in v8::internal::ComputeFlagListHash() () (gdb) (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /usr/bin/node [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/libthread_db.so.1". [New Thread 0xb653d4c0 (LWP 14531)] [New Thread 0xb673d4c0 (LWP 14530)] [New Thread 0xb693d4c0 (LWP 14529)] [New Thread 0xb6b3d4c0 (LWP 14528)] Program received signal SIGILL, Illegal instruction. 0x0054b504 in v8::internal::ComputeFlagListHash() () (gdb) Program received signal SIGILL, Illegal instruction. Undefined command: "Program". Try "help". (gdb) 0x0054b504 in v8::internal::ComputeFlagListHash() ()bt Undefined command: "0x0054b504". Try "help". (gdb) bt #0 0x0054b504 in v8::internal::ComputeFlagListHash() () #1 0x007b8a54 in v8::internal::V8::InitializeOncePerProcessImpl() () #2 0x009281b0 in v8::base::CallOnceImpl(int*, void (*)(void*), void*) () #3 0x007b8ba8 in v8::internal::V8::Initialize() () #4 0x0028fc74 in v8::V8::Initialize() () #5 0x00897a34 in node::Start(int, char**) () #6 0xb6b95634 in __uClibc_main () from /lib/libc.so.1 #7 0x00000000 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb) q 
+5
source share
1 answer

We had a similar problem trying to use nodejs 6.1.0 using the buildroot toolbinding on SAMA5D31 and ran into the same question “Invalid instruction”. Finally, we switched to version 0.10.45, which is included in buildroot for older processors (armv5 and older).

When troubleshooting, the problem occurs in the nodejs and OpenSSL libraries used by node, where the compiled code tries to use Neon instructions for floating point operations. The SAMA5D3X processor reports as armV7 but does not have a Neon FPU. However, nodejs (and openssl for us) try to use Neon instructions because it takes as armV7 which they have. As long as nodejs cannot handle non-Neon armV7, the best option is to use version <0.640 or 0.10.45 node until it is allowed. Or change the build configuration yourself for node to handle non-Neon armV7.

+2
source

All Articles