Issue
I am trying to get the gRPC helloworld example to be compiled with a bitbake recipe. The objective being able to call the greeter-client/server from the embedded target.
But, when I do a bitbake grpc-helloworld
, I get the following error message:
-- Using protobuf 3.11.4 -- Found ZLIB: /home/buildbot/oe-core/build/tmp/work/aarch64-tdx-linux/grpc-helloworld/1.0.0-r0/recipe-sysroot/usr/lib/libz.so (found version "1.2.11") -- Found OpenSSL: /home/buildbot/oe-core/build/tmp/work/aarch64-tdx-linux/grpc-helloworld/1.0.0-r0/recipe-sysroot/usr/lib/libcrypto.so (found version "1.1.1o") CMake Error at recipe-sysroot/usr/lib/cmake/grpc/gRPCTargets.cmake:197 (message):
The imported target "gRPC::grpc_cpp_plugin" references the file "/home/buildbot/oe-core/build/tmp/work/aarch64-tdx-linux/grpc-helloworld/1.0.0-r0/recipe-sysroot/usr/bin/grpc_cpp_plugin"but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained "/home/buildbot/oe-core/build/tmp/work/aarch64-tdx-linux/grpc-helloworld/1.0.0-r0/recipe-sysroot/usr/lib/cmake/grpc/gRPCTargets.cmake" but not all the files it references.
Call Stack (most recent call first):
recipe-sysroot/usr/lib/cmake/grpc/gRPCConfig.cmake:16 (include)
common.cmake:116 (find_package) CMakeLists.txt:5 (include)-- Configuring incomplete, errors occurred!
The grpc_cpp_plugin is indeed not in recipe-sysroot. How do I fix that?
File structure for the recipe:
recipes-customer/
grpc-helloworld_1.0.0.bb
grpc-helloworld/
CMakeLists.txt
common.cmake
greeter_client.cc
greeter_server.cc
helloworld.proto
Other than for the proto file and common.cmake paths, the CMakeLists.txt is the same as in the grpc example (https://github.com/grpc/grpc/blob/master/examples/cpp/helloworld/CMakeLists.txt).
I just changed the common.cmake for finding Protobuf from find_package(Protobuf CONFIG REQUIRED)
to find_package(Protobuf REQUIRED)
, otherwise this error appeared:
CMake Error at common.cmake:103 (find_package): Could not find a package configuration file provided by "Protobuf" with any of the following names:
ProtobufConfig.cmake protobuf-config.cmake
Add the installation prefix of "Protobuf" to CMAKE_PREFIX_PATH or set "Protobuf_DIR" to a directory containing one of the above files. If "Protobuf" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first):
CMakeLists.txt:5 (include)
This is the bitbake recipe so far, grpc-helloworld_1.0.0.bb:
SUMMARY = "gRPC Hello World"
LICENSE = "CLOSED"
DEPENDS += "protobuf grpc"
SRC_URI += "file://CMakeLists.txt file://*.cc file://*.h"
S = "${WORKDIR}"
inherit pkgconfig cmake
Why do these errors happen? Thank you for your help.
Edit: This same problem was unanswered here (Building a Yocto bitbake recipe, which depends on grpc, grpc-native fails saying the the grpc_cpp_plugin does not exist)
Solution
So, the solution is actually very simple: do not use dunfell.
Using kirkstone, what I showed just works (except file://*
aka glob which are not supported by kirkstone and the fact that the CMakeLists.txt file from the gRPC examples needs a install(TARGETS greeter_client greeter_server DESTINATION bin)
to complete the recipe task).
I had to be on dunfell until my BSP was updated so I was stuck on this for a while ...
Answered By - mmnano50 Answer Checked By - Candace Johnson (WPSolving Volunteer)