Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NodeJS] Are there any plans to keep up with nodejs binaries support? #52

Closed
thesocialdev opened this issue Mar 18, 2021 · 9 comments
Closed

Comments

@thesocialdev
Copy link

https://github.com/maplibre/maplibre-gl-native/tree/master/platform/node

@markgis
Copy link

markgis commented Apr 20, 2021

Node binaries of the original project stopped at Node 10, I managed to build in Node 11 but not 12. There was a fork with 12-14 bindings but I never managed to get that to work in my code.

I think it would need a refactor and maybe a change of build libraries to get the bindings working?

@markgis
Copy link

markgis commented Apr 20, 2021

mapbox/mapbox-gl-native#16485

Here is the thread.

@mnutt
Copy link
Contributor

mnutt commented May 2, 2021

I've had success with using @naturalatlas/mapbox-gl-native on node 10 and 14 / linux, but not on any version of node on macos. I'm wondering if it's related to this warning they added to CMakeLists: https://github.com/mapbox/mapbox-gl-native/blob/master/platform/node/CMakeLists.txt#L48 My experience on macos was that map rendering just hung and CFRunLoop never fired.

@savv
Copy link

savv commented Jun 15, 2021

I was able to get this to work on MacOS by replacing MacOS's loop system with libuv, like so:
In mapbox-gl-native/platform/macos/macos.cmake, I had to add this:

target_include_directories(
        mbgl-core
        PUBLIC /usr/local/opt/libuv/include/
)

Comment these out:

#        ${PROJECT_SOURCE_DIR}/platform/darwin/src/async_task.cpp
#        ${PROJECT_SOURCE_DIR}/platform/darwin/src/run_loop.cpp

And add these:

        ${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/run_loop.cpp
        ${PROJECT_SOURCE_DIR}/platform/default/src/mbgl/util/async_task.cpp

Unfortunately though, I haven't been able to get naturalatlas to run headless in a docker container... any luck with that?

@mnutt
Copy link
Contributor

mnutt commented Jun 18, 2021

I did a bunch of experimenting and got most things working here:

https://github.com/maplibre/maplibre-gl-native/compare/master...mnutt:node-14?expand=1

It looks like the node runloop support was left behind in the build system refactoring that happened in mapbox a while back; this splits a platform-dependent runloop back out into its own cmake target.

While that branch works for me, what I really wanted to do was generate prebuilt binaries and I'm having a lot of trouble paring down the dependencies; the binaries that I generate are small and have lots of linked libraries whereas the prebuilt binaries mapbox generated were quite large because they statically linked most things.

My other goal with that is to completely remove the need for xvfb on headless linux, but that has a ways to go I think.

@albanm
Copy link

albanm commented Sep 29, 2021

@mnutt did you go further in this direction ?

I am looking for a solution to include maplibre-gl-native in a docker image with a recent node version if possible. If no solution is available right now I am looking for the next best thing : some indication of where to dig deeper and solve the problem myself.

@mnutt
Copy link
Contributor

mnutt commented Oct 26, 2021

Mine works fine if you are willing to build the node module as part of the docker image build: it’ll dynamically link to a bunch of things, but they’ll be available. It’s pretty far off from being to npm install @maplibre/maplibre-gl-native from a machine with no dependencies installed, but if you just want to npm install in docker you should be ok to do so.

@mnutt
Copy link
Contributor

mnutt commented Apr 25, 2022

A lot of the work on this was completed here: #217. Last step would just be to publish the binaries and publish the package to npm to make it easy for people to npm install.

@birkskyum
Copy link
Member

https://www.npmjs.com/package/@maplibre/maplibre-gl-native

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

No branches or pull requests

6 participants