Hi Folks,
This is the first time to cross compile, of any software, gRPC for openwrt platform. I have referred many examples and posts. I have got the essence of it but not able to compile it successfully.
the binaries, include and libraries files are under
~/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/
Below are the ways I have tried to cross compile
1. There is an example in gRPC
~/grpc/test/distrib/cpp/run_distrib_test_raspberry_pi.sh
I have followed the above example and made changes in the toolchain.cmake file as below
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(devel_root ~/openwrt)
set(CMAKE_SYSROOT ${devel_root}/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/mips-openwrt-linux)
set(CMAKE_STAGING_PREFIX ${devel_root}/stage)
set(tool_root ${devel_root}/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl)
set(CMAKE_C_COMPILER ${tool_root}/bin/mips-openwrt-linux-gcc)
set(CMAKE_CXX_COMPILER ${tool_root}/bin/mips-openwrt-linux-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
But this is of no use and this will
always fails at protobuf and along with that will get the below error
undefined reference to `__atomic_fetch_add_8'
and now it sometimes show the below error as well
recipe for target 'grpc_ruby_plugin' failed
2. In few posts, I have seen make comand which is being used directly, such as
make HAS_PKG_CONFIG=false CC=arm-xilinx-linux-gnueabi-gcc CXX=arm-xilinx-linux-gnueabi-g++ LD=arm-xilinx-linux-gnueabi-gcc LDXX=arm-xilinx-linux-gnueabi-g++ AR=arm-xilinx-linux-gnueabi-ar CPPFLAGS=-I/home/rafael/mobi/ArmLibs/include LDFLAGS=-L/home/rafael/mobi/ArmLibs/lib
instead here for example I would provide the whole path for
CC , lets say
CC=~/openwrt/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl/bin/mips-openwrt-linux-gcc
In the same way, I would provide for
CXX, LD, LDXX, AR, CPPFLAGS and LDFLAGS.
Even this runs into error.
Any help would be appreciated.
Thanks