siemens / meta-iot2000

SIMATIC IOT2000 Yocto Board Support Package
Other
127 stars 85 forks source link

Node 8.x and Npm 6.x support #104

Closed meriturva closed 5 years ago

meriturva commented 5 years ago

Hi to all,

i'm trying to build a new image with latest node 8.x version and npm 6.x version.

Actually i'm able to get node 8.9.4 working correctly, main problem is npm. In that case npm just return for every command an "Illegal instruction". I'm lost on that message and i really don't know how to solve it.

Are you going to support node 8.x instead of 6.x? I'm quite new to yocto builds and for me it is really time spending to build and test on physical device that everything works. Do you have any advice how to increase test phase? What do you use during yocto development to test image on correct architecture?

Thanks!

nospam2000 commented 5 years ago

The problem is, that there is no support for MMX instructions in the Quark CPU and the Google V8 JavaScript Engine which is used in Node.js no longer supports the x87 coprocessor. The newest Node.js I could get working was the latest 7.x version. I can provide more details if you need it.

meriturva commented 5 years ago

So thanks @nospam2000 for you help!

I have made a short research and i found:

http://thread.gmane.org/gmane.comp.lang.javascript.v8.general/7797 https://chromium-review.googlesource.com/c/v8/v8/+/575756

I see that first releases of node 8.x could works because x87 support still on it. For example version 8.4.x... i tried and i get same "Illegal Function" error.

Am i right? are Node 8.4.x versions supporting x87 processor architecture (no MMX)?

nospam2000 commented 5 years ago

I tried some Node.js 8.x versions and even the oldest one didn't compile with the Google V8 x87 switch ('v8_target_arch': 'x87'), although officially the x87 support was dropped later (see here which is included in Google V8 Version 6.1.534 and Node.js 8.7.0).

Without "'v8_target_arch': 'x87'" you can compile it, but it then uses the MMX code which crashes because the CPU is missing the MMX instructions. The description of the 'x87' option can be found here.

I tried the following Node.js versions without success: 8.0.0, 8.3.0, 8.4.0, 8.5.0, 8.6.0, 9.8.0

Version 7.10.1 works, here the recipe for it:

  1. within meta-nodejs layer: (adds the version 7.10.1 to the supported versions) recipe_nodejs7_10_1_bb.tar.gz

  2. the bbappend to be put in an own layer (this is the IoT2040/Quark CPU specific patch for the x87 architecture) recipe_nodejs7_10_1_bbappend.tar.gz

I'm not sure if this is needed, but I have also changed the variables in meta-iot2000-example/conf/distro/poky-iot2000.conf to PREFERRED_VERSION_nodejs = "7.10%" PREFERRED_VERSION_nodejs-native = "7.10%"

The important part is the patch 0001-Enable-port-for-Intel-Quark-CPU.patch which is slightly different from Node.js version 6:

diff --git a/configure b/configure
index d999cfc..b77c7ba 100755
--- a/configure
+++ b/configure
@@ -867,6 +867,8 @@ def configure_node(o):
   o['variables']['host_arch'] = host_arch
   o['variables']['target_arch'] = target_arch
   o['variables']['node_byteorder'] = sys.byteorder
+  if target_arch in ('ia32'):
+    o['variables']['v8_target_arch'] = 'x87'

   cross_compiling = (options.cross_compiling
                      if options.cross_compiling is not None

Please forgive me if I missed something, I have done this in April.

meriturva commented 5 years ago

No way to make nodejs 8.x works, really sad here. We have switched back to 6.x version officially supported. Anyway so thanks @nospam2000

jan-kiszka commented 5 years ago

@meriturva Could you briefly summarize what all you tried? Just to avoid that someone else futilely retries that in the future. TIA!

meriturva commented 5 years ago

Actually we have just discussed internally about x87 support on 8.x version and mainly we have tried (without success) to build latest version of 8.4.x just to be sure to have x87 support. No way, we had few problems and error during compile time ... but mainly we are not so happy to have a node 8.x version not updated. We think that for now it is important to have a secure LTS version working (and also maintained if necessary until April 2019). Going with node 8.x means no more update on 8.4 branch for sure!

For future we have to move to a different product and architecture due to CPU architecture limit (also dotnet is not supported on x87).

jan-kiszka commented 5 years ago

See #107: We are almost there!