node / custom grpc install

274 views
Skip to first unread message

Brian Dunlay

unread,
Apr 23, 2015, 3:52:56 PM4/23/15
to grp...@googlegroups.com
I'm unable to npm install grpc because I have a custom installation of grpc. In the past I've been able to solve this issue using pkg-config, but I don't think node-gyp supports custom install paths -- any advice?
Message has been deleted

br...@surround.io

unread,
Apr 23, 2015, 3:55:26 PM4/23/15
to grp...@googlegroups.com
And to clarify since "grpc" is getting thrown around a lot in different contexts, I have a custom install oflibgrpc.

Michael Lumish

unread,
Apr 23, 2015, 4:01:00 PM4/23/15
to br...@surround.io, grp...@googlegroups.com
You should be able to do this using C++ compiler flags, like this: CXXFLAGS=-I<custom_directory>/include LDFLAGS=-L<custom_directory>/lib npm install grpc

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/aec2e2e1-a23c-44e0-b808-a572a55e4f22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Dunlay

unread,
Apr 23, 2015, 4:13:19 PM4/23/15
to Michael Lumish, grp...@googlegroups.com
Doesn't seem to be the case unfortunately.

me@ubuntu:~/Documents$ ls ~/ws/install/include/grpc
byte_buffer.h         grpc.h       grpc_security.h  support
byte_buffer_reader.h  grpc_http.h  status.h

me@ubuntu:~/Documents$ CXXFLAGS=-l/home/me/ws/var/release/install/include
me@ubuntu:~/Documents$ LDFLAGS=-L/home/me/ws/var/release/install/lib
me@ubuntu:~/Documents$ npm install grpc
...
> gr...@0.6.1 install /home/me/Documents/node_modules/grpc
> node-gyp rebuild

make: Entering directory `/home/me/Documents/node_modules/grpc/build'
  CXX(target) Release/obj.target/grpc/ext/byte_buffer.o
../ext/byte_buffer.cc:38:23: fatal error: grpc/grpc.h: No such file or directory
 #include "grpc/grpc.h"
                       ^
compilation terminated.
make: *** [Release/obj.target/grpc/ext/byte_buffer.o] Error 1
make: Leaving directory `/home/me/Documents/node_modules/grpc/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-48-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/me/Documents/node_modules/grpc
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
 
npm ERR! weird error 1
npm ERR! not ok code 0

Michael Lumish

unread,
Apr 23, 2015, 4:22:00 PM4/23/15
to Brian Dunlay, grp...@googlegroups.com
You have to run "CXXFLAGS=-l/home/me/ws/var/release/install/include LDFLAGS=-L/home/me/ws/var/release/install/lib npm install" all on one line. And make sure that the first directory is the one that contains grpc/grpc.h and the second contains libgrpc.so (or libgrpc.a).

Brian Dunlay

unread,
Apr 23, 2015, 4:27:14 PM4/23/15
to Michael Lumish, grp...@googlegroups.com
Same thing. Definitely have the object files and headers. 

me@ubuntu:~/Documents$ ls ~/ws/var/release/install/lib | grep grpc
libgrpc.a
libgrpc++.a
libgrpc.so
libgrpc++.so
libgrpc.so.0
libgrpc++.so.0
libgrpc.so.0.6.0.0
libgrpc++.so.0.6.0.0
libgrpc_unsecure.a
libgrpc++_unsecure.a
libgrpc_unsecure.so
libgrpc++_unsecure.so
libgrpc_unsecure.so.0
libgrpc++_unsecure.so.0
libgrpc_unsecure.so.0.6.0.0
libgrpc++_unsecure.so.0.6.0.0

me@ubuntu:~/Documents$ ls ~/ws/var/release/install/include/grpc
byte_buffer.h         grpc.h       grpc_security.h  support
byte_buffer_reader.h  grpc_http.h  status.h

me@ubuntu:~/Documents$ CXXFLAGS=-l/home/me/ws/var/release/install/include LDFLAGS=-L/home/me/ws/var/release/install/lib npm install grpc

Michael Lumish

unread,
Apr 23, 2015, 4:42:16 PM4/23/15
to Brian Dunlay, grp...@googlegroups.com
That character after the first '-' should be a capital i, not a lower case L.

Abhishek Parmar

unread,
Apr 23, 2015, 4:43:46 PM4/23/15
to Michael Lumish, Brian Dunlay, grp...@googlegroups.com
FWIW this exact setup works for me. Use CXXFLAGS=-I... LDFLAGS=-L...  npm install


For more options, visit https://groups.google.com/d/optout.



--
-Abhishek

Brian Dunlay

unread,
Apr 23, 2015, 4:55:13 PM4/23/15
to Abhishek Parmar, Michael Lumish, grp...@googlegroups.com
Indeed it does, per Michael's excellent observation. Thanks both.
Reply all
Reply to author
Forward
0 new messages