Build fail: couchnode 2.0.6 and node 0.12


#1

My environment:

  • Amazon Linux
  • node 0.12
  • couchnode 2.0.6
  • libcouchbase-devel 2.4.7
  • libcouchbase2-libevent 2.4.7

npm install do not report errors, but when I try to start my server I get:

node_modules/couchbase/lib/binding.js:152
  throw new Error('Failed to locate couchnode native binding' +
        ^
Error: Failed to locate couchnode native binding (maybe check builderror.log!)

and there is a builderror.log inside node_modules/couchbase:

child_process: customFds option is deprecated, use stdio instead.
../deps/lcb/src/lcbio/manager.c: In function 'iterfunc':
../deps/lcb/src/lcbio/manager.c:157:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     LCB_LIST_SAFE_FOR(cur, next, (lcb_list_t *)&he->ll_idle) {
     ^
../deps/lcb/src/lcbio/manager.c:162:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     LCB_LIST_SAFE_FOR(cur, next, (lcb_list_t *)&he->ll_pending) {
     ^
../deps/lcb/src/lcbio/manager.c: In function 'lcbio_mgr_destroy':
../deps/lcb/src/lcbio/manager.c:203:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     LCB_LIST_SAFE_FOR(cur, next, (lcb_list_t*)&hes) {
     ^
../deps/lcb/src/lcbio/manager.c: In function 'on_connected':
../deps/lcb/src/lcbio/manager.c:277:9: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
         LCB_LIST_SAFE_FOR(cur, next, (lcb_list_t *)&he->requests) {
         ^
../deps/lcb/src/lcbio/manager.c: In function 'he_dump':
../deps/lcb/src/lcbio/manager.c:546:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
     LCB_LIST_FOR(llcur, (lcb_list_t *)&he->requests) {
     ^
../src/cas.cc: In static member function 'static void Couchnode::Cas::fnToString(const v8::FunctionCallbackInfo<v8::Value>&)':
../src/cas.cc:43:35: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'uint64_t {aka long unsigned int}' [-Wformat=]
     sprintf(casStr, "%llu", casVal);
                                   ^
../src/cas.cc: In static member function 'static void Couchnode::Cas::fnInspect(const v8::FunctionCallbackInfo<v8::Value>&)':
../src/cas.cc:54:49: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'uint64_t {aka long unsigned int}' [-Wformat=]
     sprintf(casStr, "CouchbaseCas<%llu>", casVal);
                                                 ^
../src/cas.cc: In function 'bool _StrToCas(v8::Handle<v8::Value>, uint64_t*)':
../src/cas.cc:73:58: warning: format '%llu' expects argument of type 'long long unsigned int*', but argument 3 has type 'uint64_t* {aka long unsigned int*}' [-Wformat=]
     if (sscanf(*NanUtf8String(obj->ToString()), "%llu", p) != 1) {
                                                          ^
In file included from ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-internal.h:31:0,
                 from ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-libuv.c:18,
                 from ../src/uv-plugin-all.c:17:
../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h: In function 'uv_uv2syserr':
/home/zup/.node-gyp/0.12.0/deps/uv/include/uv.h:75:6: error: 'EAI_BADHINTS' undeclared (first use in this function)
   XX(EAI_BADHINTS, "invalid value for hints")                                 \
      ^
../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:167:63: note: in definition of macro 'X'
       #define X(name, desc) if (status == UV_##name) { return name; }
                                                               ^
../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:168:7: note: in expansion of macro 'UV_ERRNO_MAP'
       UV_ERRNO_MAP(X)
       ^
/home/zup/.node-gyp/0.12.0/deps/uv/include/uv.h:75:6: note: each undeclared identifier is reported only once for each function it appears in
   XX(EAI_BADHINTS, "invalid value for hints")                                 \
      ^
../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:167:63: note: in definition of macro 'X'
       #define X(name, desc) if (status == UV_##name) { return name; }
                                                               ^
../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:168:7: note: in expansion of macro 'UV_ERRNO_MAP'
       UV_ERRNO_MAP(X)
       ^
/home/zup/.node-gyp/0.12.0/deps/uv/include/uv.h:80:6: error: 'EAI_NODATA' undeclared (first use in this function)
   XX(EAI_NODATA, "no address")                                                \
      ^
../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:167:63: note: in definition of macro 'X'
       #define X(name, desc) if (status == UV_##name) { return name; }
                                                               ^
../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:168:7: note: in expansion of macro 'UV_ERRNO_MAP'
       UV_ERRNO_MAP(X)
       ^
/home/zup/.node-gyp/0.12.0/deps/uv/include/uv.h:83:6: error: 'EAI_PROTOCOL' undeclared (first use in this function)
   XX(EAI_PROTOCOL, "resolved protocol is unknown")                            \
      ^
../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:167:63: note: in definition of macro 'X'
       #define X(name, desc) if (status == UV_##name) { return name; }
                                                               ^
../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:168:7: note: in expansion of macro 'UV_ERRNO_MAP'
       UV_ERRNO_MAP(X)
       ^
make: *** [Release/obj.target/couchbase_impl/src/uv-plugin-all.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/tmp/d20150320-12208-418646/opt/cockpit-gateway/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1067:12)
gyp ERR! System Linux 3.14.34-27.48.amzn1.x86_64
gyp ERR! command "node" "/tmp/d20150320-12208-418646/opt/cockpit-gateway/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/d20150320-12208-418646/opt/cockpit-gateway/node_modules/couchbase
gyp ERR! node -v v0.12.0
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok

This log is very similar to the one posted on this issue: https://issues.couchbase.com/browse/JSCBC-216

I’m glad to give any other info to help resolve this problem.


#2

I think the problem is related to node-gyp rebuild, it seems failing with node 0.12 or io.js:

Matt


#3

This problem has been resolved in the newly-released 2.4.8 version (See http://issues.couchbase.com/browse/CCBC-590). It has not yet been bundled with couchnode, but can be installed externally (and then have Couchnode link to it by installing couchnode via npm install couchnode --couchbase-root=/usr).


#4

Hello,

The solution as described by Mark still does not work for me :

  • CentOS 6.5 X86_64
  • node v0.12.1
  • libcouchbase 2.4.8

node_modules/couchbase/builderror.log still complains about undeclared vars :

In file included from …/deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-internal.h:31,
from …/deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-libuv.c:18,
from …/src/uv-plugin-all.c:17:
…/deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h: In function ‘uv_uv2syserr’:
…/deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:168: error: ‘EAI_BADHINTS’ undeclared (first use in this function)
…/deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:168: error: (Each undeclared identifier is reported only once
…/deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:168: error: for each function it appears in.)
…/deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:168: error: ‘EAI_NODATA’ undeclared (first use in this function)
…/deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h:168: error: ‘EAI_PROTOCOL’ undeclared (first use in this function)
make: *** [Release/obj.target/couchbase_impl/src/uv-plugin-all.o] Error 1
gyp ERR! build error

Thanks to Corbin Uselton for pointing me to the solution : defining EAI_NODATA and EAI_PROTOCOL
in libcouchbase 2.4.8 libuv_compat.h

Complete solution here if you need it quick


#5

Hey Guys,

You may also build from my local tree (npm install git+https://github.com/brett19/couchnode), which contains the necessary fixes which will be appearing in a new Node.js release next Tuesday.

Cheers, Brett


#6

Thanks @brett19. I have sent a PR now for node 0.12.2
https:// github.com/brett19/couchnode/pull/1