openembedded/meta-openembedded

kirkstone: problems cross compiling capnproto

Opened this issue · 0 comments

Hello,

We have problems compiling capnproo in Yocto using meta-openembedded recipe.

First of all, using capnproto inside another cmake-based build recipe does not work (messages have been altered to remove paths and names including non-public information):

| CMake Error at [...]/02.02.00-r0/recipe-sysroot/usr/lib/cmake/CapnProto/CapnProtoTargets.cmake:170 (message):
|   The imported target "CapnProto::capnp_tool" references the file
|
|      "[...]/02.02.00-r0/recipe-sysroot/usr/bin/capnp"
|
|   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
|
|      "[...]/02.02.00-r0/recipe-sysroot/usr/lib/cmake/CapnProto/CapnProtoTargets.cmake"
|
|   but not all the files it references.
|
| Call Stack (most recent call first):
|   [...]/02.02.00-r0/recipe-sysroot/usr/lib/cmake/CapnProto/CapnProtoConfig.cmake:99 (include)
|   CMakeLists.txt:69 (find_package)
|
|
| -- Configuring incomplete, errors occurred!
| See also "[...]/02.02.00-r0/build/CMakeFiles/CMakeOutput.log".
| WARNING: exit code 1 from a shell command.
ERROR: Task ([...]_02.02.00.bb:do_configure) failed with exit code '1'

This appears to be caued by capnproto/capnproto#1802 , where capnproto author recommends to not use cmake.

To fix this we had to patch the capnproto recipe:

do_install:append() {
	# Removed import of capnp_tool, capnpc_cpp and capnpc_capnp from _IMPORT_CHECK_TARGETS
	# because it does not correspond to the correct path during the compilation
	sed -i ${D}${libdir}/cmake/CapnProto/CapnProtoTargets-noconfig.cmake -e 's/^list(APPEND _IMPORT_CHECK_TARGETS CapnProto::capnp_tool )//g'
	sed -i ${D}${libdir}/cmake/CapnProto/CapnProtoTargets-noconfig.cmake -e 's/^list(APPEND _IMPORT_CHECK_TARGETS CapnProto::capnpc_cpp )//g'
	sed -i ${D}${libdir}/cmake/CapnProto/CapnProtoTargets-noconfig.cmake -e 's/^list(APPEND _IMPORT_CHECK_TARGETS CapnProto::capnpc_capnp )//g'
}

With this patch, our software builds fine and we can generate disk images, but we are unable to generate a SDK for cross-compilation outside of Yocto, with the following error:


ERROR: [...]-image-debug-1.0-r0 do_populate_sdk: Could not invoke dnf. Command '[...]-image-debug/1.0-r0/recipe-sysroot-native/usr/bin/dnf -v --rpmverbosity=info -y
	-c [...]-image-debug/1.0-r0/sdk/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/cortexa53-crypto-fsl-linux/etc/dnf/dnf.conf
	--setopt=reposdir=[...]-image-debug/1.0-r0/sdk/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/cortexa53-crypto-fsl-linux/etc/yum.repos.d
	--installroot=[...]-image-debug/1.0-r0/sdk/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/cortexa53-crypto-fsl-linux
	--setopt=logdir=[...]-image-debug/1.0-r0/temp --repofrompath=oe-repo,[...]-image-debug/1.0-r0/oe-sdk-repo
	--nogpgcheck install [...] capnproto [...]' returned 1:
DNF version: 4.11.1
cachedir: [...]-image-debug/1.0-r0/sdk/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/cortexa53-crypto-fsl-linux/var/cache/dnf
Added oe-repo repo from [...]-image-debug/1.0-r0/oe-sdk-repo
User-Agent: falling back to 'libdnf': could not detect OS or basearch
repo: using cache for: oe-repo
oe-repo: using metadata from Fri 01 Mar 2024 04:21:01 PM UTC.
Last metadata expiration check: 0:00:02 ago on Fri 01 Mar 2024 06:56:56 PM UTC.
No match for argument: capnproto
Error: Unable to find a match: capnproto

I'm not sure how to investigate this problem, since the capnproto recipe should be available. Can you help usfind what's missing?