9

Trying to upgrade Node.js from 0.10.x to 0.12.0. The first thing noticed is that I am getting an error that SSE2 instructions are not supported by my CPU (indeed they are not).

Tried to compile Node.js from sources but it failed for the same reason. In deps/v8/src/ia32/assembler-ia32.cc there is a line stating

CHECK(cpu.has_sse2());  // SSE2 support is mandatory.

I wonder if there is a way to get rid of this SSE2 dependency which was not required in Node.js 0.10.x. Just commenting out this line does not help, it throws an Illegal instruction error during make process.

Kenan
  • 2,086
  • 1
  • 16
  • 20
Pavel Lobodinský
  • 1,028
  • 1
  • 12
  • 25
  • 1
    I have read the article at http://comments.gmane.org/gmane.comp.lang.javascript.v8.general/7797 . Still wonder if there is a way to compile Node.js on my old CPU which runs Node.js apps just fine. – Pavel Lobodinský Mar 15 '15 at 22:21
  • Is it really `npm` that requires the instructions? The file path you've posted is to Node.js's dependency V8 (the JavaScript engine)... so this is an issue with you building V8, essentially? – Kenan Mar 18 '15 at 12:04
  • 1
    You are correct, it is V8 issue. – Pavel Lobodinský Mar 18 '15 at 17:54
  • Should probably take this up with the V8 development group. I'm not sure there's a fix for this. Have you tried using [iojs](https://iojs.org/) as an alternative? Also what CPU doesn't support this? SSE2 has been around for quite a while now, it was introduced with the Pentium 4 in 2001. – tadman Mar 18 '15 at 17:59
  • @tadman What about a Raspberry Pi running Node.js? They don't have SSE2 instructions. V8 is targeted for desktops I understand, but the code with the SSE Instructions should not be enforced, but instead optional. – AlexandruB Mar 18 '15 at 18:16
  • That's an ARM processor, so the back-end is completely different and SSE is not a factor. If you look more closely you'll probably see that section is implemented differently. In 2015 it's pretty reasonable to mandate SSE2 support if it provides a useful performance gain, 98%+ of desktops and servers out there will have it. – tadman Mar 18 '15 at 18:17
  • @tadman I have a mini-itx server with Via Epia EK800. It is a fan-less board energy efficient. So no sense to get rid of it, Linux runs just great on this machine. Anyway, not sure why SSE2 is not enabled during compile time only when available. – Pavel Lobodinský Mar 19 '15 at 02:56
  • 1
    I know nothing about V8, but reading some online articles makes me think that this has to do with the code generation performed by V8 (that is, V8 emits machine instructions that are directly executed by your CPU.) If this is the case, it is understandable why they removed it. Although it would be nice if there's instructions on how to apply patches to restore that support for one's own build. – rwong Nov 12 '15 at 04:51

1 Answers1

6

From slide 14 of this presentation: V8 engine of Node.js on IA: JavaScript-JITTED x86 machine code mapping profiling support and X87 Quark processor enabling

You'll need to compile from sources.

Do this:

./configure –dest-cpu=ia32

And add this line to the options in config.gypi file:

'v8_target_arch': 'x87',

Run make.

Basically there is port of V8 to this CPU, it's with the instruction set of old Pentiums (i586).

It works for me with Node v5.11.0 and CPU AMD Geode LX800.

Vojtěch Sázel
  • 538
  • 6
  • 22
  • Just tried this on Node v5.4.1 and worked. Didn't work on v8.5.0 – Nick Shvelidze Sep 22 '17 at 09:27
  • It works with Node 6.12.3 and 7.10.1 on a IOT2040 (Intel Quark CPU). **I'm currently looking for the latest version where it was working.** The v8_target_arch='x87' support has been officially removed in V8 6.1.534, see [link](https://chromium-review.googlesource.com/c/v8/v8/+/575756). That means Node 8.6 is the latest version where it could work, but unfortunately I get X87 related build error with 8.0, 8.3, 8.4, 8.5 and 8.6. – Michael Dreher Apr 09 '18 at 11:59