New nodejs SDK (Release 2.3.2) compilation fail on error: cannot use typeid with -fno-rtti

I’m getting a compilation error when trying to install new nodejs release.

CentOS release 6.8 (Final)

Linux 35bf8fdc380e 3.10.0-327.13.1.el7.x86_64 #1 SMP Thu Mar 31 16:04:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Compile log

[root@35bf8fdc380e vodContentGet]# npm install couchbase
npm WARN prefer global node-ninja@1.0.2 should be installed with -g 
npm WARN prefer global node-gyp@3.6.0 should be installed with -g
couchbase@2.3.2 install /microservice/vodContentGet/node_modules/couchbase
prebuild --install

    prebuild info begin Prebuild version 6.1.0
   prebuild info build Preparing to prebuild couchbase@2.3.2 for node 6.9.5 on linux-x64              using node-gyp
   make: Entering directory `/microservice/vodContentGet/node_modules/couchbase/build'
  COPY ../deps/lcb/include/libcouchbase/libuv_io_opts.h
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-libuv.c
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-internal.h
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_cccp.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_file.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_http.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_mcraw.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/confmon.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/http/http.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/http/http_io.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/jsparse/parser.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/lcbht/lcbht.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/connect.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/ctx.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/iotable.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/ioutils.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/manager.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/protoctx.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/lcbio/timer.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/mc/compress.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/mc/forward.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/mc/mcreq.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/mcserver/mcserver.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/mcserver/negotiate.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/n1ql/ixmgmt.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/n1ql/n1ql.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/n1ql/params.o
../deps/lcb/src/n1ql/params.cc: In function ‘void encode_mutation_token(Json::Value&, const lcb_MUTATION_TOKEN*)’:
../deps/lcb/src/n1ql/params.cc:95: warning: format ‘%llu’ expects type ‘long long unsigned int’, but argument 3 has type ‘lcb_U64’
  CC(target) Release/obj.target/couchbase/deps/lcb/src/netbuf/netbuf.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/cbflush.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/counter.o
In file included from ../deps/lcb/src/operations/counter.cc:18:
../deps/lcb/src/trace.h:22: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/durability-cas.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/durability-seqno.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/durability.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/get.o
In file included from ../deps/lcb/src/operations/get.cc:19:
../deps/lcb/src/trace.h:22: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/observe-seqno.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/observe.o
In file included from ../deps/lcb/src/operations/observe.cc:20:
../deps/lcb/src/trace.h:22: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/pktfwd.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/remove.o
In file included from ../deps/lcb/src/operations/remove.cc:19:
../deps/lcb/src/trace.h:22: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/stats.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/store.o
In file included from ../deps/lcb/src/operations/store.cc:19:
../deps/lcb/src/trace.h:22: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/subdoc.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/operations/touch.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/rdb/bigalloc.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/rdb/chunkalloc.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/rdb/libcalloc.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/rdb/rope.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/strcodecs/base64.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/vbucket/ketama.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/vbucket/vbucket.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/views/docreq.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/views/viewreq.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/auth.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bootstrap.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/callbacks.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/cbft.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/cntl.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/connspec.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/dns-srv.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/dump.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/errmap.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/getconfig.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/gethrtime.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/handler.o
In file included from ../deps/lcb/src/handler.cc:22:
../deps/lcb/src/trace.h:22: warning: expected [error|warning|ignored] after ‘#pragma GCC diagnostic’
  CC(target) Release/obj.target/couchbase/deps/lcb/src/hashtable.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/hostlist.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/instance.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/iofactory.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/legacy.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/list.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/logging.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/newconfig.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/nodeinfo.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/retrychk.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/retryq.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/ringbuffer.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/settings.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/timings.o
  CC(target) Release/obj.target/couchbase/deps/lcb/src/utilities.o
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/wait.o
  CC(target) Release/obj.target/couchbase/deps/lcb/plugins/io/select/plugin-select.o
  AR(target) Release/obj.target/deps/lcb/libcouchbase.a
  COPY Release/libcouchbase.a
  CC(target) Release/obj.target/httpparser/deps/lcb/contrib/http_parser/http_parser.o
  AR(target) Release/obj.target/deps/lcb/libhttpparser.a
  COPY Release/libhttpparser.a
  CC(target) Release/obj.target/genhash/deps/lcb/contrib/genhash/genhash.o
  AR(target) Release/obj.target/deps/lcb/libgenhash.a
  COPY Release/libgenhash.a
  CC(target) Release/obj.target/cjson/deps/lcb/contrib/cJSON/cJSON.o
  AR(target) Release/obj.target/deps/lcb/libcjson.a
  COPY Release/libcjson.a
  CC(target) Release/obj.target/cbsasl/deps/lcb/contrib/cbsasl/src/client.o
  CC(target) Release/obj.target/cbsasl/deps/lcb/contrib/cbsasl/src/common.o
  CC(target) Release/obj.target/cbsasl/deps/lcb/contrib/cbsasl/src/cram-md5/hmac.o
  CC(target) Release/obj.target/cbsasl/deps/lcb/contrib/cbsasl/src/cram-md5/md5.o
  CC(target) Release/obj.target/cbsasl/deps/lcb/contrib/cbsasl/src/hash.o
  AR(target) Release/obj.target/deps/lcb/libcbsasl.a
  COPY Release/libcbsasl.a
  CXX(target) Release/obj.target/snappy/deps/lcb/contrib/snappy/snappy-c.o
  CXX(target) Release/obj.target/snappy/deps/lcb/contrib/snappy/snappy-sinksource.o
  CXX(target) Release/obj.target/snappy/deps/lcb/contrib/snappy/snappy-stubs-internal.o
  CXX(target) Release/obj.target/snappy/deps/lcb/contrib/snappy/snappy.o
  AR(target) Release/obj.target/deps/lcb/libsnappy.a
  COPY Release/libsnappy.a
  CXX(target) Release/obj.target/jsoncpp/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.o
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/memory:83,
                 from ../deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp:205:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h: In member function ‘virtual void* std::_Sp_counted_deleter<_Ptr, _Deleter, _Alloc, _Lp>::_M_get_deleter(const std::type_info&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:146: error: cannot use typeid with -fno-rtti
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h: In member function ‘virtual void* std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_M_get_deleter(const std::type_info&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:204: error: cannot use typeid with -fno-rtti
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h: In constructor ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, _Alloc, _Args&& ...)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:861: error: cannot use typeid with -fno-rtti
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h: In function ‘_Del* std::get_deleter(const std::__shared_ptr<_Tp2, _Lp>&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:1005: error: cannot use typeid with -fno-rtti
make: *** [Release/obj.target/jsoncpp/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.o] Error 1
make: Leaving directory `/microservice/vodContentGet/node_modules/couchbase/build'
prebuild ERR! build error
prebuild ERR! stack Error: `make` failed with exit code: 2
prebuild ERR! stack     at ChildProcess.onExit (/microservice/vodContentGet/node_modules/node-gyp/lib/build.js:285:23)
prebuild ERR! stack     at emitTwo (events.js:106:13)
prebuild ERR! stack     at ChildProcess.emit (events.js:191:7)
prebuild ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
prebuild ERR! not ok
prebuild ERR! build Error: `make` failed with exit code: 2
prebuild ERR! build     at ChildProcess.onExit (/microservice/vodContentGet/node_modules/node-gyp/lib/build.js:285:23)
prebuild ERR! build     at emitTwo (events.js:106:13)
prebuild ERR! build     at ChildProcess.emit (events.js:191:7)
prebuild ERR! build     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
[               ...] - install: info lifecycle couchbase@2.3.2~install: Failed to exec install script
[               ...] - install: info lifecycle couchbase@2.3.2~install: Failed to exec install script
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: couchbase-common@latest (node_modules/base-service/node_modules/couchbase-common):
npm WARN 404 SKIPPING OPTIONAL DEPENDENCY: Registry returned 404 for GET on https://registry.npmjs.org/couchbase-common
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! Linux 3.10.0-327.13.1.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "couchbase"
npm ERR! node v6.9.5
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! couchbase@2.3.2 install: `prebuild --install`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the couchbase@2.3.2 install script 'prebuild --install'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the couchbase package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     prebuild --install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs couchbase
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls couchbase
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /microservice/vodContentGet/npm-debug.log

