Question about protobuf dependency

958 views
Skip to first unread message

Abhishek Parmar

unread,
Mar 18, 2015, 11:41:16 PM3/18/15
to grp...@googlegroups.com
Should I be worried about version mismatch between the protofub pulled in via grpc/third_party/...  v/s the one that I have installed globally?


-Abhishek

Nicolas Noble

unread,
Mar 19, 2015, 12:42:31 AM3/19/15
to Abhishek Parmar, grp...@googlegroups.com
Yes and no. Two scenarios:

1) The version you have globally is 2.x:
grpc might compile fine locally. Might. I've seen mixed results from people, so I guess it depends on your exact environment. The Makefile will try compiling the one in third_party and use it locally. If everything goes fine, the compiled grpc++ library as well as the protoc plugins will have its protobuf code linked statically into it. However, you wouldn't really be able to do much with the resulting library - if your intention is to use grpc++. The 2.x protoc compiler you have can't compile grpc protobuf files, and the plugin generated code needs the protobuf 3.x libraries and headers.

2) The version you have globally is 3.x:
The Makefile will ignore the version that is in third_party completely.

On Wed, Mar 18, 2015 at 8:41 PM, Abhishek Parmar <abhi...@carbon3d.com> wrote:
Should I be worried about version mismatch between the protofub pulled in via grpc/third_party/...  v/s the one that I have installed globally?


-Abhishek

--
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/CAD2hskyLoezC2Gq%2Bco%3D9Nc2UgGeuC9kGNeA5-aZVNA_bTEyUgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Abhishek Parmar

unread,
Mar 19, 2015, 12:45:33 AM3/19/15
to Nicolas Noble, grp...@googlegroups.com
On Wed, Mar 18, 2015 at 9:42 PM, Nicolas Noble <pixel...@gmail.com> wrote:
Yes and no. Two scenarios:

1) The version you have globally is 2.x:
grpc might compile fine locally. Might. I've seen mixed results from people, so I guess it depends on your exact environment. The Makefile will try compiling the one in third_party and use it locally. If everything goes fine, the compiled grpc++ library as well as the protoc plugins will have its protobuf code linked statically into it. However, you wouldn't really be able to do much with the resulting library - if your intention is to use grpc++. The 2.x protoc compiler you have can't compile grpc protobuf files, and the plugin generated code needs the protobuf 3.x libraries and headers.

2) The version you have globally is 3.x:
The Makefile will ignore the version that is in third_party completely.

Okay and what if I have no protobuf installed globally i.e it is installed in a non standard location can I tell the grpc makefie where to find it?
 

On Wed, Mar 18, 2015 at 8:41 PM, Abhishek Parmar <abhi...@carbon3d.com> wrote:
Should I be worried about version mismatch between the protofub pulled in via grpc/third_party/...  v/s the one that I have installed globally?


-Abhishek

--
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/CAD2hskyLoezC2Gq%2Bco%3D9Nc2UgGeuC9kGNeA5-aZVNA_bTEyUgQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.




--
-Abhishek

Nicolas Noble

unread,
Mar 19, 2015, 1:06:06 AM3/19/15
to Abhishek Parmar, grp...@googlegroups.com
You can do this:

CPPFLAGS=-I/path/to/protobuf/includes LDFLAGS=-L/path/to/protobuf/libs PATH=/path/to/protoc/bin/directory:$PATH make

For example:

CPPFLAGS=-I/home/nnoble/protobuf3/include LDFLAGS=-L/home/nnoble/protobuf3/lib PATH=/home/nnoble/protobuf3/bin:$PATH make

If you want to see if everything is properly detected, do this:

CPPFLAGS=-I/path/to/protobuf/includes LDFLAGS=-L/path/to/protobuf/libs PATH=$PATH:/path/to/protoc/bin/directory make run_dep_checks

Abhishek Parmar

unread,
Mar 19, 2015, 3:23:44 AM3/19/15
to Nicolas Noble, grp...@googlegroups.com

Abhishek Parmar

unread,
Mar 24, 2015, 5:23:57 PM3/24/15
to Nicolas Noble, grp...@googlegroups.com
Finally got a change to try this setup.  A few observations and questions:

1) It needs CXXFLAGS not CPPFLAGS

2) make run_dep_checks complains about 

test/build/perftools.c:34:33: fatal error: gperftools/profiler.h: No such file or directory

 #include <gperftools/profiler.h>

but actual make proceeds just fine.

3) I want to build only static libs (and have built only static libs for protobuf3), so make (understandably) fails with:

usr/bin/ld: /home/abhishek/bitbucket/c3d/__build__/third_party/protobuf-3.0.0-alpha-2/lib/libprotobuf.a(message_lite.o): relocation R_X86_64_32S against `_ZTVN6google8protobuf11MessageLiteE' can not be used when making a shared object; recompile with -fPIC

/home/abhishek/bitbucket/c3d/__build__/third_party/protobuf-3.0.0-alpha-2/lib/libprotobuf.a: error adding symbols: Bad value

4) Specifying targets as in "make static plugins" works as expected

5) But if I specify a BUILDDIR for "make static plugins", it fails with


ar: ..//tmp/grpc-build/libs/opt/libgrpc.a: No such file or directory

make: *** [/tmp/grpc-build/libs/opt/libgrpc.a] Error 9

For all these make command my command line looked something like:

CXXFLAGS=-I/home/abhishek/bitbucket/c3d/__build__/third_party/protobuf-3.0.0-alpha-2/include LDFLAGS=-L/home/abhishek/bitbucket/c3d/__build__/third_party/protobuf-3.0.0-alpha-2/lib PATH=$PATH:/home/abhishek/bitbucket/c3d/__build__/third_party/protobuf-3.0.0-alpha-2/bin BUILDDIR=/tmp/grpc-build make static plugins


But when I look at /tmp/grpc-build/libs/opt  it has libgrpc.a


Any idea what could be wrong?  Is BUILDDIR not supported correctly by the makefile?



--
-Abhishek

Abhishek Parmar

unread,
Mar 24, 2015, 8:41:14 PM3/24/15
to Nicolas Noble, grp...@googlegroups.com
FWIW, running the same make command again seems to work fine.
--
-Abhishek

Abhishek Parmar

unread,
Apr 6, 2015, 6:02:53 PM4/6/15
to Nicolas Noble, grp...@googlegroups.com
Hi Nicholas,
Any idea why my usage of the makefile seems flaky and seems to think libgrp.a does not exist ?

-Abhishek
--
-Abhishek

Nicolas Noble

unread,
Apr 6, 2015, 6:34:08 PM4/6/15
to Abhishek Parmar, grp...@googlegroups.com
Hmmmm, we haven't tried too much the BUILDDIR trick yet. I wouldn't be surprised if there's a bug or two in regards to that feature. But trying it locally seems fine. What's your platform ?
Reply all
Reply to author
Forward
0 new messages