Closed jampy closed 13 years ago
FYI, I had to add
conf.define('HAVE_CLOCK_SYSCALL', 1)
to deps/libev/wscript
to make Node cross-compile (as described on http://fastr.github.com/articles/cross-compiling-node.js-for-arm.html, but I only patched deps/libev/wscript
, not wscript
from the Node base directory).
Maybe that's related...
Does this still happen with 0.4.10? It's a V8 bug that I'm 95% sure has been fixed.
./configure still needs a manual patch and I'm unable to build 0.4.10:
Waf: Entering directory `/mnt/bigdrive/home/udo/Nomad/node-v0.4.10/build'
DEST_OS: linux
DEST_CPU: arm
Parallel Jobs: 1
Product type: program
[51/74] libv8.a: deps/v8/SConstruct -> build/default/libv8.a
/usr/bin/python "/mnt/bigdrive/home/udo/Nomad/node-v0.4.10/tools/scons/scons.py" -j 1 -C "/mnt/bigdrive/home/udo/Nomad/node-v0.4.10/build/default/" -Y "/mnt/bigdrive/home/udo/Nomad/node-v0.4.10/deps/v8" visibility=default mode=release arch=arm toolchain=gcc library=static snapshot=on
scons: Reading SConscript files ...
scons: warning: Ignoring missing SConscript 'obj/test/release/SConscript'
File "/mnt/bigdrive/home/udo/Nomad/node-v0.4.10/deps/v8/SConstruct", line 1201, in BuildSpecific
scons: done reading SConscript files.
scons: Building targets ...
obj/release/mksnapshot obj/release/snapshot.cc --logfile "/mnt/bigdrive/home/udo/Nomad/node-v0.4.10/build/default/obj/release/snapshot.log" --log-snapshot-positions
/bin/bash: obj/release/mksnapshot: cannot execute binary file
scons: *** [obj/release/snapshot.cc] Error 126
scons: building terminated because of errors.
Waf: Leaving directory `/mnt/bigdrive/home/udo/Nomad/node-v0.4.10/build'
Build failed: -> task failed (err #2):
{task: libv8.a SConstruct -> libv8.a}
make: *** [program] Error 1
@jampy could you submit a pull request with the patch for configure
and try building with HEAD which includes a newer build of V8.
Thanks
@sh1mmer: The configure patch was merged in ed44098.
Closing the issue, master on ARM doesn't exhibit this bug (and if it does, it should be forwarded to the V8 guys anyway - Date is a V8 object).
bnoordhuis asked: "Does this still happen with 0.4.10?".
Yes:
Linux penelope 2.6.32-5-kirkwood #1 Tue Jun 14 23:05:32 UTC 2011 armv5tel ... edavies@penelope:~$ node --version v0.4.10 edavies@penelope:~$ node
new Date() Thu, 24 Nov 2011 10:47:39 GMT new Date() undefined, 24 Nov 2011 07.2016155e-317:03.929525897e-315:42 GMT
That's a locally compiled version of nodejs built following the hint given at:
@ed-davies: v0.4.10 ships with V8 3.1.8. That's ancient history by now. Upgrade to v0.6.2, it bundles V8 3.6.6.8.
Indeed. But somebody coming across this thread might find it useful information that v0.4.10 doesn't fix the problem.
Compiling a new version is enough of a pain that people are not likely to do it unless they have a specific reason. v0.6.2 doesn't compile to something sensible for me, for example:
Patched SConfigure as per previous versions:
$ diff node-v0.6.2/deps/v8/SConstruct ../node-v0.6.2/deps/v8/SConstruct
82c82
< 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
---
> 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv5t'],
$ ./configure $ make
Compile errors to do with snapshot.cc or so. Google google.
$ make clean $ ./configure --without-snapshot $ make
Complies again, apparently clean, but:
$ ./node Illegal instruction
Google, google. Apparently I'm not alone but I didn't see a coherent answer.
I bet you a sixpack that you need to compile with -mfloat-abi=soft
.
The number 1 reason for mksnapshot
crashing or Node dying with a SIGILL is that people compile with floating point enabled for a CPU that doesn't have an floating point unit. grep fpu /proc/cpuinfo
will probably confirm that.
Sorry, no sixpack yet. /proc/cpuinfo indeed has no "fpu" string. Doesn't have a "flags:" line at all, in fact:
$ cat /proc/cpuinfo
Processor : Feroceon 88FR131 rev 1 (v5l)
BogoMIPS : 1192.75
Features : swp half thumb fastmult edsp
CPU implementer : 0x56
CPU architecture: 5TE
CPU variant : 0x2
CPU part : 0x131
CPU revision : 1
Hardware : Marvell SheevaPlug Reference Board
Revision : 0000
Serial : 0000000000000000
Just to check, a bit more context around my change to SConstruct:
$ diff -c node-v0.6.2/deps/v8/SConstruct ../node-v0.6.2/deps/v8/SConstruct
*** node-v0.6.2/deps/v8/SConstruct 2011-11-18 22:43:03.000000000 +0000
--- ../node-v0.6.2/deps/v8/SConstruct 2011-11-26 16:46:00.000000000 +0000
***************
*** 79,85 ****
},
'gcc': {
'all': {
! 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
},
'visibility:hidden': {
--- 79,85 ----
},
'gcc': {
'all': {
! 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv5t', '-mfloat-abi=soft'],
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
},
'visibility:hidden': {
Might issue #2131 be a better place to discuss this?
Sure. Keep in mind that you need to compile all of Node (not just V8) with -march=armv5t -mfloat-abi=soft
Just got node compiled on armv5tel myself... I also have to add -fno-tree-sink to CCFLAGS
NB: the requirements for the float abi stuff is required for older ARM versions. The newer ARMs (armv7-a etc.) have vpu support.
See http://code.google.com/p/v8/wiki/CrossCompilingForARM for more info.
Also see #883
I did a binary chop on Node versions using the equivalent of:
tar xvzf ../node-<version>.tar.gz
cd node-<version>
export CCFLAGS="-march=armv5t -mfloat-abi=soft -fno-tree-sink"
./configure --without-snapshot
make
./node --version
./node
new Date()
new Date()
Versions up to and including 0.5.0 exhibit the Date bug. Version 0.5.1 and beyond give "Illegal instruction". Sadly, there seems to be no happy medium where Date works and compilation is possible with what I know.
Possible workaround, put:
new Date().setHours(0);
early in the code and the problem seems to disappear, at least for a while.
With Node 0.4.8 cross-compiled for ARM I get the following output:
...meaning that the first Date object prints a valid timestamp and all consecutive calls of the same command print a silly string. I tried numerous times and it always shows the same effect. Same thing when using .toString().
Converting to milliseconds works, however:
Kernel: 2.6.26.7