Home/Support/Support Forum/How to port grpc helloworld(CPP) example on yocto
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to port grpc helloworld(CPP) example on yocto

0 votes
Hey i am trying to port the helloworld, cpp based demo for [gRPC][1] on yocto pyro on Ubuntu 16.04 LTS for target arm, . But i am getting the error.

**protoc -I ./ --grpc_out=. --plugin=protoc-gen-grpc=/home/admin/BUILD/tmp/sysroots-components/x86_64/grpc-native/usr/bin/grpc_cpp_plugin hello.proto**

**/home/admin/BUILD/tmp/sysroots-components/x86_64/grpc-native /usr/bin/grpc_cpp_plugin: error while loading shared libraries:libprotoc.so.15: cannot open shared object file: No such file or directory**

**--grpc_out: protoc-gen-grpc: Plugin failed with status code 127.**

**Makefile:55: recipe for target 'hello.grpc.pb.cc' faile**

So can anyone suggest the steps to solve this error.

Please find the helloworld.bb file.

DESCRIPTION = "Hello world"
SECTION = "Hello world"

S = "${COREBASE}/../../../src_dir/hello"
B = "${S}"

inherit externalsrc
EXTERNALSRC_pn-hello = "${S}"
EXTERNALSRC_BUILD_pn-hello = "${B}"

DEPENDS = "grpc-native protobuf-native protobuf-c gflags c-ares protobuf-c-native openssl"

PR = "r1"



do_compile() {

FILES_${PN} = "/*"

Please find the makefile for it.

CXX = arm-poky-linux-gnueabi-g++ -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a8 -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed --sysroot=/home/admin/BUILD/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/hello-demo/0.1.0-r1/recipe-sysroot

CXXFLAGS += -std=c++11
ifeq ($(SYSTEM),Darwin)
LDFLAGS += -L/usr/local/lib `pkg-config --libs protobuf grpc++ grpc`\
LDFLAGS += -L/home/admin/BUILD/tmp/work/cortexa8hf-neon-poky-linux-gnueabi/hello-demo/0.1.0-r1/recipe-sysroot/usr/lib -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed\

PROTOC = protoc
GRPC_CPP_PLUGIN = grpc_cpp_plugin
GRPC_CPP_PLUGIN_PATH ?= /home/admin/BUILD/tmp/sysroots-components/x86_64/grpc-native/usr/bin/grpc_cpp_plugin


vpath %.proto $(PROTOS_PATH)

all: hello_client hello_server

hello_client: hello.pb.o hello.grpc.pb.o hello-client.o
$(CXX) $^ $(LDFLAGS) -o $@

hello_server: hello.pb.o hello.grpc.pb.o hello-server.o
$(CXX) $^ $(LDFLAGS) -o $@

.PRECIOUS: %.grpc.pb.cc
%.grpc.pb.cc: %.proto
$(PROTOC) -I $(PROTOS_PATH) --grpc_out=. --plugin=protoc-gen- grpc=$(GRPC_CPP_PLUGIN_PATH) $<

.PRECIOUS: %.pb.cc
%.pb.cc: %.proto
$(PROTOC) -I $(PROTOS_PATH) --cpp_out=. $<

rm -f *.o *.pb.cc *.pb.h hello_client hello_server


[1]: https://github.com/grpc/grpc/tree/master/examples/cpp/helloworld
asked Apr 25, 2018 in Linux by jay_94 New to the Community (0 points)
recategorized Apr 27, 2018 by rmaroun

Please log in or register to answer this question.

1 Answer

0 votes
Before adding it to Yocto build try building it using DEY SDK from the command line or using Eclipse. Does that work?
you probably missing a grpc layer
answered Apr 28, 2018 by LeonidM Veteran of the Digi Community (3,622 points)