Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Compiling on Raspbian - Illegal instruction #4540

Closed
DominikPalo opened this issue Jan 8, 2013 · 18 comments
Closed

Compiling on Raspbian - Illegal instruction #4540

DominikPalo opened this issue Jan 8, 2013 · 18 comments
Labels

Comments

@DominikPalo
Copy link

I tried to compile Node.JS v0.9.5 sources on Raspberry Pi (Raspbian 2012-12-16), but I got this error:

IMAG0455

Node.JS v0.8.14 works fine.

@bnoordhuis
Copy link
Member

That's probably due to the V8 upgrade. I see it's compiling with USE_EABI_HARDFLOAT=1 which is okay (I think). What is CAN_USE_VFP3_INSTRUCTIONS set to?

@TooTallNate
Copy link

Well I see -DCAN_USE_VFP3_INSTRUCTIONS in his compile flags so I'm guessing that's set to true. However, it must be set to false to work on the Raspberry Pi.

@TooTallNate
Copy link

This is fixed by v8 upstream in v8/v8@44419ad. @bnoordhuis should we back-port it to master branch?

@bnoordhuis
Copy link
Member

Yes, sure.

@TooTallNate
Copy link

Should be fixed by 438e0c6.

@Pitel
Copy link

Pitel commented Feb 26, 2013

It's back:

git pull
make clean
./configure
make
...
  LD_LIBRARY_PATH=/home/pi/node/out/Release/lib.host:/home/pi/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /home/pi/node/out/Release/obj.target/v8_snapshot/geni; "/home/pi/node/out/Release/mksnapshot" --log-snapshot-positions --logfile "/home/pi/node/out/Release/obj.target/v8_snapshot/geni/snapshot.log" --noenable_armv7 --noenable_vfp3 "/home/pi/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc"
