grpc libraries cross compiled to ARM aarch64 and getting grpc_cpp_plugin: program not found or is not executable

160 views
Skip to first unread message

cheta...@gmail.com

unread,
Jun 7, 2020, 2:42:41 AM6/7/20
to grpc.io

I have installed grpc on my host machine and i have taken the source code of grpc and i cross compiled to arm64 architecture.

for the cross compilation i have used the cmake command as follows.

sudo cmake -DCMAKE_TOOLCHAIN_FILE=/home/acer/cross_compile_grpc/grpc_install/grpc/toolchain.cmake \
      -DCMAKE_BUILD_TYPE=Release \
      -DBUILD_SHARED_LIBS=ON \
      -DCMAKE_INSTALL_PREFIX=/home/acer/cross_compile_grpc/grpc_install/grpc/grpc_install_2 \
      ../..

sudo make -j4 install

toolchain.cmake file contents are

SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR arm64)
#set(devel_root /tmp/raspberrypi_root)
#set(CMAKE_STAGING_PREFIX ${devel_root}/stage)
#set(tool_root ${devel_root}/raspberrypi-tools/arm-bcm2708)
#set(CMAKE_SYSROOT ${tool_root}/arm-rpi-4.9.3-linux-gnueabihf/arm-linux-gnueabihf/sysroot)
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-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)



after cross compiling i have a "grpc_cpp_plugin" which is cross compled and the proprties as follows.

grpc_cpp_plugin: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=48ee1bc844c70c0c3aa7691715bdf1236f84b46f, not stripped.

using the above grpc_cpp_plugin  i am getting the error like  grpc_cpp_plugin: program not found or is not executable

and also the cross compiler i have used is aarch64-linux-gnu-g++.
and also if i compile in eclipse only two files that is getting generated( i should get total four files including grpc services) and the files are as follows.

SimulatorServices.pb.cc and SimulatorServices.pb.h

Gustavo

unread,
Jun 7, 2020, 5:09:43 AM6/7/20
to cheta...@gmail.com, grpc.io
I found this file a useful reference for arm cross-compilation:
https://github.com/grpc/grpc/blob/master/test/distrib/cpp/run_distrib_test_raspberry_pi.sh

I think you are running into this problem because first you need to build/install gRPC for the host architecture, to be able to run protoc and grpc_cpp_plugin. At least that's what the comment says:

...
# Build and install gRPC for the host architecture.
# We do this because we need to be able to run protoc and grpc_cpp_plugin
# while cross-compiling.
...

Gustavo

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/463b512e-87db-4b04-bb6d-d885838e9d6fo%40googlegroups.com.

cheta...@gmail.com

unread,
Jun 7, 2020, 10:24:56 AM6/7/20
to grpc.io
Hi,
   Thanks for your reply.
1. i have installed gRPC installed on my host system.
2.i am using the same script which is suggested by you.

can you suggest with how to Cross compiling protobuf for ARM architecture i googled a lot but none of the links works....

On Sunday, 7 June 2020 14:39:43 UTC+5:30, Gustavo wrote:
I found this file a useful reference for arm cross-compilation:
https://github.com/grpc/grpc/blob/master/test/distrib/cpp/run_distrib_test_raspberry_pi.sh

I think you are running into this problem because first you need to build/install gRPC for the host architecture, to be able to run protoc and grpc_cpp_plugin. At least that's what the comment says:

...
# Build and install gRPC for the host architecture.
# We do this because we need to be able to run protoc and grpc_cpp_plugin
# while cross-compiling.
...

Gustavo

To unsubscribe from this group and stop receiving emails from it, send an email to grp...@googlegroups.com.

Gustavo

unread,
Jun 7, 2020, 2:24:18 PM6/7/20
to cheta...@gmail.com, grpc.io
My personal notes to cross-compile protobuf for a raspberry pi (adapt the path to your toolchain):

# use the same version as grpc if using grpc
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.10.1/protobuf-all-3.10.1.tar.gz
tar -zxvf protobuf-all-3.10.1.tar.gz
cd protobuf-all-3.10.1
./autogen.sh
./configure --prefix=/tmp/raspberrypi_root/raspberrypi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/arm-linux-gnueabihf/ --host=arm-linux-gnueabihf
make -j4
make install

To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/0fa655d7-dee4-48da-88c0-e25d6d4b8727o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages