3

I installed grpc-java according to the instructions on my Mac (running Mavericks). This included installing protobuf v3.0.0-alpha-2, which I did:

$ which protoc
/usr/local/bin/protoc

$ /usr/local/bin/protoc --version
libprotoc 3.0.0

The Java examples work fine. Now I'd like to try the C++ examples and, ideally, have a C++ client talk to a Java server and visa-versa.

I cloned grpc and attempted to install it. sudo make install and, subsequently, make verify-install fail, telling me that protobuf 3 is not installed:

$ make verify-install
We couldn't find protoc 3.0.0+ installed on your system. While this
won't prevent grpc from working, you won't be able to compile
and run any meaningful code with it.


Please download and install protobuf 3.0.0+ from:

   https://github.com/google/protobuf/releases

Once you've done so, or if you think this message is in error,
you can re-run this check by doing:

   make verify-install

On line 259 of grpc/Makefile, I see this test:

PROTOC_CHECK_CMD = protoc --version | grep -q libprotoc.3

If I run protoc --version on my Mac, I see something different (see above), so I tried changing the line above to

PROTOC_CHECK_CMD = protoc --version | grep -q 'libprotoc 3.0.0'

However I get the same error from make verify-install.

I'e also tried removing the PROTOBUF_CHECK_CMD and PROTOC_CHECK_CMD tests at run_dep_checks (about line #895) but install still fails with the same error.

When I run make on grpc-common/cpp/helloworld, it builds, but greeter_client and greeter_server both fail:

$ ./greeter_server
E0310 17:38:23.349841000 140735186797328 server.c:617] assertion failed: grpc_is_initialized() && "call grpc_init()"
Abort trap: 6

I assume because the problem with installing grpc.

So, protobuf 3 is clearly installed. How can I convince the Makefile of that, or at least bypass that test?

4

2 回答 2

1

您看到的有关 protoc 的消息并不表示make失败。这只是一个警告。您成功安装了 gRPC 并成功构建了 hello world 示例。

由于 gRPC 中的一个错误,该示例在 Mac 上不起作用,目前正在此 GitHub 问题中进行调查。

于 2015-03-11T21:29:40.863 回答
0

问题是sudo make install在 protoc 下安装/usr/local/bingrpc看起来在/usr/bin. 尝试使用以下命令配置 protobuf:

./configure --prefix=/usr

这会将 protoc 二进制文件安装在 grpc 期望的位置。当您sudo make install在 grpc 上执行操作时,sudo 会正确找到 protoc。您可以使用以下命令验证 sudo 是否看到它:

sudo which protoc
sudo sh -c 'echo $PATH'

请注意,sudo echo $PATH它不会告诉您 sudo 的路径在哪里。

于 2015-04-16T02:15:15.660 回答