Help and ideas wanted - error during do_package

Peter Bergin


I'm working on a recipe for libtraceevent ( that is needed for newer trace-cmd. I'm confused about an error I get during do_package that I want some help with.

File: '<snip>/sources/poky/meta/lib/oe/', lineno: 587, function: process
     0583:                    else:
     0584:                        add_perm(stat.S_IXOTH, 'x')
     0586:                    try:
 *** 0587:                        update_hash(" %10s" % pwd.getpwuid(s.st_uid).pw_name)
     0588:                        update_hash(" %10s" % grp.getgrgid(s.st_gid).gr_name)
     0589:                    except KeyError as e:
     0590:                        bb.warn("KeyError in %s" % path)
     0591:                        msg = ("KeyError: %s\nPath %s is owned by uid %d, gid %d, which doesn't match "
Exception: Exception: KeyError: 'getpwuid(): uid not found: 1000'
Path ./package/usr/lib/libtraceevent.a is owned by uid 1000, gid 1004, which doesn't match any user/group on target. This may be due to host contamination.

ERROR: Logfile of failure stored in: <snip>/build/<machine>/tmp/work/cortexa53-crypto-poky-linux/libtraceevent/1.6.2-r0/temp/log.do_package.3574262
ERROR: Task (<snip>/sources/meta-openembedded/meta-oe/recipes-kernel/trace-cmd/ failed with exit code '1'

What happens is that during do_package the directory ${WORKDIR}/package is moved to ${WORKDIR}/sstate-build-package and the sstate is calculated. In that sequence in the owner of the files are checked and used in the hash calculations. By adding debug prints I have seen that in normal case the s.st_uid in the code above evaluates to 0 for the files and directories. When looking in the file system my user (1000/1004) owns them but I guess PSEUDO is involved here to fake root? For some reason when checking the libraries build by libtraceevent in ./usr/lib/ the files reports to be owned by uid 1000 and the exection above is raised. It is valid for ./usr/lib/libtraceevent.a and also other files in the ./usr/lib directory. Before the files in ./usr/lib is checked files from /usr/include has been checked for libtraceevent and they have s.st_uid=0.

I've spent some time trying to understand this. Give up now and try this forum if I can get some ideas. I share the recipe below.


$ cat ../../sources/meta-openembedded/meta-oe/recipes-kernel/trace-cmd/

SUMMARY = "Library that provides APIs to access kernel tracepoint events"

LICENSE = "GPL-2.0-only & LGPL-2.1-only"
    file://LICENSES/GPL-2.0;md5=e6a75371ba4d16749254a51215d13f97 \
    file://LICENSES/LGPL-2.1;md5=b370887980db5dd40659b50909238dbd \

SRC_URI = " \
git://;branch=libtraceevent;protocol=https \
file://0001-libtraceevent-make-it-possible-to-set-libdir-and-man.patch \

SRCREV = "424b11f6c3ab2e3bb199180e142fbcf9eebf2ac3"

S = "${WORKDIR}/git"

do_install () {
    oe_runmake 'DESTDIR=${D}' install

FILES:${PN} += "${libdir}/traceevent/plugins"

$ cat ../../sources/meta-openembedded/meta-oe/recipes-kernel/trace-cmd/files/0001-libtraceevent-make-it-possible-to-set-libdir-and-man.patch

From 2014d037d3488f1a53e1c0c83263e77322ac14ef Mon Sep 17 00:00:00 2001
From: Peter Bergin <peter@...>
Date: Mon, 19 Sep 2022 17:21:28 +0200
Subject: [PATCH] libtraceevent: make it possible to set libdir and mandir from

When building in build frameworks such as openembedded it is desired
to use the defintion of libdir and mandir from the build framework.

Signed-off-by: Peter Bergin <peter@...>
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 194bbdd..aa1984d 100644
--- a/Makefile
+++ b/Makefile
@@ -45,8 +45,8 @@ endif

 libdir_relative ?= $(libdir_relative_temp)
 prefix ?= /usr/local
-libdir = $(prefix)/$(libdir_relative)
-man_dir = $(prefix)/share/man
+libdir ?= $(prefix)/$(libdir_relative)
+man_dir ?= $(prefix)/share/man
 man_dir_SQ = '$(subst ','\'',$(man_dir))'
 pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG)                \
                        --variable pc_path pkg-config | tr ":" " "))

Join to automatically receive all group messages.