Bug 14977 - qemu-usermode fails with musl systemd usrmerge
Summary: qemu-usermode fails with musl systemd usrmerge
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: 4.0
Hardware: x86 Multiple
: Medium normal
Target Milestone: 4.2
Assignee: Pavel Zhukov
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2022-11-30 15:01 UTC by Vivien Didelot
Modified: 2023-01-27 10:04 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vivien Didelot 2022-11-30 15:01:24 UTC
Building glib (pulled in by systemd) with a distro using TCLIBC="musl", INIT_MANAGER="systemd" and DISTRO_FEATURES+="usrmerge" fails with:

    qemu-arm: Could not open '/lib/ld-musl-armhf.so.1': No such file or directory

Skipping qemu with MACHINE_FEATURES_BACKFILL_CONSIDERED:append:libc-musl = " qemu-usermode" works around the issue.

For details about the issue caused by the /lib path used by musl, see the related fix merge in Buildroot: https://git.buildroot.net/buildroot/commit/?id=47e8cc8e8ef7c64799495888fb16e92578f7dbf6
Comment 1 Ross Burton 2022-11-30 16:04:39 UTC
Is this specific to usrmerge?
Comment 2 Vivien Didelot 2022-11-30 16:10:01 UTC
> Is this specific to usrmerge?

Kinda, because the following fix could work:

    do_install:append () {
        ln -rs ${D}${libdir}/libc.so ${D}/lib/ld-musl-${MUSL_LDSO_ARCH}.so.1
    }

but then qa will error out with musl not obeying the usrmerge feature.
Comment 3 Pavel Zhukov 2023-01-12 16:45:57 UTC
Hello Vivien,

Can you please specify exact version you're building for? Seems like this issue has been fixed in OE-core few years ago (cc32ccc2fb928b0afce7d4add1b61a3073f8988e). I cannot reproduce it with kirkstone.
Comment 4 Pavel Zhukov 2023-01-12 16:56:09 UTC
complete fix seems to be:
Author:     Khem Raj <raj.khem@gmail.com>
AuthorDate: Thu Apr 21 21:05:51 2022 -0700
Commit:     Richard Purdie <richard.purdie@linuxfoundation.org>
CommitDate: Wed May 4 13:07:33 2022 +0100

Parent:     6107518b42 arch-armv8-2a.inc: fix a typo in TUNEVALID variable
Contained:  kirkstone
Follows:    kirkstone-4.0 (74)
Precedes:   kirkstone-4.0.1 (85)

musl: Fix build when usrmerge distro feature is enabled

(From OE-Core rev: 8a9f1d5a11b01de3145b16c19d98c3f030473326)
Comment 5 Pavel Zhukov 2023-01-12 17:03:46 UTC
Build Configuration:
BB_VERSION           = "2.0.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "arm-poky-linux-musleabi"
MACHINE              = "qemuarm"
DISTRO               = "poky"
DISTRO_VERSION       = "4.0.6"
TUNE_FEATURES        = "arm vfp cortexa15 neon thumb callconvention-hard"
TARGET_FPU           = "hard"
meta                 
meta-poky            
meta-yocto-bsp       = "kirkstone:d3e378397395542179a8497fbff4b610f6f7e802"


| DEBUG: Executing shell function do_configure
| NOTE: Executing meson -Dnobody-user=nobody -Dnobody-group=nobody -Drootlibdir=/usr/lib -Drootprefix=/usr -Ddefault-locale=C -Dmode=release -Dsystem-alloc-uid-min=101 -Dsystem-uid-max=999 -Dsystem-alloc-gid-min=101 -Dsystem-gid-max=999 -Dkexec-path=/usr/sbin/kexec -Dkmod-path=/usr/bin/kmod -Dmount-path=/usr/bin/mount -Dquotacheck-path=/usr/sbin/quotacheck -Dquotaon-path=/usr/sbin/quotaon -Dsulogin-path=/usr/sbin/sulogin -Dnologin-path=/usr/sbin/nologin -Dumount-path=/usr/bin/umount -Dacl=false -Daudit=false -Dbacklight=true -Dbinfmt=true -Dbzip2=false -Ddefault-hierarchy=hybrid -Dcoredump=false -Dlibcryptsetup=false -Ddbus=false -Defi=false -Delfutils=false -Dfirstboot=false -Dgcrypt=false -Dgnu-efi=false -Dgnutls=false -Dgshadow=false -Dhibernate=true -Dhomed=false -Dhostnamed=true -Didn=false -Dima=true -Dimportd=false -Dlibiptc=false -Dlibcurl=false -Dkmod=true -Dldconfig=false -Dlibidn=false -Dlibidn2=false -Dlink-udev-shared=true -Dlocaled=false -Dlogind=true -Dlz4=false -Dmachined=true -Dman=false -Dmicrohttpd=false -Dnss-myhostname=false -Dnetworkd=true -Dnss-systemd=false -Dnss-mymachines=false -Dnss-resolve=false -Doomd=false -Dopenssl=false -Dpam=false -Dpcre2=false -Dpolkit=false -Dportabled=false -Dqrencode=false -Dquotacheck=true -Drandomseed=true -Drepart=false -Dresolve=true -Drfkill=false -Dsplit-bin=true -Dseccomp=false -Dselinux=false -Dtime-epoch=1651167745 -Dsmack=false -Dsysusers=false -Dsysvinit-path=/etc/init.d -Dsysvrcnd-path=/etc -Dtimedated=true -Dtimesyncd=true -Dtpm2=false -Duserdb=false -Dsplit-usr=false -Dutmp=false -Dvconsole=true -Dwheel-group=true -Dxdg-autostart=false -Dxkbcommon=false -Dxz=false -Dzlib=false -Dzstd=true...
| qemu-arm: Could not open '/lib/ld-musl-armhf.so.1': No such file or directory
| The Meson build system
| Version: 0.61.3
| Source dir: /home/pzhukov/repos/yocto/builds/build-14977/tmp/work/cortexa15t2hf-neon-poky-linux-musleabi/systemd/1_250.5-r0/git
| Build dir: /home/pzhukov/repos/yocto/builds/build-14977/tmp/work/cortexa15t2hf-neon-poky-linux-musleabi/systemd/1_250.5-r0/build
| Build type: cross build
| Project name: systemd
| Project version: 250
Comment 6 Pavel Zhukov 2023-01-13 10:25:17 UTC
The commit which fixed this in langdale is update gcc to 12.1 [1].

[1]
commit fa72b850b1b1cdb87b186dc5deee0ca1b266272c (HEAD)
Author: Khem Raj <raj.khem@gmail.com>
Date:   Thu Apr 21 19:08:30 2022 -0700

    gcc: upgrade 11.3 -> 12.1
    
    Major gcc release with lot of changes [2]
Comment 7 Khem Raj 2023-01-13 16:41:51 UTC
Does your poky checkout has this commit 

https://git.yoctoproject.org/poky/commit/?id=fba37dce43370ab0cea30f28267676932a957100

If not then perhaps try it out and it will fix this problem.
Comment 8 Pavel Zhukov 2023-01-13 17:08:51 UTC
(In reply to comment #7)
> Does your poky checkout has this commit 
> 
> https://git.yoctoproject.org/poky/commit/
> ?id=fba37dce43370ab0cea30f28267676932a957100
> 
> If not then perhaps try it out and it will fix this problem.

Yes, I've checked this commit even before bisecting langdale. 
fa72b850b1b1cdb87b186dc5deee0ca1b266272c is gcc update from 11.3 to 12.1 and it fixes the build. So it's something in the gcc itself which fixes this in langdale (and that's why it's broken in kirkstone).