diff mbox series

[meta-oe] protobuf: stage protoc binary to sysroot

Message ID 20231113084245.96832-1-samuli.piippo@qt.io
State Accepted
Headers show
Series [meta-oe] protobuf: stage protoc binary to sysroot | expand

Commit Message

Samuli Piippo Nov. 13, 2023, 8:42 a.m. UTC
If protoc is enabled for the build, recipes using protobuf will
fail when protoc is not available in the recipe sysroot:

|   The imported target "protobuf::protoc" references the file
|
|      ".../recipe-sysroot/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/protoc-3.21.5.0"
|
|   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
|
|      ".../recipe-sysroot/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/cmake/protobuf/protobuf-targets.cmake"
|
|   but not all the files it references.

Use SYSROOT_DIRS to stage the binary to sysroot so it's always
available for other recipes.

Signed-off-by: Samuli Piippo <samuli.piippo@qt.io>
---
 meta-oe/recipes-devtools/protobuf/protobuf_4.23.4.bb | 3 +++
 1 file changed, 3 insertions(+)

Comments

Khem Raj Nov. 15, 2023, 7:19 a.m. UTC | #1
On Mon, 13 Nov 2023 08:42:45 +0000, Samuli Piippo wrote:
> If protoc is enabled for the build, recipes using protobuf will
> fail when protoc is not available in the recipe sysroot:
> 
> |   The imported target "protobuf::protoc" references the file
> |
> |      ".../recipe-sysroot/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/bin/protoc-3.21.5.0"
> |
> |   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
> |
> |      ".../recipe-sysroot/usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/usr/lib/cmake/protobuf/protobuf-targets.cmake"
> |
> |   but not all the files it references.
> 
> [...]

Applied, thanks!

[1/1] protobuf: stage protoc binary to sysroot
      commit: b1deec0de476d8f0a0c6427919f57ee5f681ea0e

Best regards,
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/protobuf/protobuf_4.23.4.bb b/meta-oe/recipes-devtools/protobuf/protobuf_4.23.4.bb
index 1edc21cdf..7d37ee3d2 100644
--- a/meta-oe/recipes-devtools/protobuf/protobuf_4.23.4.bb
+++ b/meta-oe/recipes-devtools/protobuf/protobuf_4.23.4.bb
@@ -101,6 +101,9 @@  PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
 FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
 FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
 
+# CMake requires protoc binary to exist in sysroot, even if it has wrong architecture.
+SYSROOT_DIRS += "${bindir}"
+
 RDEPENDS:${PN}-compiler = "${PN}"
 RDEPENDS:${PN}-dev += "${PN}-compiler"
 RDEPENDS:${PN}-ptest = "bash ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3-protobuf', '', d)}"