Skip to contentSkip to conversation

Failed to rebuild image after building it's SDK with MULTILIBS feature enabled #yocto

DISCUSSION [email protected] 1 participant 1 message Jul 14, 2020

lore
Share & tools
lore
#0 lore raw

Hello everyone, found you a tricky bug:)

I have a build with *MULTILIBS* enabled ( x86_64 + x86 , but aarch64 + armv7 have the save issue). When building an image everything is ok. Then I build SDK (with -c populate_sdk ) and after that build of the image itself breaks on do_rootfs task.

MULTILIBS is important, because without this feature everything is ok - same chain (build image, than SDK, than rebuild image) works.

The problem is in *lib32-glibc-locale-en-gb*. When building image, lib32-glibc-locale-en-gb doesn't appear as a dependency and is not built. But when building the SDK of this image, it also builds a lib32-glibc-locale-en-gb package and packs it into SDK. Than rebuilding the image issues an error:

Quoted 41 lines

WARNING : symway-image-docker-1.0-r0 do_rootfs: Unable to install packages.
Command '/build-yocto/build/tmp/work/x86_64_docker-poky-linux/symway-image-docker/1.0-r0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /build-yocto /build/tmp/work/x86_64_docker-poky-linux/symway-image-docker/1.0-r0/opkg.conf
-t
/build-yocto/build/tmp/work/x86_64_docker-poky-linux/symway-image-docker/1.0-r0/temp/ipktemp/
-o /build-yocto/build/tmp/work/x86_64_docker-poky-linux/
symway-image-docker/1.0-r0/rootfs  --force_postinstall
--prefer-arch-to-version  --add-exclude lib32-glibc-locale-en-gb
--force-maintainer --force-overwrite --add-exclude
lib32-glibc-locale-en-gb install avahi-locale-en-gb cups-loc
ale-en glibc-locale-en-gb lib32-glibc-locale-en-gb
lib32-libglib-2.0-locale-en-gb lib32-libpam-locale-en-gb
lib32-shared-mime-info-locale-en-gb libglib-2.0-locale-en-gb
libpam-locale-en-gb shared-mime-info-locale-en-gb wget-locale-
en-gb' returned 255:
Collected errors:
* opkg_prepare_url_for_install: Couldn't find anything to satisfy
'lib32-glibc-locale-en-gb'.
WARNING : symway-image-docker-1.0-r0 do_rootfs: [log_check]
symway-image-docker: found 1 warning message in the logfile:
[log_check] WARNING: Unable to install packages. Command '/build-yocto/build/tmp/work/x86_64_docker-poky-linux/symway-image-docker/1.0-r0/recipe-sysroot-native/usr/bin/opkg --volatile-cache -f /build-yocto/build/tmp/work/x86_64_doc ker-poky-linux/symway-image-docker/1.0-r0/opkg.conf -t /build-yocto/build/tmp/work/x86_64_docker-poky-linux/symway-image-docker/1.0-r0/temp/ipktemp/
-o
/build-yocto/build/tmp/work/x86_64_docker-poky-linux/symway-image-docker/1.0-r0

/rootfs  --force_postinstall --prefer-arch-to-version  --add-exclude lib32-glibc-locale-en-gb --force-maintainer --force-overwrite --add-exclude lib32-glibc-locale-en-gb install avahi-locale-en-gb cups-locale-en glibc-locale-en-gb
lib32-glibc-locale-en-gb lib32-libglib-2.0-locale-en-gb lib32-libpam-locale-en-gb lib32-shared-mime-info-locale-en-gb libglib-2.0-locale-en-gb libpam-locale-en-gb shared-mime-info-locale-en-gb wget-locale-en-gb' returned 255:

Quoted 5 lines

ERROR : symway-image-docker-1.0-r0 do_rootfs: [log_check]
symway-image-docker: found 1 error message in the logfile:
[log_check] Collected errors:

*Build configuration* (using *dunfell 3.1* ) *:*

Quoted 11 lines

BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "x86-64-docker"
DISTRO               = "symway"
DISTRO_VERSION       = "3.1"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta-oe

Quoted 9 lines

meta-initramfs
meta-multimedia
meta-networking
meta-filesystems
meta-python          = "HEAD:a62ad77973b16daac1cbaa03cbda3c6b9b91f2ff" meta
meta-poky
meta-yocto-bsp       = "HEAD:5d47cdf448b6cff5bb7cc5b0ba0426b8235ec478"

Looks like the problem is somewhere in *poky/meta/lib/oe/package_manager.py* and/or *poky/scripts/oe-pkgdata-util*.

After building image itself there is no anything about package lib32-glibc-locale-en-gb in build/tmp/pkgdata/<machine_name>. But after building SDK package lib32-glibc-locale-en-gb appears as:

* *build/tmp/pkgdata/<machine_name>/runtime-reverse/lib32-glibc-locale-en-gb*
* build/tmp/pkgdata/<machine_name>/runtime/lib32-glibc-locale-en-gb
* build/tmp/pkgdata/<machine_name>/runtime/lib32-glibc-locale-en-gb.packaged

Than during *re* building of the image *build/tmp/work/..../<image_name>/1.0-r0/oe-rootfs-repo* is generated correctly - there is no anything about lib32-glibc-locale-en-gb ( no lib32-glibc-locale-en-gb....ipk ). PackageManager:install_complementary method ( package_manager.py:554 ) generates packages list from this directory correctly. But than oe-pkgdata-util:glob function ( oe-pkgdata-util:37 ) uses another directory ( build/tmp/pkgdata/<machine_name> ) for generating globbed complementary packages list; there we have lib32-glibc-locale-en-gb. That's how lib32-glibc-locale-en-gb appears in complementary packages list and is tried to be installed... and fails as there is no lib32-glibc-locale-en-gb...ipk in build/tmp/work/..../<image_name>/1.0-r0/oe-rootfs-repo.

My first attempt to workaround was variable *PACKAGE_EXCLUDE_COMPLEMENTARY* , but it didn't work)) I tried to exclude directly package lib32-glibc-locale-en-gb from complementary packages list, but function oe-pkgdata-util:glob uses the same correct package list from build/tmp/work/..../<image_name>/1.0-r0/oe-rootfs-repo for excluding and only after that analyses build/tmp/pkgdata/<machine_name> directory. Finally lib32-glibc-locale-en-gb appeared in complementary packages list by hitting search through PN (see oe-pkgdata-util:glob ).

So finally my solution is to patch oe-pkgdata-util:glob so PACKAGE_EXCLUDE_COMPLEMENTARY works correctly:

Quoted 26 lines
scripts/oe-pkgdata-util +0 -0
index 93220e3617..de60f38e1b 100755
@@ -45,8 +45,10 @@ def glob(args):
 sys.exit(1)
 

skipval = "-locale-|^locale-base-|-dev$|-doc$|-dbg$|-staticdev$|^kernel-module-"
+    postskipregex = None
if args.exclude:
skipval += "|" + args.exclude
+        postskipregex = re.compile(args.exclude)
skipregex = re.compile(skipval)

skippedpkgs = set()

scripts/oe-pkgdata-util +0 -0
@@ -137,8 +139,12 @@ def glob(args):

break

if mappedpkg:
-                    logger.debug("%s (%s) -> %s" % (pkg, g, mappedpkg))
-                    mappedpkgs.add(mappedpkg)
+                    if postskipregex and postskipregex.search(mappedpkg):

Quoted 9 lines

+                        skippedpkgs.add(mappedpkg)
+                        logger.debug("%s -> !" % mappedpkg)
+                    else:
+                        logger.debug("%s (%s) -> %s" % (pkg, g, mappedpkg))
+                        mappedpkgs.add(mappedpkg) else:
logger.debug("%s (%s) -> ?" % (pkg, g))

And add package lib32-glibc-locale-en-gb to PACKAGE_EXCLUDE_COMPLEMENTARY:

Quoted 3 lines

PACKAGE_EXCLUDE_COMPLEMENTARY = "lib32-glibc-locale-.*" PACKAGE_EXCLUDE_COMPLEMENTARY_class-nativesdk = ""

The question is, how well this solution fits the Yocto concepts? Are there any more graceful options?