首先获取git源码:git clone https://github.com/grpc/grpc.git
cd grpc
git submodule update --init
安装zlib。
export CC=arm-linux-gnueabihf-gcc
export AR=arm-linux-gnueabihf-ar
./configure
make -j4
make install prefix=/usr/arm-linux-gnueabihf
编译protobuf:
cd grpc/third_party/protobuf
./autogen.sh && ./configure && make -j4
sudo make install -j4
sudo ldconfig
编译gRPC:
cd ..
make -j4 && sudo make install -j4 && sudo ldconfig
编译Arm静态库:
make clean
make plugins CC=arm-linux-gnueabihf-gcc -j4
交叉编译gRPC