Hey!

We are investigating this issue, it appears a recent change to the underlying libcouchbase library has caused builds to fail on this particular type of environment.

You can track the progress of this bug via the following issue on our issue tracker:
https://issues.couchbase.com/browse/JSCBC-364

Cheers, Brett

UPDATE:
I was manage to resolve it by using devtoolset-4-gcc which uses gcc-5.2.1 instead of 4.4. But keep in mind that this is not the default compiler of centos 6. So I suggest to still fix the issue or at least document this somewhere.

Hi,
I am also getting similar error on Redhat 6.8.
https://issues.couchbase.com/browse/JSCBC-375 - This will fix below error ? If yes when version 2.3.3 will be released ?

npm install couchbase
npm WARN prefer global node-gyp@3.6.1 should be installed with -g
npm WARN prefer global node-ninja@1.0.2 should be installed with -g

> couchbase@2.3.2 install /home/nilesh/imdp/node_modules/couchbase
> prebuild --install

prebuild info begin Prebuild version 6.1.0
prebuild info build Preparing to prebuild couchbase@2.3.2 for node 6.10.2 on linux-x64 using node-gyp
make: Entering directory `/home/nilesh/imdp/node_modules/couchbase/build'
  COPY ../deps/lcb/include/libcouchbase/libuv_io_opts.h
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-libuv.c
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/plugin-internal.h
  COPY ../deps/lcb/include/libcouchbase/plugins/io/libuv/libuv_compat.h
  CXX(target) Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_cccp.o
make: g++: Command not found
make: *** [Release/obj.target/couchbase/deps/lcb/src/bucketconfig/bc_cccp.o] Error 127
make: Leaving directory `/home/nilesh/imdp/node_modules/couchbase/build'
prebuild ERR! build error
prebuild ERR! stack Error: `make` failed with exit code: 2
prebuild ERR! stack     at ChildProcess.onExit (/home/nilesh/imdp/node_modules/node-gyp/lib/build.js:285:23)
prebuild ERR! stack     at emitTwo (events.js:106:13)
prebuild ERR! stack     at ChildProcess.emit (events.js:191:7)
prebuild ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
prebuild ERR! not ok
prebuild ERR! build Error: `make` failed with exit code: 2
prebuild ERR! build     at ChildProcess.onExit (/home/nilesh/imdp/node_modules/node-gyp/lib/build.js:285:23)
prebuild ERR! build     at emitTwo (events.js:106:13)
prebuild ERR! build     at ChildProcess.emit (events.js:191:7)
prebuild ERR! build     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
npm WARN imdp@1.0.0 No repository field.
npm ERR! Linux 2.6.32-642.el6.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "couchbase"
npm ERR! node v6.10.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

npm ERR! couchbase@2.3.2 install: `prebuild --install`
npm ERR! Exit status 2