Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Request: Node v12 binaries? #16418

Closed
samdelacruz opened this issue Apr 20, 2020 · 10 comments
Closed

Request: Node v12 binaries? #16418

samdelacruz opened this issue Apr 20, 2020 · 10 comments

Comments

@samdelacruz
Copy link

Would it be possible to publish binaries for node.js 12 (current LTS)? Currently only able to use the npm module with version 10.

Platform: Node.js v12.16.1
Mapbox SDK version: v5.x

Steps to trigger behavior

  1. nvm use 12
  2. npm install @mapbox/mapbox-gl-native

Expected behavior

Install succeeds

Actual behavior

Install fails:

403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/@mapbox/mapbox-gl-native/v5.0.2/node-v72-darwin-x64-Release.tar.gz
@tmpsantos
Copy link
Contributor

Hi @samdelacruz, the Node bindings are not being actively developed, that is why we are not making new releases. Unfortunately, the team working on the GL Native engine no longer has the bandwidth to maintain, test and keep up with the latest Node releases and V8 API breakages. The last patch was to blacklist Node ABI 83 because it did not compile.

Moving forward, GL Native now can be used as a CMake subproject, that is how Android and iOS are doing. I published here a skeleton of how this project could be kickstarted. I'm happy to help anyone interested on maintaining these bindings. It is not much code to be honest, but the main complexity is with dealing with V8 and NAN.

@markgis
Copy link

markgis commented Sep 2, 2020

Hi @tmpsantos, been trying to get your skeleton https://github.com/tmpsantos/mapbox-gl-native-node to work and create bindings for Node > 12 but struggling so far.

I thought a NAN version bump fixed it at first but still cant get builds past ABIS 64 working yet. Cant say I know a lot about Node bindings from C++, some of the NAN docs looked promising though in terms of dealing with the V8 changes. Any suggestions where to start on getting at least a build working?

@tmpsantos
Copy link
Contributor

Any suggestions where to start on getting at least a build working?

Hi @markgis, to be honest, I always struggled a bit with NAN. My suggestion would be to explore new avenues such as port the bindings to https://github.com/nodejs/node-addon-api, since backward compatibility seems to not be a strong requirement. It should also be a lot easier to maintain.

@markgis
Copy link

markgis commented Sep 7, 2020

Hi @tmpsantos , cant say I'm a bindings expert by any stretch, but yes I read a lot of people are moving to N-api, apparently thats a lot easier to work with.

However, when I quickly looked at it it seems Mabpox is quite heavily invested in Cmake and nan commands? Are all the compiled CPP files in https://github.com/mapbox/mapbox-gl-native/tree/master/platform/node/src transferable to a new bindings - i..e N-API. or would it have to be from https://github.com/mapbox/mapbox-gl-native/tree/master/src/mbgl ?

Also I got builds to work in Node 11 , so not sure if thats worth making a PR on Mapbox-native so at least people can jump one Node version higher if needed.

@tmpsantos
Copy link
Contributor

@markgis a new N-API bindings would replace https://github.com/mapbox/mapbox-gl-native/tree/master/platform/node/src and you can change the files we compile here https://github.com/mapbox/mapbox-gl-native/blob/master/platform/node/CMakeLists.txt.

There are a few examples on how to integrate N-API with CMake here https://github.com/nodejs/node-addon-examples/pull/113/files

@brianreavis
Copy link

For anyone interested, we forked @tmpsantos's node binding template and added support for Node 12, 13, and 14 in naturalatlas/mapbox-gl-native-node@668a290 (still using NAN). The repo is here @naturalatlas/mapbox-gl-native. It uses the EGL backend because I for the life of me couldn't get the GLX backend compiling / working on Travis.

npm install @naturalatlas/mapbox-gl-native --save

@markgis
Copy link

markgis commented Oct 12, 2020

@brianreavis Brilliant, thanks. I was just starting to look into using N-API, but its all pretty new to me.

@creimers
Copy link

@brianreavis I'm getting the following error when trying to build a docker image using @naturalatlas/mapbox-gl-native:

403 status code downloading tarball https://naturalatlas-node-binary.s3.amazonaws.com/@naturalatlas/mapbox-gl-native/v1.0.2/node-v72-linux-arm64-Release.tar.gz

Any idea why that is? Thanks.

@brianreavis
Copy link

@creimers That error is because we have not built arm binaries. We don't use the project anymore and I unfortunately don't have any time right now to devote to it. Resolving it will require forking and (1) porting the TravisCI config to use Github Actions, and (2) attempting the arm build and fixing what comes up, I think.

Another thing you could try is simply forking and removing --fallback-to-build=false from https://github.com/naturalatlas/mapbox-gl-native-node/blob/master/package.json#L18 so that pre-gyp will attempt compilation during install when you're building your docker image.

@creimers
Copy link

@brianreavis Thank you. I ended up using a different tileserver altogether: https://github.com/consbio/mbtileserver/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants