Hi Stefan,

On Fri, 8 Apr 2022 at 14:47, Stefan Herbrechtsmeier
<[email protected]> wrote:
>
> Hi Clement,
>
> Am 08.04.2022 um 14:25 schrieb Clément Péron:
> > Hi Stefan,
> >
> > On Fri, 8 Apr 2022 at 09:30, Stefan Herbrechtsmeier
> > <[email protected]> wrote:
> >>
> >> From: Stefan Herbrechtsmeier <[email protected]>
> >>
> >> The CMake gRPC config checks for binaries and fails if a binary (plugin)
> >> is missing. Fix the problem in the code and add the CMake gRPC config
> >> back to the target package.
> >
> > Thanks for your patch, I'm still using gRPC 1.35 + your previous similar 
> > patch.
> > I'm trying to bump to gRPC 1.45.1 + these patches.
> >
> > My recipe use CMake and depends on grpc and grpc-native:
> > PACKAGECONFIG[grpc] = "-DCONFIG_GRPC=ON,-DCONFIG_GRPC=OFF,grpc grpc-native"
> >
> > But unfortunately CMake doesn't find the grpc_cpp_plugin.
>
> This is the correct behavior of my patch because the grpc_cpp_plugin
> from the cross build isn't usable during cross build. You need the
> grpc_cpp_plugin from the host and therefore have to search the
> grpc_cpp_plugin by yourself during cross compile [1].
>
> My first patch was rejected and therefore I create a minimal patch which
> only make the CMake gRPC config usable.
>
> >
> > | -- Using gRPC 1.45.1
> > ....
> > | CMake Error at modules/grpc/CMakeLists.txt:37 (add_custom_command):
> > |   Error evaluating generator expression:
> > |
> > |     $<TARGET_FILE:gRPC::grpc_cpp_plugin>
> > |
> > |   No target "gRPC::grpc_cpp_plugin"
> > |
> > |
> > | CMake Error at modules/grpc/CMakeLists.txt:37 (add_custom_command):
> > |   Error evaluating generator expression:
> > |
> > |     $<TARGET_FILE:gRPC::grpc_cpp_plugin>
> > |
> > |   No target "gRPC::grpc_cpp_plugin"
> > |
> > |
> > | CMake Error at modules/grpc/CMakeLists.txt:37 (add_custom_command):
> > |   Error evaluating generator expression:
> > |
> > |     $<TARGET_FILE:gRPC::grpc_cpp_plugin>
> > |
> > |   No target "gRPC::grpc_cpp_plugin"
> >
> > Here is my CMake source file:
> >
> > # Find Protobuf installation Yocto SDK doensn't support 
> > protobuf-config.cmake
> > # for the moment
> > set(protobuf_MODULE_COMPATIBLE TRUE)
> > find_package(Protobuf REQUIRED)
> > message(STATUS "Using protobuf ${Protobuf_VERSION}")
> > set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
> >
> > # Find gRPC installation Looks for gRPCConfig.cmake file installed by gRPC's
> > # cmake installation.
> > find_package(gRPC CONFIG REQUIRED)
> > message(STATUS "Using gRPC ${gRPC_VERSION}")
> > set(_REFLECTION gRPC::grpc++_reflection)
> > set(_GRPC_GRPCPP gRPC::grpc++)
> >
> > # Get full path of protobuf/gRPC compiler
> > set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
> > set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
>
> You have to search the binaries if you cross compile [1]:
>
> if(CMAKE_CROSSCOMPILING)
>    find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
> else()
>    set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
> endif()

Thanks this fix my issue

Tested-by: Clément Péron <[email protected]>

>
> >
> > Do you have an example of how you look for gRPC in your recipe?
>
> This isn't possible because you use a target and not a variable.

Maybe a dumb question but how protobuf-compiler handle this?

Thanks,
Clement



>
> [1] https://github.com/grpc/grpc/blob/master/examples/cpp/cmake/common.cmake
>
> Regards
>    Stefan
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#96485): 
https://lists.openembedded.org/g/openembedded-devel/message/96485
Mute This Topic: https://lists.openembedded.org/mt/90331029/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to