Hello,
I am new to the world of installing Javascript modules and I am having the task of installing capnp JS libraries using g++ v4.8 in our RHEL6 environment.
As we only have v4.4.7 in /usr/bin/g++, we decided to use the g++ (v4.8.2) installed in /opt.
I downloaded the source from https://github.com/kentonv/node-capnp and added the below lines to binding.gyp but it doesn’t work.
'make_global_settings': [
{
'CXX': ['/opt/rh/devtoolset-2/root/usr/bin/g++'],
'CC': ['/opt/rh/devtoolset-2/root/usr/bin/gcc']
}],
When I straced the process, found that node-gyp is looking for the g++ libraries only in below location.
/usr/lib/node_modules/npm/bin/node-gyp-bin
/u/easwaraa/node_modules/capnp/node_modules/.bin
/usr/bin
I tried searching around to see if I can update the path somewhere but couldn’t find it. FWIW, I tried updating my .pathrc too but it didn’t help.
When I run npm install, I get the below message.
~/tmp/capnproto/temp_js_RPC/node-capnp $ npm install
> [email protected] install /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp
> node ./build.js
make: Entering directory `/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build'
CXX(target) Release/obj.target/capnp/src/node-capnp/capnp.o
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [Release/obj.target/capnp/src/node-capnp/capnp.o] Error 1
make: Leaving directory `/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/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/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 2.6.32-573.8.1.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
Build failed
npm ERR! weird error 1
npm ERR! not ok code 0
How can I update node-gyp to use the different version of g++?
Please let me know if something isn’t clear.
env CC=/path/to/gcc CXX=/path/to/g++ npm install should normally do the trick. If you want to use make_global_settings, you may have to set CC.host, CXX.host, CC.target and CXX.target as well.
It looks like you're using devtoolset-2; it's been a while since I last worked with that but I remember you need to start a shell with scl enable for it to be active.
Thanks for the quick response.
Setting the variables worked but still the node-gyp rebuild is failing.
make: *** [Release/obj.target/capnp/src/node-capnp/capnp.o] Error 1
make: Leaving directory `/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/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/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 2.6.32-573.8.1.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
Build failed
npm ERR! weird error 1
npm ERR! not ok code 0
It looks like you're using devtoolset-2; it's been a while since I last worked with that but I remember you need to start a shell with scl enable for it to be active.
I tried that already but it still fails.
~ $ scl enable devtoolset-2 /bin/bash
~ $ cd ~/tmp/capnproto/temp_js_RPC/node-capnp
~/tmp/capnproto/temp_js_RPC/node-capnp $npm install
> [email protected] install /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp
> node ./build.js
make: Entering directory `/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build'
CXX(target) Release/obj.target/capnp/src/node-capnp/capnp.o
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [Release/obj.target/capnp/src/node-capnp/capnp.o] Error 1
make: Leaving directory `/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/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/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 2.6.32-573.8.1.el6.x86_64
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
Build failed
npm ERR! weird error 1
npm ERR! not ok code 0
cc1plus: error: unrecognized command line option "-std=c++11"
That error suggests it's not actually using g++ 4.8. What does env V=1 node-gyp rebuild print?
Initially ‘env V=1 node-gyp rebuild’ was failing with the below error.
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn python
gyp info spawn args [ '/usr/bin/gyp',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon-rpm.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/share/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/usr/share/node',
gyp info spawn args '-Dmodule_root_dir=/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp',
gyp info spawn args '--depth=.',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
Traceback (most recent call last):
File "/usr/bin/gyp", line 15, in <module>
import gyp
ImportError: No module named gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/node-gyp/lib/configure.js:428:16)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 2.6.32-573.8.1.el6.x86_64
gyp ERR! command "node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
Little googling, pointed me to http://stackoverflow.com/questions/17706310/how-to-add-path-with-module-to-python
And I installed the gyp libraries from chromium and now ‘env V=1 node-gyp rebuild’ is giving the below error.
~/tmp/capnproto/temp_js_RPC/node-capnp $ env V=1 node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn python
gyp info spawn args [ '/usr/bin/gyp',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon-rpm.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/share/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/usr/share/node',
gyp info spawn args '-Dmodule_root_dir=/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp',
gyp info spawn args '--depth=.',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build'
/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build/CC '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/usr/include -I/usr/include/node -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -std=c++11 -MMD -MF ./Release/.deps/Release/obj.target/capnp/src/node-capnp/capnp.o.d.raw -c -o Release/obj.target/capnp/src/node-capnp/capnp.o ../src/node-capnp/capnp.cc
make: /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build/CC: Command not found
make: *** [Release/obj.target/capnp/src/node-capnp/capnp.o] Error 127
make: Leaving directory `/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/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/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 2.6.32-573.8.1.el6.x86_64
gyp ERR! command "node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
make: /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build/CC: Command not found
Where does that file name come from? Are you still using make_global_settings?
Ah,, sorry I was using it before. When I removed it, its giving a different error now.
Is it happening because of capnp C libraries?
~/tmp/capnproto/temp_js_RPC/node-capnp $ env CC=/opt/rh/devtoolset-2/root/usr/bin/gcc CXX=/opt/rh/devtoolset-2/root/usr/bin/g++ V=1 node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp info spawn python
gyp info spawn args [ '/usr/bin/gyp',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon-rpm.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/share/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/usr/share/node',
gyp info spawn args '-Dmodule_root_dir=/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp',
gyp info spawn args '--depth=.',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/build'
/opt/rh/devtoolset-2/root/usr/bin/g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/usr/include -I/usr/include/node -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -std=c++11 -MMD -MF ./Release/.deps/Release/obj.target/capnp/src/node-capnp/capnp.o.d.raw -c -o Release/obj.target/capnp/src/node-capnp/capnp.o ../src/node-capnp/capnp.cc
../src/node-capnp/capnp.cc: In member function \u2018capnp::Orphan<capnp::DynamicValue> v8capnp::{anonymous}::FromJsConverter::orphanFromJs(capnp::StructSchema::Field, capnp::Orphanage, capnp::Type, v8::Handle<v8::Value>)\u2019:
../src/node-capnp/capnp.cc:1351:18: error: \u2018class capnp::Type\u2019 has no member named \u2018whichAnyPointerKind\u2019
if (type.whichAnyPointerKind() == capnp::schema::Type::AnyPointer::Unconstrained::CAPABILITY) {
^
../src/node-capnp/capnp.cc:1351:76: error: \u2018capnp::schema::Type::AnyPointer::Unconstrained\u2019 has not been declared
if (type.whichAnyPointerKind() == capnp::schema::Type::AnyPointer::Unconstrained::CAPABILITY) {
^
../src/node-capnp/capnp.cc:1354:68: error: no matching function for call to \u2018capnp::DynamicCapability::Client::Client(capnp::Capability::Client)\u2019
capnp::DynamicCapability::Client dynamicCap(kj::mv(cap));
^
../src/node-capnp/capnp.cc:1354:68: note: candidates are:
In file included from ../src/node-capnp/capnp.cc:31:0:
/usr/include/capnp/dynamic.h:480:10: note: template<class T> capnp::DynamicCapability::Client::Client(capnp::InterfaceSchema, kj::Own<T>&&)
inline Client(InterfaceSchema schema, kj::Own<T>&& server);
^
/usr/include/capnp/dynamic.h:480:10: note: template argument deduction/substitution failed:
../src/node-capnp/capnp.cc:1354:68: note: cannot convert \u2018kj::mv<capnp::Capability::Client>((* & cap))\u2019 (type \u2018capnp::Capability::Client\u2019) to type \u2018capnp::InterfaceSchema\u2019
capnp::DynamicCapability::Client dynamicCap(kj::mv(cap));
^
In file included from ../src/node-capnp/capnp.cc:31:0:
/usr/include/capnp/dynamic.h:476:3: note: capnp::DynamicCapability::Client::Client(capnp::InterfaceSchema, kj::Own<capnp::ClientHook>&&)
Client(InterfaceSchema schema, kj::Own<ClientHook>&& hook)
^
/usr/include/capnp/dynamic.h:476:3: note: candidate expects 2 arguments, 1 provided
/usr/include/capnp/dynamic.h:455:10: note: template<class T, class> capnp::DynamicCapability::Client::Client(kj::Own<T>&&)
inline Client(kj::Own<T>&& server);
^
/usr/include/capnp/dynamic.h:455:10: note: template argument deduction/substitution failed:
../src/node-capnp/capnp.cc:1354:68: note: \u2018capnp::Capability::Client\u2019 is not derived from \u2018kj::Own<T>\u2019
capnp::DynamicCapability::Client dynamicCap(kj::mv(cap));
^
In file included from ../src/node-capnp/capnp.cc:31:0:
/usr/include/capnp/dynamic.h:452:10: note: template<class T, class> capnp::DynamicCapability::Client::Client(T&&)
inline Client(T&& client);
^
/usr/include/capnp/dynamic.h:452:10: note: template argument deduction/substitution failed:
In file included from /usr/include/capnp/layout.h:38:0,
from /usr/include/capnp/generated-header-support.h:31,
from /usr/include/capnp/schema.capnp.h:7,
from /usr/include/capnp/schema.h:33,
from /usr/include/capnp/dynamic.h:40,
from ../src/node-capnp/capnp.cc:31:
/usr/include/capnp/any.h:259:51: error: no type named \u2018Calls\u2019 in \u2018kj::Decay_<capnp::Capability::Client>::Type {aka class capnp::Capability::Client}\u2019
template <typename T, typename = kj::EnableIf<CAPNP_KIND(FromClient<T>) == Kind::INTERFACE>>
^
In file included from ../src/node-capnp/capnp.cc:31:0:
/usr/include/capnp/dynamic.h:449:3: note: capnp::DynamicCapability::Client::Client()
Client() = default;
^
/usr/include/capnp/dynamic.h:449:3: note: candidate expects 0 arguments, 1 provided
/usr/include/capnp/dynamic.h:444:26: note: capnp::DynamicCapability::Client::Client(capnp::DynamicCapability::Client&)
class DynamicCapability::Client: public Capability::Client {
^
/usr/include/capnp/dynamic.h:444:26: note: no known conversion for argument 1 from \u2018capnp::Capability::Client\u2019 to \u2018capnp::DynamicCapability::Client&\u2019
/usr/include/capnp/dynamic.h:444:26: note: capnp::DynamicCapability::Client::Client(capnp::DynamicCapability::Client&&)
/usr/include/capnp/dynamic.h:444:26: note: no known conversion for argument 1 from \u2018capnp::Capability::Client\u2019 to \u2018capnp::DynamicCapability::Client&&\u2019
../src/node-capnp/capnp.cc: In function \u2018v8::Handle<v8::Value> v8capnp::{anonymous}::valueToJs(v8capnp::{anonymous}::CapnpContext&, capnp::DynamicValue::Reader, capnp::Type, v8::Handle<v8::Value>)\u2019:
../src/node-capnp/capnp.cc:1598:16: error: \u2018class capnp::Type\u2019 has no member named \u2018whichAnyPointerKind\u2019
if (type.whichAnyPointerKind() == capnp::schema::Type::AnyPointer::Unconstrained::CAPABILITY) {
^
../src/node-capnp/capnp.cc:1598:74: error: \u2018capnp::schema::Type::AnyPointer::Unconstrained\u2019 has not been declared
if (type.whichAnyPointerKind() == capnp::schema::Type::AnyPointer::Unconstrained::CAPABILITY) {
^
../src/node-capnp/capnp.cc:1601:64: error: no matching function for call to \u2018capnp::DynamicCapability::Client::Client(capnp::Capability::Client)\u2019
capnp::DynamicCapability::Client dynamicCap(kj::mv(cap));
^
../src/node-capnp/capnp.cc:1601:64: note: candidates are:
In file included from ../src/node-capnp/capnp.cc:31:0:
/usr/include/capnp/dynamic.h:480:10: note: template<class T> capnp::DynamicCapability::Client::Client(capnp::InterfaceSchema, kj::Own<T>&&)
inline Client(InterfaceSchema schema, kj::Own<T>&& server);
^
/usr/include/capnp/dynamic.h:480:10: note: template argument deduction/substitution failed:
../src/node-capnp/capnp.cc:1601:64: note: cannot convert \u2018kj::mv<capnp::Capability::Client>((* & cap))\u2019 (type \u2018capnp::Capability::Client\u2019) to type \u2018capnp::InterfaceSchema\u2019
capnp::DynamicCapability::Client dynamicCap(kj::mv(cap));
^
In file included from ../src/node-capnp/capnp.cc:31:0:
/usr/include/capnp/dynamic.h:476:3: note: capnp::DynamicCapability::Client::Client(capnp::InterfaceSchema, kj::Own<capnp::ClientHook>&&)
Client(InterfaceSchema schema, kj::Own<ClientHook>&& hook)
^
/usr/include/capnp/dynamic.h:476:3: note: candidate expects 2 arguments, 1 provided
/usr/include/capnp/dynamic.h:455:10: note: template<class T, class> capnp::DynamicCapability::Client::Client(kj::Own<T>&&)
inline Client(kj::Own<T>&& server);
^
/usr/include/capnp/dynamic.h:455:10: note: template argument deduction/substitution failed:
../src/node-capnp/capnp.cc:1601:64: note: \u2018capnp::Capability::Client\u2019 is not derived from \u2018kj::Own<T>\u2019
capnp::DynamicCapability::Client dynamicCap(kj::mv(cap));
^
In file included from ../src/node-capnp/capnp.cc:31:0:
/usr/include/capnp/dynamic.h:452:10: note: template<class T, class> capnp::DynamicCapability::Client::Client(T&&)
inline Client(T&& client);
^
/usr/include/capnp/dynamic.h:452:10: note: template argument deduction/substitution failed:
In file included from /usr/include/capnp/layout.h:38:0,
from /usr/include/capnp/generated-header-support.h:31,
from /usr/include/capnp/schema.capnp.h:7,
from /usr/include/capnp/schema.h:33,
from /usr/include/capnp/dynamic.h:40,
from ../src/node-capnp/capnp.cc:31:
/usr/include/capnp/any.h:259:51: error: no type named \u2018Calls\u2019 in \u2018kj::Decay_<capnp::Capability::Client>::Type {aka class capnp::Capability::Client}\u2019
template <typename T, typename = kj::EnableIf<CAPNP_KIND(FromClient<T>) == Kind::INTERFACE>>
^
In file included from ../src/node-capnp/capnp.cc:31:0:
/usr/include/capnp/dynamic.h:449:3: note: capnp::DynamicCapability::Client::Client()
Client() = default;
^
/usr/include/capnp/dynamic.h:449:3: note: candidate expects 0 arguments, 1 provided
/usr/include/capnp/dynamic.h:444:26: note: capnp::DynamicCapability::Client::Client(capnp::DynamicCapability::Client&)
class DynamicCapability::Client: public Capability::Client {
^
/usr/include/capnp/dynamic.h:444:26: note: no known conversion for argument 1 from \u2018capnp::Capability::Client\u2019 to \u2018capnp::DynamicCapability::Client&\u2019
/usr/include/capnp/dynamic.h:444:26: note: capnp::DynamicCapability::Client::Client(capnp::DynamicCapability::Client&&)
/usr/include/capnp/dynamic.h:444:26: note: no known conversion for argument 1 from \u2018capnp::Capability::Client\u2019 to \u2018capnp::DynamicCapability::Client&&\u2019
../src/node-capnp/capnp.cc: In member function \u2018capnp::Capability::Client v8capnp::{anonymous}::RpcConnection::import(kj::StringPtr)\u2019:
../src/node-capnp/capnp.cc:1761:46: warning: \u2018capnp::Capability::Client capnp::RpcSystem<SturdyRefHostId>::restore(typename VatId::Reader, capnp::AnyPointer::Reader) [with VatId = capnp::rpc::twoparty::VatId; typename VatId::Reader = capnp::rpc::twoparty::VatId::Reader]\u2019 is deprecated (declared at /usr/include/capnp/rpc.h:366) [-Wdeprecated-declarations]
return rpcSystem.restore(hostId, objectId);
^
../src/node-capnp/capnp.cc: In function \u2018v8::Handle<v8::Value> v8capnp::{anonymous}::fulfillPromisedCap(const v8::Arguments&)\u2019:
../src/node-capnp/capnp.cc:2253:29: warning: unused variable \u2018context\u2019 [-Wunused-variable]
KJV8_UNWRAP(CapnpContext, context, args.Data());
^
../src/node-capnp/capnp.cc:875:9: note: in definition of macro \u2018KJV8_UNWRAP\u2019
type& name = KJ_ASSERT_NONNULL(name##_maybe)
^
../src/node-capnp/capnp.cc: In function \u2018v8::Handle<v8::Value> v8capnp::{anonymous}::rejectPromisedCap(const v8::Arguments&)\u2019:
../src/node-capnp/capnp.cc:2268:29: warning: unused variable \u2018context\u2019 [-Wunused-variable]
KJV8_UNWRAP(CapnpContext, context, args.Data());
^
../src/node-capnp/capnp.cc:875:9: note: in definition of macro \u2018KJV8_UNWRAP\u2019
type& name = KJ_ASSERT_NONNULL(name##_maybe)
^
make: *** [Release/obj.target/capnp/src/node-capnp/capnp.o] Error 1
make: Leaving directory `/u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp/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/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 2.6.32-573.8.1.el6.x86_64
gyp ERR! command "node" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /u/easwaraa/tmp/capnproto/temp_js_RPC/node-capnp
gyp ERR! node -v v0.10.36
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok
Is it happening because of capnp C libraries?
I would say so.
Any pointers on how to fix this?
[Sorry for bothering you. I spent some time digging this today but couldn't fix it].
Sorry, no idea. I'd ping the author of the node bindings if I were you. I'll close the issue.
Thanks for all your help.
FTR, I was able to make npm install work for capnp by using the below command.
env CC=/opt/rh/devtoolset-2/root/usr/bin/gcc CXX=/opt/rh/devtoolset-2/root/usr/bin/g++ npm install capnp
I was under the impression that there will be a .js file which our users can use in their code... But not sure if I have got the right one...
~/node_modules/capnp $ ls
CONTRIBUTORS LICENSE README.md bin binding.gyp build build.js package.json src
Thanks for your help once again :).
Look for the "main" field in package.json, that's the module's entry point. You don't have to include that file explicitly though, require('capnp') should do it for you.
This is what I have in the "main" filed in package.json.
"main": "src/node-capnp/capnp.js",
"peerDependencies": {
"es6-promise": "1.x"
},
Let me try to write some test JS code by using this module and see if it works. Thanks :)
Most helpful comment
env CC=/path/to/gcc CXX=/path/to/g++ npm installshould normally do the trick. If you want to usemake_global_settings, you may have to setCC.host,CXX.host,CC.targetandCXX.targetas well.It looks like you're using devtoolset-2; it's been a while since I last worked with that but I remember you need to start a shell with
scl enablefor it to be active.