nodejs / node-addon-api

Module for using Node-API from C++
MIT License
2.16k stars 459 forks source link

Supported platforms ? #291

Closed bsrdjan closed 6 years ago

bsrdjan commented 6 years ago

Documenting nodejs addon for SAP NW RFC SDK, I try to find out platforms on which node-addon-api and N-API are supported, to cross-check with SAP NW RFC SDK supported platforms. Is such list available or could it be compiled and published?

Regarding nodejs supported platforms, is https://nodejs.org/en/download/ the right place to look for this information ?

mhdawson commented 6 years ago

I think this page best covers the supported platforms for Node.js itself which covers N-API.

https://github.com/nodejs/node/blob/master/BUILDING.md

The goal for node-addon-api is to support for the same platforms as Node.js does.

Note that if you want to build a single binary for linux (or other OS's) that will support different versions of linux you will need to take care to build on the lowest common denominator like we do for the Node.js binaries.

bsrdjan commented 6 years ago

Thanks, exactly what I was looking for.

Regarding platforms, I have two follow up questions.

For the time being I am still building three N-API binaries on Windows and three on Linux, for nodejs versions 6.14.3, 8.11.3 and 10.5.0 (ABI 48, 57 and 64). All tests show that each binary works with each node version and I could use one single binary per platform/arch.

1) Does it matter which nodejs version is used for building a single binary for platform? Should it be the latest node for example? I observe that ABI 48 and 57 binaries are diff identical and ABI 64 is 40 bytes longer on Ubuntu Linux. All behave the same however.

2) Thinking about scaling across platforms, npm install fetching platform specific binary is for users more comfortable than building from source. One single binary for Linux is not enough and even if platform builds are provided I am not sure if nodejs can on target machine find out if running on SuSE or Redhat or Ubuntu for example? Is this something that node/N-API projects could address? Or addon loaders eventually, like bindings, used in abi-stable-node-examples ?

mhdawson commented 6 years ago
  1. You should use the earliest Node.js. The contract is forward compatibility not backwards.

  2. We do build a single Node.js binary which runs across the supported Node.js linux versions (which runs on Redhat, Ubuntu, etc. provided they meet the correct dependencies). When you say one single binary for Linux (assuming a single architecture like x86) is not enough what specific problems are you running into. For the Node.js binaries we build on the 'earliest' kernel/glibc to be supported as Linux seems to support forward compatibility as well. If a single binary is not possible, then I think its probably best to address the need to select the binary based on OS in something like node-pre-gyp.

mhdawson commented 6 years ago

@bsrdjan did that answer your questions? If so can you close the issue?

bsrdjan commented 6 years ago

Yes, thanks a lot.