4

Here's the situation :

  • I have written a small node application on Windows. This application requires a few non-core node modules such as 'ffi' and 'express'. I have installed those with npm and everything works fine.

  • Now I want to port this application on an embedded build root linux distribution, which has no compiler nor internet access.

  • At first, as js is interpreted, I thought just copying the modules would do but I got 'invalid ELF header' errors so it seems those modules require compilation and are thus OS dependent.

Issue :

  • So I would like to generate those modules for this embedded linux distribution from my Windows machine.

  • I allready have the cross-compiler, as I use it for my main application on this embedded linux (via cmake and eclipse).

--> How can I generate those modules ?

Do I need is to generate a makefile which targets the right OS ? If so, how ?

Or do I need to use gyp ? If so, how ?

Is there another way ? (If absolutely necessary, I could use a linux in a virtual machine but this would make it much heavier and I'd still need cross compilation so this is the last resort).

I am a C/C++ Windows developper. I have little to no experience with Node, js and linux so please be explicit in your answers.

Thank you very much.

Darkiwi
  • 227
  • 1
  • 4
  • 14
  • *Normally* you don't need to worry about multi-platform stuff in NodeJS because the v8 runtime is running natively, executing javascript as it goes, but `ffi` is making calls to native code so you'll need to make sure [node-gyp is set up correctly on each target system](https://github.com/nodejs/node-gyp#installation) – CodingIntrigue Dec 07 '15 at 14:10
  • Thanks Graham. However, as I said, the linux I want to run my app on is embedded and has no compiler nor access to internet, this means no easy commands like npm or gyp --> I seek a way to do this on another OS (Windows) by cross-compiling. – Darkiwi Dec 07 '15 at 14:16
  • Ah I see, some related reading then for you - http://enclosejs.com/ and http://stackoverflow.com/questions/9413123/secure-distribution-of-nodejs-applications – CodingIntrigue Dec 07 '15 at 14:20
  • Thanks for your reactivity :-) However, the issue is still the same: these leads do not work with modules that require compiling :( Still searching, I'm investigating cross-compiling with node-gyp but this doesn't seem easy... – Darkiwi Dec 07 '15 at 14:48
  • I only know what I read 3-4 yrs ago, but `mingw` user groups have many discussions about cross-compiling (using gcc). See http://mingw.5.n7.nabble.com/MinGW-User-f3.html for a very searchable interface to those discussons. Good luck. – shellter Dec 07 '15 at 17:10

1 Answers1

0

For information, it appears it's not possible, we've had to abandon this method and do something else.

Darkiwi
  • 227
  • 1
  • 4
  • 14