cross_compile = arm-linux-,cross compile grpc for arm
8種機械鍵盤軸體對比
本人程序員,要買一個寫代碼的鍵盤,請問紅軸和茶軸怎么選?
This post will tell you how to cross compile gPRC static lib for ARM.
前段時間嘗試交叉編譯gRPC遇到了不少的麻煩,寫篇post記錄一下。
gRPC
Preparation
First of all, you should have gRPC source code. git clone it from github. Then update submodules:1
2cd grpc
git submodule update --init
Install zlib for your arm compiler[Optional]
libz is one of gRPC dependencies. If you haven’t installed it for your arm compiler yet, you may need to install it. You can get zlib at zlib Home Site. After download and unzip it, set cross compiler and build it:1
2
3
4export CC=arm-linux-gnueabihf-gcc
export AR=arm-linux-gnueabihf-ar
./configure
make -j4
then install it if build succeed:1make install prefix=/usr/arm-linux-gnueabihf
Compile and install protobuf & gRPC for HOST
protobuf:1
2
3
4cd grpc/third_party/protobuf
./autogen.sh && ./configure && make -j4
sudo make install -j4
sudo ldconfig
gRPC:1
2cd ..
make -j4 && sudo make install -j4 && sudo ldconfig
Cross compile static lib for ARM
make plugins first:1
2make clean
make plugins CC=arm-linux-gnueabihf-gcc -j4
Cross compile gRPC:1
2
3
4
5
6
7
8
9
10export GRPC_CROSS_COMPILE=true
export GRPC_CROSS_AROPTS="cr --target=elf32-little"
make -j4 HAS_PKG_CONFIG=false
CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++
RANLIB=arm-linux-gnueabihf-ranlib
LD=arm-linux-gnueabihf-ld
LDXX=arm-linux-gnueabihf-g++
AR=arm-linux-gnueabihf-ar
PROTOBUF_CONFIG_OPTS="--host=arm-linux-gnueabihf --with-protoc=/usr/local/bin/protoc" static
static is important. I tried to build shared lib but there will be a lot of errors because arm-linux-gnueabihf-ld doesn’t take “-Wl” as a parameter. If build succeed, you can find your static lib at “grpc/libs/opt”.
總結
以上是生活随笔為你收集整理的cross_compile = arm-linux-,cross compile grpc for arm的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 任天堂:中国游戏机市场不大 将继续联手腾
- 下一篇: minilog.exe是什么进程 min