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

Migrate NAN to NAPI #5

Open
sabman opened this issue Dec 23, 2021 · 4 comments
Open

Migrate NAN to NAPI #5

sabman opened this issue Dec 23, 2021 · 4 comments
Assignees

Comments

@sabman
Copy link
Member

sabman commented Dec 23, 2021

Migrate the code from the carto branch which used NAN to NAPI.

@2021-12-30 21:03:23 +01:00 working branch: v4.5.0-mapnik-v3.6.2-carto

@sabman sabman assigned sabman and ahmedbaig and unassigned ahmedbaig Dec 23, 2021
@sabman
Copy link
Member Author

sabman commented Jan 4, 2022

  1. install mapnik
git checkout mapnik-v3.0.24-v3.0.15-carto
PYTHON=python2 ./configure CXX=g++ CC=gcc
# in Makefile change PYTHON=python to PYTHON=python2
  1. install node-mapnik
git checkout v4.5.0-mapnik-v3.6.2-carto
make 

Getting the following error right now

../src/mapnik_vector_tile_query.cpp:493:57: note: candidate function not viable: no known conversion from 'query_hit' to 'int &' for 1st argument
        std::sort(hit.second.begin(), hit.second.end(), [](auto const& a, auto const& b) {
                                                        ^
../src/mapnik_vector_tile_query.cpp:493:57: note: conversion candidate of type 'void (*)(int &, int &)'
11 errors generated.
make[2]: *** [mapnik.target.mk:264: Release/obj.target/mapnik/src/mapnik_vector_tile_query.o] Error 1
make[2]: Leaving directory '/app/node-mapnik/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.4.0-91-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--ENABLE_GLIBC_WORKAROUND=true" "--enable_sse=true" "--loglevel=error" "--clang" "--module=/app/node-mapnik/lib/binding/mapnik.node" "--module_name=mapnik" "--module_path=/app/node-mapnik/lib/binding" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /app/node-mapnik
gyp ERR! node -v v12.22.8
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --ENABLE_GLIBC_WORKAROUND=true --enable_sse=true --loglevel=error --clang --module=/app/node-mapnik/lib/binding/mapnik.node --module_name=mapnik --module_path=/app/node-mapnik/lib/binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/app/node-mapnik/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1022:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
node-pre-gyp ERR! System Linux 5.4.0-91-generic
node-pre-gyp ERR! command "/usr/bin/node" "/app/node-mapnik/node_modules/.bin/node-pre-gyp" "configure" "build" "--ENABLE_GLIBC_WORKAROUND=true" "--enable_sse=true" "--loglevel=error" "--clang"
node-pre-gyp ERR! cwd /app/node-mapnik
node-pre-gyp ERR! node -v v12.22.8
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --ENABLE_GLIBC_WORKAROUND=true --enable_sse=true --loglevel=error --clang --module=/app/node-mapnik/lib/binding/mapnik.node --module_name=mapnik --module_path=/app/node-mapnik/lib/binding --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
make[1]: *** [Makefile:36: release_base] Error 1
make[1]: Leaving directory '/app/node-mapnik'
make: *** [Makefile:44: release] Error 2

@sabman
Copy link
Member Author

sabman commented Jan 7, 2022

Applied fix

std::sort(
  hit.second.begin(), hit.second.end(), [](query_hit const &a, query_hit const &b
) 
  { return a.distance < b.distance; });

Now hitting this compile error:

../src/mapnik_vector_tile_query.cpp: In member function ‘detail::p2p_result detail::p2p_distance::operator()(const mapnik::geometry::polygon<double, mapnik::geometry::rings_container>&) const’:
../src/mapnik_vector_tile_query.cpp:106:38: error: ‘const struct mapnik::geometry::polygon<double, mapnik::geometry::rings_container>’ has no member named ‘size’
  106 |         std::size_t num_rings = poly.size();
      |                                      ^~~~
../src/mapnik_vector_tile_query.cpp:110:36: error: no match foroperator[]’ (operand types are ‘const mapnik::geometry::polygon<double, mapnik::geometry::rings_container>’ and ‘std::size_t’ {aka ‘long unsigned int’})
  110 |             auto const& ring = poly[ring_index];
      |                                    ^
make[1]: *** [mapnik.target.mk:264: Release/obj.target/mapnik/src/mapnik_vector_tile_query.o] Error 1
make[1]: Leaving directory '/app/node-mapnik/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 5.4.0-92-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--ENABLE_GLIBC_WORKAROUND=true" "--enable_sse=true" "--loglevel=error" "--clang" "--module=/app/node-mapnik/lib/binding/mapnik.node" "--module_name=mapnik" "--module_path=/app/node-mapnik/lib/binding" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"

@artemp
Copy link

artemp commented Jan 18, 2022

@sabman you need to upgrade dependencies to later versions, see below -

image

image

sabman added a commit that referenced this issue Jan 24, 2022
@sabman
Copy link
Member Author

sabman commented Jan 24, 2022

@artemp updated dependencies (51aa691) but still running into the following error. Odd. Any ideas.

../src/mapnik_vector_tile_query.cpp:106:38: error: ‘const struct mapnik::geometry::polygon<double, mapnik::geometry::rings_container>’ has no member named ‘size’
  106 |         std::size_t num_rings = poly.size();
      |                                      ^~~~
../src/mapnik_vector_tile_query.cpp:110:36: error: no match foroperator[]’ (operand types are ‘const mapnik::geometry::polygon<double, mapnik::geometry::rings_container>’ and ‘std::size_t’ {aka ‘long unsigned int’})
  110 |             auto const& ring = poly[ring_index];

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

3 participants