安装命令如下图:https://github.com/grpc/grpc/tree/master/src/php
git clone -b v1.16.1 https://github.com/grpc/grpc # 下载指定版本
![](http://www.codelinux.cn/wp-content/uploads/2019/01/Grpc源码安装步骤.png)
问题:
![](http://www.codelinux.cn/wp-content/uploads/2019/01/Grpc源码安装步骤-报错信息.png)
解决: 安装 protobuf 吧,没啥办法啦
# 最好指定一个新的目录,不要使用默认的,默认的可能会有各种问题
./configure --prefix=/usr/local/protobuf
./configure --prefix=/usr/local/protobuf
make
make check
make install
问题: 按照上面的命令安装好后,再到grpc中执行 make 又报错如下:
![](http://www.codelinux.cn/wp-content/uploads/2019/01/Grpc源码安装步骤-报错信息2.png)
解决:配置好如下的环境变量,基本就能解决完了
# Protobuf
export PATH=$PATH:/usr/local/protobuf/bin
export PKG_CONFIG_PATH=/usr/local/protobuf/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
export CXXFLAGS="-I/usr/local/protobuf/include -L/usr/local/protobuf/lib/"
export LDFLAGS="-L/usr/local/protobuf/lib"
export PROTOC=/usr/local/protobuf/bin/protoc