Skip to content

Instantly share code, notes, and snippets.

@lucifercr07
Last active October 29, 2018 13:39
Show Gist options
  • Save lucifercr07/4fd9f5eaf3b2da8cd7d2cae3a8a93c1e to your computer and use it in GitHub Desktop.
Save lucifercr07/4fd9f5eaf3b2da8cd7d2cae3a8a93c1e to your computer and use it in GitHub Desktop.
Cross compiling gRPC

Cross Compile gRPC

  • 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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment