Skip to contentSkip to conversation

capnproto: remove binary checking from target cmake file

PATCH In review Gyorgy Sarvari 2 participants 3 messages Feb 2, 2025 – Feb 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 capnproto: remove binary checking from target cmake file

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.

---
 meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb | 6 ++++++
 1 file changed, 6 insertions(+)
meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb +6 -0
index daeeb975f..ad4e036a4 100644
@@ -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"
#1 lore raw

meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb FILES:${PN}-compiler = "${bindir}" · line 34

Quoted 5 lines · Gyorgy Sarvari via lists.openembedded.org
meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb +5 -0
+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

#2 lore raw
Quoted 10 lines · Ross Burton

meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb FILES:${PN}-compiler = "${bindir}" · line 34

Quoted 5 lines · Gyorgy Sarvari via lists.openembedded.org
meta-oe/recipes-devtools/capnproto/capnproto_1.0.2.bb +5 -0
+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...