diff mbox series

[meta-oe] capnproto: remove binary checking from target cmake file

Message ID 20250202190608.1521989-1-skandigraun@gmail.com
State New
Headers show
Series [meta-oe] capnproto: remove binary checking from target cmake file | expand

Commit Message

Gyorgy Sarvari Feb. 2, 2025, 7:06 p.m. UTC
When linking to capnproto from another project, cmake fails to
find this package with the following error:

| CMake Error at ${RECIPE_SYSROOT}/usr/lib/cmake/CapnProto/CapnProtoTargets.cmake:176 (message):
|   The imported target "CapnProto::capnp_tool" references the file
|
|      "${RECIPE_SYSROOT}/usr/bin/capnp"
|
|   but this file does not exist.  Possible reasons include:

This generates some binary files in ${bindir}, and when crosscompiling,
these files are not included in ${RECIPE_SYSROOT} of the project that
references this ones.

However the cmake file does check if these binaries exist, ultimately
failing the do_configure task due to not finding them. Since these
binaries are not usable on the build system anyway, just remove the
checking of them when compiling for class-target.

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
---
 meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ross Burton Feb. 2, 2025, 8:33 p.m. UTC | #1
On 2 Feb 2025, at 20:06, Gyorgy Sarvari via lists.openembedded.org <skandigraun=gmail.com@lists.openembedded.org> wrote:
> +do_install:append:class-target() {
> +  # delete lines checking files in bindir, e.g. this:
> +  # list(APPEND _cmake_import_check_files_for_CapnProto::capnp_tool "${_IMPORT_PREFIX}/bin/capnp" )
> +  sed -i "/.*_cmake_import_check_files_for_CapnProto.*bin\/.*/d" ${D}${libdir}/cmake/CapnProto/CapnProtoTargets-noconfig.cmake
> +}

A sed like this is incredibly fragile and will silently stop working if the cmake files changes. I recommend using a patch instead, as they fail fast instead of silently.

Ross
Gyorgy Sarvari Feb. 3, 2025, 7:48 a.m. UTC | #2
On 02.02.25 21:33, Ross Burton wrote:
> On 2 Feb 2025, at 20:06, Gyorgy Sarvari via lists.openembedded.org <skandigraun=gmail.com@lists.openembedded.org> wrote:
>> +do_install:append:class-target() {
>> +  # delete lines checking files in bindir, e.g. this:
>> +  # list(APPEND _cmake_import_check_files_for_CapnProto::capnp_tool "${_IMPORT_PREFIX}/bin/capnp" )
>> +  sed -i "/.*_cmake_import_check_files_for_CapnProto.*bin\/.*/d" ${D}${libdir}/cmake/CapnProto/CapnProtoTargets-noconfig.cmake
>> +}
> A sed like this is incredibly fragile and will silently stop working if the cmake files changes. I recommend using a patch instead, as they fail fast instead of silently.
>
> Ross
>
Looking into it...
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb b/meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb
index daeeb975f..ad4e036a4 100644
--- a/meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb
+++ b/meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb
@@ -27,4 +27,10 @@  FILES:${PN}-compiler = "${bindir}"
 PACKAGE_BEFORE_PN = "${PN}-compiler"
 RDEPENDS:${PN}-dev += "${PN}-compiler"
 
+do_install:append:class-target() {
+  # delete lines checking files in bindir, e.g. this:
+  # list(APPEND _cmake_import_check_files_for_CapnProto::capnp_tool "${_IMPORT_PREFIX}/bin/capnp" )
+  sed -i "/.*_cmake_import_check_files_for_CapnProto.*bin\/.*/d" ${D}${libdir}/cmake/CapnProto/CapnProtoTargets-noconfig.cmake
+}
+
 BBCLASSEXTEND = "native nativesdk"