Illegal instruction
make[1]: *** [/home/pi/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 132
make[1]: Leaving directory `/home/pi/node/out'
make: *** [node] Error 2

@bnoordhuis
Copy link
Member

@Pitel Have you tried applying the patch?

@Pitel
Copy link

Pitel commented Feb 26, 2013

Yes, the patch from 438e0c6 seems to fix it.

@bnoordhuis
Copy link
Member

Reapplied in cfacde3.

@michelepagot
Copy link

It's back
LD_LIBRARY_PATH=/home/pi/prj/node/out/Release/lib.host:/home/pi/prj/node/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /home/pi/prj/node/out/Release/obj.target/v8_snapshot/geni; "/home/pi/prj/node/out/Release/mksnapshot" --log-snapshot-positions --logfile "/home/pi/prj/node/out/Release/obj.target/v8_snapshot/geni/snapshot.log" "/home/pi/prj/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc"
Reaping winning child 0x1569cf0 PID 17151
Live child 0x1569cf0 (/home/pi/prj/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc) PID 17152
Reaping winning child 0x1569cf0 PID 17152
Live child 0x1569cf0 (/home/pi/prj/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc) PID 17154
Illegal instruction
Reaping losing child 0x1569cf0 PID 17154
deps/v8/tools/gyp/v8_snapshot.target.mk:13: recipe for target '/home/pi/prj/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc' failed
make[1]: *** [/home/pi/prj/node/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 132

I manually apply patch
pi@mypi ~/prj/node $ grep -n -r CAN_USE_VFP3_INSTRUCTIONS deps/v8/build/*
pi@mypi ~/prj/node $ grep -n -r CAN_USE_VFP2_INSTRUCTIONS deps/v8/build/*
deps/v8/build/toolchain.gypi:129: 'CAN_USE_VFP2_INSTRUCTIONS',
deps/v8/build/toolchain.gypi:134: 'CAN_USE_VFP2_INSTRUCTIONS',
deps/v8/build/toolchain.gypi:140: 'CAN_USE_VFP2_INSTRUCTIONS',
pi@mypi ~/prj/node $

but toolchain.gypi is changed
pi@mypi ~/prj/node $ grep -n -r v8_use_arm_eabi_hardfloat deps/v8/build/*
pi@mypi ~/prj/node $

@XadillaX
Copy link

creating  ./icu_config.gypi
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'arm_float_abi': 'hard',
                 'arm_fpu': 'vfpv3',
                 'arm_neon': 0,
                 'arm_thumb': 0,
                 'arm_version': '6',
                 'clang': 0,
                 'gcc_version': 46,
                 'host_arch': 'arm',
                 'icu_small': 'false',
                 'node_install_npm': 'true',
                 'node_prefix': '/home/xadillax/.nvm/versions/node/v0.12.5',
                 '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_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_mdb': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'false',
                 'openssl_no_asm': 0,
                 'python': '/usr/bin/python',
                 'target_arch': 'arm',
                 'uv_library': 'static_library',
                 'uv_parent_path': '/deps/uv/',
                 'uv_use_dtrace': 'false',
                 'v8_enable_gdbjit': 0,
                 'v8_enable_i18n_support': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_random_seed': 0,
                 'v8_use_snapshot': 'true',
                 'want_separate_host_toolset': 0}}
creating  ./config.gypi
creating  ./config.mk
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory `/home/xadillax/.nvm/src/node-v0.12.5/out'
  LD_LIBRARY_PATH=/home/xadillax/.nvm/src/node-v0.12.5/out/Release/lib.host:/home/xadillax/.nvm/src/node-v0.12.5/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /home/xadillax/.nvm/src/node-v0.12.5/out/Release/obj.target/v8_snapshot/geni; "/home/xadillax/.nvm/src/node-v0.12.5/out/Release/mksnapshot" --log-snapshot-positions --logfile "/home/xadillax/.nvm/src/node-v0.12.5/out/Release/obj.target/v8_snapshot/geni/snapshot.log" "/home/xadillax/.nvm/src/node-v0.12.5/out/Release/obj.target/v8_snapshot/geni/snapshot.cc"
Illegal instruction
make[1]: *** [/home/xadillax/.nvm/src/node-v0.12.5/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 132
make[1]: Leaving directory `/home/xadillax/.nvm/src/node-v0.12.5/out'
make: *** [node] Error 2
nvm: install v0.12.5 failed!

@feklee
Copy link

feklee commented Jul 22, 2015

Got an illegal instruction error as well:

node-v0.12.7 $ time make
[…]
ln -f "/home/pi/src/node-v0.12.7/out/Release/obj.target/deps/v8/tools/gyp/libv8_libbase.a" "/home/pi/src/node-v0.12.7/out/Release/libv8_libbase.a" 2>/dev/null || (rm -rf "/home/pi/src/node-v0.12.7/out/Release/libv8_libbase.a" && cp -af "/home/pi/src/node-v0.12.7/out/Release/obj.target/deps/v8/tools/gyp/libv8_libbase.a" "/home/pi/src/node-v0.12.7/out/Release/libv8_libbase.a")
  g++ '-DV8_TARGET_ARCH_ARM' '-DCAN_USE_VFP3_INSTRUCTIONS' '-DCAN_USE_VFP32DREGS' '-DENABLE_DISASSEMBLER' -I../deps/v8  -pthread -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -mfloat-abi=hard -marm -O3 -ffunction-sections -fdata-sections -fno-tree-vrp -fno-omit-frame-pointer -fdata-sections -ffunction-sections -O3 -fno-rtti -fno-exceptions -MMD -MF /home/pi/src/node-v0.12.7/out/Release/.deps//home/pi/src/node-v0.12.7/out/Release/obj.target/mksnapshot/deps/v8/src/mksnapshot.o.d.raw  -c -o /home/pi/src/node-v0.12.7/out/Release/obj.target/mksnapshot/deps/v8/src/mksnapshot.o ../deps/v8/src/mksnapshot.cc
  flock /home/pi/src/node-v0.12.7/out/Release/linker.lock g++ -pthread -rdynamic  -o /home/pi/src/node-v0.12.7/out/Release/mksnapshot -Wl,--start-group /home/pi/src/node-v0.12.7/out/Release/obj.target/mksnapshot/deps/v8/src/mksnapshot.o /home/pi/src/node-v0.12.7/out/Release/obj.target/deps/v8/tools/gyp/libv8_base.a /home/pi/src/node-v0.12.7/out/Release/obj.target/deps/v8/tools/gyp/libv8_nosnapshot.a /home/pi/src/node-v0.12.7/out/Release/obj.target/deps/v8/tools/gyp/libv8_libplatform.a /home/pi/src/node-v0.12.7/out/Release/obj.target/deps/v8/tools/gyp/libv8_libbase.a -Wl,--end-group -lrt
  LINK(target) /home/pi/src/node-v0.12.7/out/Release/mksnapshot: Finished
  touch /home/pi/src/node-v0.12.7/out/Release/obj.target/deps/v8/tools/gyp/postmortem-metadata.stamp
  LD_LIBRARY_PATH=/home/pi/src/node-v0.12.7/out/Release/lib.host:/home/pi/src/node-v0.12.7/out/Release/lib.target:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd ../deps/v8/tools/gyp; mkdir -p /home/pi/src/node-v0.12.7/out/Release/obj.target/v8_snapshot/geni; "/home/pi/src/node-v0.12.7/out/Release/mksnapshot" --log-snapshot-positions --logfile "/home/pi/src/node-v0.12.7/out/Release/obj.target/v8_snapshot/geni/snapshot.log" "/home/pi/src/node-v0.12.7/out/Release/obj.target/v8_snapshot/geni/snapshot.cc"
Illegal instruction
deps/v8/tools/gyp/v8_snapshot.target.mk:13: recipe for target '/home/pi/src/node-v0.12.7/out/Release/obj.target/v8_snapshot/geni/snapshot.cc' failed
make[1]: *** [/home/pi/src/node-v0.12.7/out/Release/obj.target/v8_snapshot/geni/snapshot.cc] Error 132
make[1]: Leaving directory '/home/pi/src/node-v0.12.7/out'
Makefile:45: recipe for target 'node' failed
make: *** [node] Error 2

real    2376m6.172s
user    251m55.250s
sys     8m27.430s

OS:

Linux raspberrypi 3.18.11+ #781 PREEMPT Tue Apr 21 18:02:18 BST 2015 armv6l GNU/Linux

@ghost
Copy link

ghost commented Aug 4, 2015

same issue... on 0.12.7 :(

@bnoordhuis
Copy link
Member

Does io.js work for you? You can download armv6 binaries here: https://iojs.org/dist/v2.5.0/

@fivdi
Copy link

fivdi commented Aug 4, 2015

See also http://node-arm.herokuapp.com
There are a few patched versions of Node.js there that should work too.

@ghost
Copy link

ghost commented Aug 4, 2015

Don't like binaries outside the official repos. It compiles OK at RPI2 model B but not at RPI1 model B. I will stick at RPI2 :).

Thank you very much!

@ghost
Copy link

ghost commented Jan 20, 2017

Same issue on raspbian (Jessie) with node 0.12.7

http://pastebin.com/mCZjHVAa

@cjihrig
Copy link

cjihrig commented Jan 20, 2017

Node 0.12 is end of life. Raspberry Pi is officially supported now. Please try with a recent version of Node. If you still have problems, please report them at https://github.com/nodejs/node, as this issue tracker is no longer used.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants