Yocto 2.4.2构建core-image-weston时do_rootfs依赖libgbm报错求助
Hey there, let's work through this dependency issue you're hitting. First, let's recap your setup to align on context:
- Yocto 2.4.2 (Rocko)
- Ubuntu 14.04 LTS
- Linux LTSI 4.4 kernel
- ARM Cortex-A15 target
You're able to build libgbm successfully via your custom recipe, but the do_rootfs step for core-image-weston fails because opkg can't resolve the libgbm >=1.0 dependency required by weston and weston-init.
The Exact Error Output
ERROR: core-image-weston-1.0-r0 do_rootfs: Unable to install packages. Command '/home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/opkg.conf -t /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/temp/ipktemp/ -o /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/rootfs --force_postinstall --prefer-arch-to-version install libkms1 run-postinsts gstreamer1.0-plugins-good-video4linux2 weston opkg psplash libclutter-1.0-examples alsa-tools gtk+3-demo gles-user-module packagegroup-core-boot libdrm-tests kernel-module-gles alsa-utils weston-init packagegroup-base-extended bash packagegroup-core-ssh-dropbear' returned 2: Collected errors: * Solver encountered 2 problem(s): * Problem 1/2: - nothing provides libgbm >= 1.0 needed by weston-2.0.0-r0.cortexa15hf-neon * Solution 1: - do not ask to install a package providing weston * Problem 2/2: - nothing provides libgbm >= 1.0 needed by weston-2.0.0-r0.cortexa15hf-neon * Solution 1: - do not ask to install a package providing weston-init ERROR: core-image-weston-1.0-r0 do_rootfs: Function failed: do_rootfs ERROR: Logfile of failure stored in: /home/server-build/RZG_YoctoProject/build/tmp/work/iwg20m-poky-linux-gnueabi/core-image-weston/1.0-r0/temp/log.do_rootfs.20697 ERROR: Task (/home/server-build/RZG_YoctoProject/build/../poky/meta/recipes-graphics/images/core-image-weston.bb:do_rootfs) failed with exit code '1' NOTE: Tasks Summary: Attempted 3411 tasks of which 3410 didn't need to be rerun and 1 failed. Summary: 1 task failed: /home/server-build/RZG_YoctoProject/build/../poky/meta/recipes-graphics/images/core-image-weston.bb:do_rootfs
Your libgbm.bb Configuration
SUMMARY = "gbm library" LICENSE = "MIT" SECTION = "libs" LIC_FILES_CHKSUM = "file://gbm.c;beginline=4;endline=22;md5=5cdaac262c876e98e47771f11c7036b5" SRCREV = "84984e873a134ee67b4c99859f052bb42834245c" SRC_URI = "git://github.com/thayama/libgbm;protocol=git;branch=master" PV = "1.0" S = "${WORKDIR}/git" DEPENDS = "wayland-kms udev" inherit autotools pkgconfig PACKAGES = " \ ${PN} \ ${PN}-dev \ ${PN}-dbg \ ${PN}-staticdev \ " FILES_${PN} = " \ ${libdir}/libgbm.so.* \ ${libdir}/gbm/libgbm_kms.so.* \ ${libdir}/gbm/*.so \ ${libdir}/*.so \ " PROVIDES += "gbm" FILES_${PN}-dev += "${libdir}/gbm/*.la" FILES_${PN}-dbg += "${libdir}/gbm/.debug/*" FILES_${PN}-staticdev += "${libdir}/gbm/*.a" INSANE_SKIP_${PN} += "dev-so"
What's Causing the Issue?
The core problem is that opkg doesn't recognize your libgbm package as satisfying the libgbm >=1.0 dependency. Even though the library builds correctly, your recipe isn't telling the package manager that it provides the exact versioned capability weston is looking for.
Specifically:
- Your
PROVIDESline only declaresgbm, notlibgbm(the exact name weston's dependency checks for). - You haven't explicitly mapped your package to the versioned
libgbmrequirement usingRPROVIDES.
Step-by-Step Fixes
1. Update libgbm.bb to Declare Correct Metadata
Replace your existing PROVIDES line with these entries in libgbm.bb:
PROVIDES += "gbm libgbm" RPROVIDES_libgbm = "libgbm = ${PV}" RCONFLICTS_libgbm = "gbm"
PROVIDES += "libgbm"tells BitBake this package offers thelibgbmcapability.RPROVIDES_libgbmexplicitly states that this package provideslibgbmat version${PV}(1.0 in your case), which matches weston's versioned requirement.RCONFLICTS_libgbmprevents conflicts if anothergbmpackage exists in your layer stack.
2. Ensure pkg-config Files Are Properly Packaged
Weston uses pkg-config to detect libgbm. Make sure the gbm.pc file is generated and included in the -dev package by adding this line to libgbm.bb:
FILES_${PN}-dev += "${libdir}/pkgconfig/gbm.pc"
If your source code doesn't generate gbm.pc by default, you may need to add a custom .pc.in file to the repo or pass extra flags to autotools with EXTRA_OECONF.
3. Verify Package Metadata (Optional but Recommended)
After rebuilding libgbm, confirm the package advertises the correct dependency. For RPM packages:
rpm -qp --provides tmp/deploy/rpm/cortexa15hf-neon/libgbm-1.0-r0.cortexa15hf-neon.rpm
For IPK packages:
opkg info -f tmp/deploy/ipk/cortexa15hf-neon/libgbm_1.0-r0_cortexa15hf-neon.ipk
You should see a line like libgbm = 1.0 in the output. If not, double-check your RPROVIDES configuration.
4. Fallback: Force libgbm Installation
If the above steps don't resolve the issue, you can directly add libgbm to the image's install list. Add this to your local.conf or core-image-weston.bb:
IMAGE_INSTALL_append = " libgbm"
This ensures libgbm is installed before weston, bypassing the dependency solver's confusion.
Final Steps
After updating your libgbm.bb, clean the libgbm build directory and rebuild the image:
bitbake -c clean libgbm bitbake core-image-weston
内容的提问来源于stack exchange,提问作者Thảo M. Hoàng

