Skip to contentSkip to conversation

protobuf: stage protoc binary to sysroot

PATCH Samuli Piippo 4 participants 7 messages Sep 27, 2023 – Sep 28, 2023 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Re-applying this patch as it got removed in
https://patchwork.yoctoproject.org/project/oe/patch/[email protected]/

Quoted 64 lines · Samuli Piippo via lists.openembedded.org

From: Samuli Piippo <[email protected]>

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.

---
 meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +1 -0
index d95e1c20f..06b21a0d6 100644
@@ -92,6 +92,9 @@ PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
 FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
 FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
 
+# CMake requires binaries to exist in sysroot, even if they have wrong

architecture.

meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +2 -0
+SYSROOT_DIRS += "${bindir}"
+
 RDEPENDS:${PN}-compiler = "${PN}"
 RDEPENDS:${PN}-dev += "${PN}-compiler"
 RDEPENDS:${PN}-ptest = "bash ${@bb.utils.contains('PACKAGECONFIG',

'python', 'python3-protobuf', '', d)}"
--
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#105163):
https://lists.openembedded.org/g/openembedded-devel/message/105163
Mute This Topic: https://lists.openembedded.org/mt/101612304/3617605
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi Samuli,

Quoted 28 lines · Samuli Piippo

Re-applying this patch as it got removed in https://patchwork.yoctoproject.org/project/oe/patch/[email protected]/

Quoted 24 lines · Samuli Piippo via lists.openembedded.org

From: Samuli Piippo <[email protected]>

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.

+Ross Burton

You will have the same issue with gRPC binaries and I think the best solution is to fix the QT CMake instead of contaminating the rootfs, no?

You should update to have something like this:
https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/blob/master/CMakeLists.txt

Regards,
Clement

Quoted 36 lines
Quoted 22 lines
---
 meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +3 -1
index d95e1c20f..06b21a0d6 100644
@@ -92,6 +92,9 @@ PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
 FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
 FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
 
+# CMake requires binaries to exist in sysroot, even if they have 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)}"
--
Quoted 5 lines

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#105165): https://lists.openembedded.org/g/openembedded-devel/message/105165
Mute This Topic: https://lists.openembedded.org/mt/101612304/4240582
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 33 lines · Clément Péron via lists.openembedded.org

Hi Samuli,

Quoted 28 lines · Samuli Piippo

Re-applying this patch as it got removed in https://patchwork.yoctoproject.org/project/oe/patch/[email protected]/

Quoted 24 lines · Samuli Piippo via lists.openembedded.org

From: Samuli Piippo <[email protected]>

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.

Quoted 7 lines

+Ross Burton

You will have the same issue with gRPC binaries and I think the best solution is to fix the QT CMake instead of contaminating the rootfs, no?

You should update to have something like this:
https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/blob/master/CMakeLists.txt

This patch in particular
https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/commit/47f0d9e0326f3cc31c801a0ecf7312d1049ece3e

Quoted 44 lines

Regards,
Clement

Quoted 15 lines
Quoted 15 lines
---
 meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +0 -0
index d95e1c20f..06b21a0d6 100644
@@ -92,6 +92,9 @@ PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
 FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
 FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
 
Quoted 15 lines
Quoted 7 lines
meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +3 -1
+# CMake requires binaries to exist in sysroot, even if they have 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)}"
--
Quoted 5 lines

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#105199): https://lists.openembedded.org/g/openembedded-devel/message/105199
Mute This Topic: https://lists.openembedded.org/mt/101612304/4240582
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#5 lore raw
Quoted 39 lines · Clément Péron
Quoted 35 lines · Clément Péron via lists.openembedded.org

Hi Samuli,

Quoted 28 lines · Samuli Piippo

Re-applying this patch as it got removed in https://patchwork.yoctoproject.org/project/oe/patch/[email protected]/

Quoted 24 lines · Samuli Piippo via lists.openembedded.org

From: Samuli Piippo <[email protected]>

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.

+Ross Burton

Quoted 8 lines
Quoted 5 lines

You will have the same issue with gRPC binaries and I think the best solution is to fix the QT CMake instead of contaminating the rootfs, no?

You should update to have something like this:
https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/blob/master/CMakeLists.txt

This patch in particular
https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/commit/47f0d9e0326f3cc31c801a0ecf7312d1049ece3e

yeah, this to me looks a better fix since its scoped at recipe level and makes is cross compile friendly.
I hope it will keep working with older versions of protobuffers

Quoted 46 lines
Quoted 46 lines

Regards,
Clement

Quoted 15 lines
Quoted 15 lines
---
 meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +0 -0
index d95e1c20f..06b21a0d6 100644
@@ -92,6 +92,9 @@ PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
 FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
 FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
 
Quoted 15 lines
Quoted 7 lines
meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +3 -1
+# CMake requires binaries to exist in sysroot, even if they have 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)}"
--
Quoted 5 lines

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#105199): https://lists.openembedded.org/g/openembedded-devel/message/105199
Mute This Topic: https://lists.openembedded.org/mt/101612304/4240582
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#6 lore raw

Hi,

Quoted 47 lines · Khem Raj
Quoted 45 lines · Clément Péron
Quoted 40 lines · Clément Péron via lists.openembedded.org

