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

Failed to compile Mapnik for Node 4.0 #519

Closed
nyurik opened this issue Sep 14, 2015 · 9 comments
Closed

Failed to compile Mapnik for Node 4.0 #519

nyurik opened this issue Sep 14, 2015 · 9 comments

Comments

@nyurik
Copy link

nyurik commented Sep 14, 2015

$ nvm install v4.0.0
$ git clone https://github.com/kartotherian/kartotherian.git krt

Cloning into 'krt'...
remote: Counting objects: 1448, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 1448 (delta 0), reused 0 (delta 0), pack-reused 1444
Receiving objects: 100% (1448/1448), 298.46 KiB | 298.00 KiB/s, done.
Resolving deltas: 100% (906/906), done.
Checking connectivity... done.

$ cd krt
$ npm install

npm WARN engine [email protected]: wanted: {"node":">= 0.10.0 < 0.11.0"} (current: {"node":"4.0.0","npm":"2.14.2"})
npm WARN engine [email protected]: wanted: {"node":"0.10.x"} (current: {"node":"4.0.0","npm":"2.14.2"})
npm WARN engine [email protected]: wanted: {"node":"0.10.x"} (current: {"node":"4.0.0","npm":"2.14.2"})

> [email protected] install /home/yurik/wmf/kartotherian/krt/node_modules/bunyan/node_modules/dtrace-provider
> node scripts/install.js


> [email protected] install /home/yurik/wmf/kartotherian/krt/node_modules/mapnik
> node-pre-gyp install --fallback-to-build

make: Entering directory '/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/build'
  ACTION binding_gyp_make_vector_tile_target_generate_protoc_files Release/obj/gen/vector_tile.pb.cc
/bin/sh: 1: protoc: not found
make_vector_tile.target.mk:13: recipe for target 'Release/obj/gen/vector_tile.pb.cc' failed
make: *** [Release/obj/gen/vector_tile.pb.cc] Error 127
make: Leaving directory '/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/yurik/.nvm/versions/node/v4.0.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 3.19.0-28-generic
gyp ERR! command "/home/yurik/.nvm/versions/node/v4.0.0/bin/node" "/home/yurik/.nvm/versions/node/v4.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/lib/binding/node-v46-linux-x64/mapnik.node" "--module_name=mapnik" "--module_path=/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/lib/binding/node-v46-linux-x64"
gyp ERR! cwd /home/yurik/wmf/kartotherian/krt/node_modules/mapnik
gyp ERR! node -v v4.0.0
gyp ERR! node-gyp -v v3.0.1
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/home/yurik/.nvm/versions/node/v4.0.0/bin/node /home/yurik/.nvm/versions/node/v4.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/lib/binding/node-v46-linux-x64/mapnik.node --module_name=mapnik --module_path=/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/lib/binding/node-v46-linux-x64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:87:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:817:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Linux 3.19.0-28-generic
node-pre-gyp ERR! command "/home/yurik/.nvm/versions/node/v4.0.0/bin/node" "/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/yurik/wmf/kartotherian/krt/node_modules/mapnik
node-pre-gyp ERR! node -v v4.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.9
node-pre-gyp ERR! not ok 
Failed to execute '/home/yurik/.nvm/versions/node/v4.0.0/bin/node /home/yurik/.nvm/versions/node/v4.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/lib/binding/node-v46-linux-x64/mapnik.node --module_name=mapnik --module_path=/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/lib/binding/node-v46-linux-x64' (1)
npm ERR! Linux 3.19.0-28-generic
npm ERR! argv "/home/yurik/.nvm/versions/node/v4.0.0/bin/node" "/home/yurik/.nvm/versions/node/v4.0.0/bin/npm" "install"
npm ERR! node v4.0.0
npm ERR! npm  v2.14.2
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! This is most likely a problem with the mapnik package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls mapnik
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/yurik/wmf/kartotherian/krt/npm-debug.log
@danpat
Copy link
Contributor

danpat commented Sep 14, 2015

/bin/sh: 1: protoc: not found

You need to have the protobuf tools installed. If you're on Ubunutu, do apt-get install protobuf-compiler, for Mac OSX with Homebrew, do brew install protobuf. Then try npm install again.

@nyurik
Copy link
Author

nyurik commented Sep 14, 2015

@danpat, thanks for the quick reply. On Ubuntu, I installed protobuf-compiler 2.6.1-1, and now the error changed. Btw, it works fine for 0.10 and 0.12 versions of node, even without the protobuf-compiler.

> [email protected] install /home/yurik/wmf/kartotherian/krt/node_modules/mapnik
> node-pre-gyp install --fallback-to-build

