'Wrong static reference to libprotobuf.so in gRPCTargets.cmake
I am building a rocko based Image and SDK with gRPC support. Because of other dependencies, I have decided to go with grpc 1.36.4 and protobuf 3.13.0.1. The recipes have built successfully and the SDK was deployed, but here is the problem: The generated gRPCTargets.cmake references the libprotobuf.so statically, pointing to the folder on my build host.
set_target_properties(gRPC::grpc++_error_details PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "/home/user/yocto/build/tmp/work/cortexa9hf-neon-dist-linux-gnueabi/grpc/1.36.4-r0/recipe-sysroot/usr/lib/libprotobuf.so;lpthread;dl;rt;m;pthread;gRPC::grpc++;gRPC::grpc;gRPC::gpr;gRPC::address_sorting;gRPC::upb")
That poses a problem when I try to build an application with the SDK, because the libprotobuf.so could not be found. At the final linking step I could see this error:
make[2]: *** No rule to make target '/home/user/yocto/build/tmp/work/cortexa9hf-neon-dist-linux-gnueabi/grpc/1.36.4-r0/recipe-sysroot/usr/lib/libprotobuf.so', needed by TestApp'. Stop.
I have tried to modify the libprotobuf.cmake from the package protobuf itself, hard coding to SHARED but nothing changed.
A quick solution would be to replace the generated gRPCTargets.cmake with a correct one. However it would be better to solve this on the recipe level. This is the referenced Recipe: http://cgit.openembedded.org/meta-openembedded/tree/meta-oe/recipes-devtools/grpc/grpc_1.36.4.bb?h=hardknott Is it possible to modify the grpc_1.36.4.bb so that the generated gRPCTargets.cmake looks for protobuf::libprotobuf instead of the static path?
Maybe the problem lies somewhere else, but after a few days I couldn't locate it. Therefore I would appreciate any hints in the right direction.
Notice: If I am building the same recipes usind dunfell, the problem doesn't occur.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
