gRPC Pull Request
cover gRPC Pull Request
The following changes since commit 037f38cc68aabb9e36e92862af258f46874e0c13:
gpsd: inherit pkgconfig (2021-09-30 11:04:32 -0700)
are available in the Git repository at:
git://github.com/UVV-gh/meta-openembedded bugfix/grpc-sdk
https://github.com/UVV-gh/meta-openembedded/tree/bugfix/grpc-sdk
Vyacheslav Yurkov (2):
grpc: fix cross-compilation of grpc applications
grpc: fix cross-compilation of grpc applications
...compilation-with-gRPC_BUILD_GRPC_CPP.patch | 55 +++++++++++++++++++ meta-oe/recipes-devtools/grpc/grpc_1.38.1.bb | 8 ++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0002-cmake-fix-cross-compilation-with-gRPC_BUILD_GRPC_CPP.patch
Signature · 1 line
2.28.0
PATCH 1/2 grpc: fix cross-compilation of grpc applications
When we build an application that uses grpc for the target, following error occurs
CMake Error at <application work dir>/recipe-sysroot/usr/lib/cmake/grpc/gRPCTargets.cmake:179 (message):
| The imported target "gRPC::grpc_cpp_plugin" references the file | | "<application work dir>/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 | | "<application work dir>/recipe-sysroot/usr/lib/cmake/grpc/gRPCTargets.cmake" | | but not all the files it references. | | Call Stack (most recent call first): | <application work dir>/recipe-sysroot/usr/lib/cmake/grpc/gRPCConfig.cmake:25 (include) | CMakeLists.txt:4 (find_package)
That's because target grpc was built with CPP plugin support and referenes it from CMake config file. This commit disables CPP plugin build for the target, and sets dependency on compiler for native and SDK builds
--- meta-oe/recipes-devtools/grpc/grpc_1.38.1.bb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
meta-oe/recipes-devtools/grpc/grpc_1.38.1.bb +6 -1
@@ -13,7 +13,11 @@ DEPENDS:append:class-nativesdk = " grpc-native " PACKAGE_BEFORE_PN = "${PN}-compiler" RDEPENDS:${PN}-compiler = "${PN}" -RDEPENDS:${PN}-dev += "${PN}-compiler" +RDEPENDS:${PN}-dev:class_native += "${PN}-compiler" +# Configuration above allows to cross-compile gRPC applications +# In order to compile applications on the target, use the dependency below +# Both dependencies are mutually exclusive +# RDEPENDS:${PN}-dev += "${PN}-compiler" S = "${WORKDIR}/git" SRCREV_grpc = "96b73272eadc01afb5fb45b92b408c47e4387274"
@@ -39,6 +43,7 @@ EXTRA_OECMAKE = " \ " PACKAGECONFIG ??= "cpp shared" +PACKAGECONFIG_class-target ?= "shared" PACKAGECONFIG[cpp] = "-DgRPC_BUILD_GRPC_CPP_PLUGIN=ON,-DgRPC_BUILD_GRPC_CPP_PLUGIN=OFF" PACKAGECONFIG[csharp] = "-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=ON,-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF" PACKAGECONFIG[node] = "-DgRPC_BUILD_GRPC_NODE_PLUGIN=ON,-DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF"
Signature · 1 line
2.28.0
PATCH 2/2 grpc: fix cross-compilation of grpc applications
In reply to Vyacheslav YurkovBackport a patch from grpc/master to be able to build c++ applications when gRPC_BUILD_GRPC_CPP_PLUGIN=OFF. The patch should be dropped on the recipe upgrade
--- ...compilation-with-gRPC_BUILD_GRPC_CPP.patch | 55 +++++++++++++++++++ meta-oe/recipes-devtools/grpc/grpc_1.38.1.bb | 1 + 2 files changed, 56 insertions(+) create mode 100644 meta-oe/recipes-devtools/grpc/grpc/0002-cmake-fix-cross-compilation-with-gRPC_BUILD_GRPC_CPP.patch
meta-oe/recipes-devtools/grpc/grpc/0002-cmake-fix-cross-compilation-with-gRPC_BUILD_GRPC_CPP.patch new file +55 -0
@@ -0,0 +1,55 @@ +From 83a66aa45d63d79cbccc47a65998723a7d2d7637 Mon Sep 17 00:00:00 2001 +From: Thomas De Schampheleire <[email protected]> +Date: Wed, 23 Jun 2021 14:22:59 +0200 +Subject: [PATCH] cmake: fix cross-compilation with + gRPC_BUILD_GRPC_CPP_PLUGIN=OFF (#26292) + +* cmake: fix cross-compilation with gRPC_BUILD_GRPC_CPP_PLUGIN=OFF + +When cross-compiling gRPC, a _native_ version of 'grpc_cpp_plugin' is +searched in the environment. For most use cases, a _cross_ version of this +file is not needed and gRPC_BUILD_GRPC_CPP_PLUGIN can be set to OFF. + +However, when cross-building with -DgRPC_BUILD_GRPC_CPP_PLUGIN=OFF, there +are some build errors, for example: + +make[3]: *** No rule to make target 'grpc_cpp_plugin', needed by 'gens/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc'. Stop. + +This is because there is still a hard dependency on 'grpc_cpp_plugin' for +these targets, not taking into account the cross-compilation case. + +Fix by depending on the variable gRPC_CPP_PLUGIN, which is set correctly for +either cross or native case. + +* regenerate projects +--- + CMakeLists.txt | 2 +- + templates/CMakeLists.txt.template | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index eeaf0b43c7..c60a64917a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -319,7 +319,7 @@ function(protobuf_generate_grpc_cpp) + --plugin=protoc-gen-grpc=${_gRPC_CPP_PLUGIN} + ${_protobuf_include_path} + ${REL_FIL} +- DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin ++ DEPENDS ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} ${_gRPC_CPP_PLUGIN} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Running gRPC C++ protocol buffer compiler on ${FIL}" + VERBATIM) +diff --git a/templates/CMakeLists.txt.template b/templates/CMakeLists.txt.template +index cef2534cbd..f0afe5108e 100644 +--- a/templates/CMakeLists.txt.template ++++ b/templates/CMakeLists.txt.template +@@ -389,7 +389,7 @@ + --plugin=protoc-gen-grpc=<%text>${_gRPC_CPP_PLUGIN}</%text> + <%text>${_protobuf_include_path}</%text> + <%text>${REL_FIL}</%text> +- DEPENDS <%text>${ABS_FIL}</%text> <%text>${_gRPC_PROTOBUF_PROTOC}</%text> grpc_cpp_plugin ++ DEPENDS <%text>${ABS_FIL}</%text> <%text>${_gRPC_PROTOBUF_PROTOC}</%text> <%text>${_gRPC_CPP_PLUGIN}</%text> + WORKING_DIRECTORY <%text>${CMAKE_CURRENT_SOURCE_DIR}</%text> + COMMENT "Running gRPC C++ protocol buffer compiler on <%text>${FIL}</%text>" + VERBATIM)
meta-oe/recipes-devtools/grpc/grpc_1.38.1.bb +1 -0
@@ -23,6 +23,7 @@ S = "${WORKDIR}/git" SRCREV_grpc = "96b73272eadc01afb5fb45b92b408c47e4387274" BRANCH = "v1.38.x" SRC_URI = "git://github.com/grpc/grpc.git;protocol=https;name=grpc;branch=${BRANCH} \ + file://0002-cmake-fix-cross-compilation-with-gRPC_BUILD_GRPC_CPP.patch \ " # Fixes build with older compilers 4.8 especially on ubuntu 14.04 CXXFLAGS:append:class-native = " -Wl,--no-as-needed"
Signature · 1 line
2.28.0