make: Entering directory '/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/build'
  ACTION binding_gyp_make_vector_tile_target_generate_protoc_files Release/obj/gen/vector_tile.pb.cc
  ACTION binding_gyp_make_vector_tile_target_generate_setting Release/obj/gen/mapnik_settings.js
  COPY /home/yurik/wmf/kartotherian/krt/node_modules/mapnik/lib/binding/node-v46-linux-x64/mapnik_settings.js
  TOUCH Release/obj.target/make_vector_tile.stamp
  CXX(target) Release/obj.target/vector_tile/gen/vector_tile.pb.o
In file included from Release/obj/gen/vector_tile.pb.cc:5:0:
Release/obj/gen/vector_tile.pb.h:9:42: fatal error: google/protobuf/stubs/common.h: No such file or directory
 #include <google/protobuf/stubs/common.h>
                                          ^
compilation terminated.
vector_tile.target.mk:176: recipe for target 'Release/obj.target/vector_tile/gen/vector_tile.pb.o' failed
make: *** [Release/obj.target/vector_tile/gen/vector_tile.pb.o] Error 1
make: Leaving directory '/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/build'

@danpat
Copy link
Contributor

danpat commented Sep 14, 2015

@nyurik You'll also need libprotobuf-dev, sorry, I thought it would get installed with protobuf-compiler.

For Node 0.10 and 0.12, there are pre-packaged binaries that get installed. Because 4.0.0 is so new, we haven't released pre-packaged binaries, so the install is falling back to compiling from source.

@nyurik
Copy link
Author

nyurik commented Sep 14, 2015

@danpat next batch of errors:

In file included from ../src/utils.hpp:7:0,
                 from ../src/mapnik_logger.cpp:1:
../node_modules/nan/nan.h:261:25: error: redefinition of ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)’
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
                         ^
../node_modules/nan/nan.h:256:25: note: ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)’ previously declared here
 NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
                         ^
../node_modules/nan/nan.h:661:13: error: ‘node::smalloc’ has not been declared
     , node::smalloc::FreeCallback callback
             ^
../node_modules/nan/nan.h:661:35: error: expected ‘,’ or ‘...’ before ‘callback’
     , node::smalloc::FreeCallback callback
                                   ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’:
../node_modules/nan/nan.h:665:50: error: ‘callback’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                  ^
../node_modules/nan/nan.h:665:60: error: ‘hint’ was not declared in this scope
         v8::Isolate::GetCurrent(), data, length, callback, hint);
                                                            ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’:
../node_modules/nan/nan.h:672:67: error: call of overloaded ‘New(v8::Isolate*, const char*&, uint32_t&)’ is ambiguous
     return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
                                                                   ^
../node_modules/nan/nan.h:672:67: note: candidates are:
In file included from ../node_modules/nan/nan.h:25:0,
                 from ../src/utils.hpp:7,
                 from ../src/mapnik_logger.cpp:1:
/home/yurik/.node-gyp/4.0.0/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/yurik/.node-gyp/4.0.0/include/node/node_buffer.h:31:40: note:   no known conversion for argument 3 from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’
/home/yurik/.node-gyp/4.0.0/include/node/node_buffer.h:43:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match>
 NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
                                        ^
/home/yurik/.node-gyp/4.0.0/include/node/node_buffer.h:43:40: note:   no known conversion for argument 2 from ‘const char*’ to ‘char*’
In file included from ../src/utils.hpp:7:0,
                 from ../src/mapnik_logger.cpp:1:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:676:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’
     return node::Buffer::New(v8::Isolate::GetCurrent(), size);
                                                             ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’:
../node_modules/nan/nan.h:683:12: error: ‘Use’ is not a member of ‘node::Buffer’
     return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
            ^
mapnik.target.mk:204: recipe for target 'Release/obj.target/mapnik/src/mapnik_logger.o' failed
make: *** [Release/obj.target/mapnik/src/mapnik_logger.o] Error 1
make: Leaving directory '/home/yurik/wmf/kartotherian/krt/node_modules/mapnik/build'

@danpat
Copy link
Contributor

danpat commented Sep 14, 2015

Looks these errors are related to the version of nan we're using not supporting Node v4.0.0:

https://github.com/mapnik/node-mapnik/blob/master/package.json#L44

nan 2.0.0 got support for io.js (see https://github.com/nodejs/nan/blob/master/CHANGELOG.md) and according to some google-fu, the errors above are fixed by that.

@nyurik
Copy link
Author

nyurik commented Sep 14, 2015

Thanks, would simply bumping package.json's nan version work?

@danpat
Copy link
Contributor

danpat commented Sep 14, 2015

I suspect it won't work, I think the nan API changed a bit in 2.0.0 that will require some re-work. Give it a go and let us know, and if you are able to make a patch to get it fixed, please send it in :-)

@flippmoke
Copy link
Member

Sorry getting into this conversation late but please see this pull request #509 once that is done we should be able to support node v4.

@springmeyer
Copy link
Member

Closing, will track at #509

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

4 participants