Hi Samuli,

Quoted 28 lines · Samuli Piippo

Re-applying this patch as it got removed in https://patchwork.yoctoproject.org/project/oe/patch/[email protected]/

Quoted 24 lines · Samuli Piippo via lists.openembedded.org

From: Samuli Piippo <[email protected]>

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.

+Ross Burton

You will have the same issue with gRPC binaries and I think the best solution is to fix the QT CMake instead of contaminating the rootfs, no?

You should update to have something like this:
https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/blob/master/CMakeLists.txt

Quoted 6 lines
Quoted 2 lines

This patch in particular
https://github.com/etcd-cpp-apiv3/etcd-cpp-apiv3/commit/47f0d9e0326f3cc31c801a0ecf7312d1049ece3e

yeah, this to me looks a better fix since its scoped at recipe level and makes is cross compile friendly.
I hope it will keep working with older versions of protobuffers

Also I don't see the recipe "qtgrpc" in meta-oe nor other layers.

https://layers.openembedded.org/layerindex/branch/master/recipes/?q=qtgrpc

I would be in favor of reverting this patch if there is no answer from Samuli.

Samuli, could you point to a bitbake recipe to build qtgrpc ?

Regards,

Quoted 47 lines
Quoted 47 lines
Quoted 47 lines

Regards,
Clement

Quoted 15 lines
Quoted 15 lines
---
 meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +0 -0
index d95e1c20f..06b21a0d6 100644
@@ -92,6 +92,9 @@ PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
 FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
 FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
 
Quoted 15 lines
Quoted 7 lines
meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +3 -1
+# CMake requires binaries to exist in sysroot, even if they have 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)}"
--
Quoted 5 lines

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#105199): https://lists.openembedded.org/g/openembedded-devel/message/105199
Mute This Topic: https://lists.openembedded.org/mt/101612304/4240582
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#7 lore raw
In reply to Samuli Piippo

I think I was the one who originally removed protoc, because it's not useful in the sysroot. Even if you satisfy cmake so it can find protoc target, the next step is that it will try to use it, which will obviously fail.

The only reason to put it on the target sysroot would be if you really going to use it _on the target_. But I guess this can be done via bbappend in the user layer.

Vyacheslav

Quoted 65 lines · Samuli Piippo

Re-applying this patch as it got removed in https://patchwork.yoctoproject.org/project/oe/patch/[email protected]/

On Wed, 27 Sept 2023 at 08:11, Samuli Piippo via lists.openembedded.org <http://lists.openembedded.org> <[email protected]> wrote:

    From: Samuli Piippo <[email protected]>

    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 <[email protected]>
    Signed-off-by: Khem Raj <[email protected]>
    ---
     meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb
    <http://protobuf_3.21.12.bb> | 3 +++
     1 file changed, 3 insertions(+)

    diff --git a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb
    <http://protobuf_3.21.12.bb>
    b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb
    <http://protobuf_3.21.12.bb>
    index d95e1c20f..06b21a0d6 100644
    --- a/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb
    <http://protobuf_3.21.12.bb>
    +++ b/meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb
    <http://protobuf_3.21.12.bb>
    @@ -92,6 +92,9 @@ PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
     FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
     FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"

    +# CMake requires binaries to exist in sysroot, even if they have
    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)}"
    -- 
    2.25.1
#8 lore raw

Hi,

Quoted 4 lines · Vyacheslav Yurkov

I think I was the one who originally removed protoc, because it's not useful in the sysroot. Even if you satisfy cmake so it can find protoc target, the next step is that it will try to use it, which will obviously fail.

The only reason to put it on the target sysroot would be if you really going to use it _on the target_. But I guess this can be done via bbappend in the user layer.

The files is properly installed when you set PACKAGECONFIG to compiler. FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"

Which is done when by default for native
PACKAGECONFIG:class-native ?= "compiler"

If you really need it in the target then set the package config "compiler" for the target recipe.

But mixing architecture in the sysroot is a Hack and this would lead to undefined behavior regarding the arch / tune you select.

Regards
Clement

Quoted 69 lines

Vyacheslav

On 27.09.2023 07:19, Samuli Piippo wrote:

Re-applying this patch as it got removed in https://patchwork.yoctoproject.org/project/oe/patch/[email protected]/

Quoted 46 lines · Samuli Piippo via lists.openembedded.org

From: Samuli Piippo <[email protected]>

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.

---
 meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-oe/recipes-devtools/protobuf/protobuf_3.21.12.bb +3 -1
index d95e1c20f..06b21a0d6 100644
@@ -92,6 +92,9 @@ PACKAGE_BEFORE_PN = "${PN}-compiler ${PN}-lite"
 FILES:${PN}-compiler = "${bindir} ${libdir}/libprotoc${SOLIBS}"
 FILES:${PN}-lite = "${libdir}/libprotobuf-lite${SOLIBS}"
 
+# CMake requires binaries to exist in sysroot, even if they have 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)}"
--
Quoted 5 lines

2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#105224): https://lists.openembedded.org/g/openembedded-devel/message/105224
Mute This Topic: https://lists.openembedded.org/mt/101612304/4240582
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-