Native Linux and Raspberry PI compile Problems

Posted on
  • Downloaded the latest github zip v88 and compiled as LINUX on Ubuntu 16.04 (32bit) and Raspberry PI.
    Both compiled successfully.
    Linux doing ./espruino gives sanity check int-float-int error.
    Linux running simple script

    var t1 = 1000.0;
    var t5 = 5000.0;
    var v1 = setInterval(function () {
     console.log("Hello World");
    }, t1);
    var v2 = setInterval(function () {
    console.log("Hello World also");
    }, t5);
    console.log("And more");
    while(1) {
        var t = getTime() + 1;
        while(getTime() < t);

    Linux gives segmentation fault after sanity check error.
    The problem also is on earlier version v87 where I managed to compile in DEBUG mode for Ubuntu. My limited checks indicates that the jswrap_interactive around line 453 (v87) is looking for an array which dos not exist. Hence the segmentation fault.

    Running ./espruino on raspberry no sanity check problem.

    The above program however loops on the while printing every second but the setIntervals never appear. Changing t1 and t5 to 1 and 5 makes no difference.

    It appears that the main loop never lets the Interval code get a look in.

  • JavaScript is single-threaded. Busy waiting while (getTime() < t) .. blocks the execution of the setInterval callbacks - and other possible events.

    The segmentation fault is not nice. But the program above is not a useful JavaScript program.

  • I guess you're compiling on 32 bit Linux?

    There's a problem when you try and call functions that contain a 32 bit value and then a float then another 32 bit value (like setInterval) on 32 bit x86 systems - it's due to the way they get called in jsnative.c.

    While you could fix setInterval, many other things would be broken too.

    Sadly there's been no real reason to fix jsnative.c, as it works on ARM, Xtensa, and x86-64 where most people will be doing their builds.

  • Thanks will discontinue 32 bit linux work

  • Good customer ! ;-)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Native Linux and Raspberry PI compile Problems

Posted by Avatar for user61432 @user61432