- To cross compile gRPC
- Clone gRPC repo from here
- git submodule update --init
- make
- cd third_party/protobuf && make install
- cd ../..
- make install
- ldconfig
- make clean
- make plugins
- Clone new grpc repo at new location and cd into it
- git submodule update --init
- export GRPC_CROSS_COMPILE=true
- export GRPC_CROSS_AROPTS="cr --target=elf32-littlearm"
- export GRPC_CROSS_LDOPTS="-L/usr/local/lib -L/usr/local/cross/lib"
- make HAS_PKG_CONFIG=false CC=arm-linux-gnueabihf-gcc-6.4.0 CXX=arm-linux-gnueabihf-g++ LD=arm-linux-gnueabihf/bin/ld LDXX=arm-linux-gnueabihf-g++ RANLIB=arm-linux-gnueabihf/bin/ranlib AR=arm-linux-gnueabihf/bin/ar STRIP=arm-linux-gnueabihf/bin/strip PROTOBUF_CONFIG_OPTS="--host=arm-linux-gnueabihf --with-protoc=/usr/local/bin/protoc" static
Note: This only generate static libs. If required using toolchain to pass --sysroot pass using CFLAGS and CXXFLAGS e.g: CXXFLAGS="--sysroot=sysroot-lin-arm7a-hf"