host rpath fixups misses needed directory (was: `libsystemd-shared-256.so` not found)

Check-list

  • I did not find the issue in the existing issues
  • I can reproduce the issue with unmodified Buildroot from this repository, not from a fork somewhere else
  • I can reproduce the issue on the latest commit of the branch I'm using:
    • master
    • stable (i.e. 20NN.MM.x - please specify)
    • LTS (i.e. 20NN.02.x - please specify)
  • I can reproduce the issue after running make clean; make
  • I attached the full build log file (e.g. make 2>&1 |tee build.log)
  • I attached a minimal defconfig file that can reproduce the issue (make BR2_DEFCONFIG=$(pwd)/issue_defconfig savedefconfig)
  • I also attached the configuration for kconfig-based packages that are enabled (and necessary to reproduce the issue), most notably:
    • busybox
    • linux
    • uclibc
    • uboot

What I did

Buildroot commit sha1: 2024.08-288-g89370de5e0 Distribution of the build machine: Arch Linux

Here, describe what you did:

  • any special environment variables: none

  • the commands you ran:

    $ ./support/testing/run-tests -d $(pwd)/dl -o $(mktemp -d) -s tests.init.test_systemd.TestInitSystemSystemdRoFull.test_run
    
    [...]
    mkdir -p /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target/etc
    echo "buildroot" > /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target/etc/hostname
    /usr/bin/sed -i -e '$a \127.0.1.1\tbuildroot' -e '/^127.0.1.1/d' /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target/etc/hosts
    mkdir -p /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target/etc
    echo "Welcome to Buildroot" > /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target/etc/issue
    /usr/bin/sed -i -e s,^root:[^:]*:,root::, /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target/etc/shadow
    grep -qsE '^/bin/sh$' /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target/etc/shells || echo "/bin/sh" >> /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target/etc/shells
    /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/host/bin/systemd-hwdb update --root /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target --strict --usr
    /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/host/bin/systemd-hwdb: error while loading shared libraries: libsystemd-shared-256.so: cannot open shared object file: No such file or directory
    make[1]: *** [Makefile:733: target-finalize] Error 127
    make: *** [Makefile:23: _all] Error 2
    E17:25:19 TestInitSystemSystemdRoFull              Building
    
    ======================================================================
    ERROR: test_run (tests.init.test_systemd.TestInitSystemSystemdRoFull.test_run)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/jlsalvador/src/simplek8s-buildroot/buildroot/support/testing/infra/basetest.py", line 73, in setUp
        self.b.build()
      File "/home/jlsalvador/src/simplek8s-buildroot/buildroot/support/testing/infra/builder.py", line 105, in build
        raise SystemError("Build failed")
    SystemError: Build failed
    
    ----------------------------------------------------------------------
    Ran 1 test in 445.772s
    
    FAILED (errors=1)
  • anything else that you might think is important…

    build.log

    [...]
    Installing libsystemd.so.0.39.0 to /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/systemd/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib
    [...]
    Installing src/core/libsystemd-core-256.so to /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/systemd/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/systemd
    [...]
    Installing src/shared/libsystemd-shared-256.so to /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/systemd/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/systemd
    [...]

    https://gitlab.com/buildroot.org/buildroot/-/blob/master/package/systemd/systemd.mk?ref_type=heads#L1038

    $ ldd host/x86_64-buildroot-linux-gnu/sysroot/usr/bin/systemctl
            linux-vdso.so.1 (0x00007418e52ea000)
            libsystemd-shared-256.so => not found
            libc.so.6 => /usr/lib/libc.so.6 (0x00007418e506c000)
            /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007418e52ec000)
    
    $ find /tmp/tmp.P5lYbnGZor -name libsystemd-shared-256.so 2>/dev/null
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/build/systemd-256.4/build/src/shared/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/build/host-systemd-256.4/build/src/shared/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/systemd/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/systemd/target/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/udev/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/udev/target/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/util-linux/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/util-linux/target/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/busybox/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/busybox/target/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/dbus/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/dbus/target/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/per-package/host-systemd/host/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/target/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/host/arm-buildroot-linux-gnueabihf/sysroot/usr/lib/systemd/libsystemd-shared-256.so
        /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/host/lib/systemd/libsystemd-shared-256.so
    
    $ ldd host/bin/systemd-hwdb
        linux-vdso.so.1 (0x00007f13f5170000)
        libsystemd-shared-256.so => not found
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f13f4f35000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f13f5172000)
    
    $ cp host/lib/systemd/libsystemd-* host/lib/
    
    $ ldd host/bin/systemd-hwdb
        linux-vdso.so.1 (0x000072e2c3013000)
        libsystemd-shared-256.so => /tmp/tmp.P5lYbnGZor/TestInitSystemSystemdRoFull/host/bin/../lib/libsystemd-shared-256.so (0x000072e2c2ca2000)
        libc.so.6 => /usr/lib/libc.so.6 (0x000072e2c2a73000)
        libcap.so.2 => /usr/lib/libcap.so.2 (0x000072e2c2a67000)
        libcrypt.so.2 => /usr/lib/libcrypt.so.2 (0x000072e2c2a37000)
        libmount.so.1 => /usr/lib/libmount.so.1 (0x000072e2c29e8000)
        libm.so.6 => /usr/lib/libm.so.6 (0x000072e2c28f7000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x000072e2c3015000)
        libblkid.so.1 => /usr/lib/libblkid.so.1 (0x000072e2c28be000)
    
    $ ls host/lib/systemd/*.so
        host/lib/systemd/libsystemd-core-256.so  host/lib/systemd/libsystemd-shared-256.so

What happens

The host systemd binaries is patched to find libraries in /lib, but libsystemd-shared-256.so is in host/lib/systemd.


What was expected

success systemd test.


Extra information

Another output from my pipeline:

$ make

[...]
PATH="/usr/src/simplek8s/host/bin:/usr/src/simplek8s/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" FAKEROOTDONTTRYCHOWN=1 /usr/src/simplek8s/host/bin/fakeroot -- /usr/src/simplek8s/build/buildroot-fs/cpio/fakeroot
rootdir=/usr/src/simplek8s/build/buildroot-fs/cpio/target
table='/usr/src/simplek8s/build/buildroot-fs/full_devices_table.txt'
/usr/src/simplek8s/host/bin/systemctl: error while loading shared libraries: libsystemd-shared-256.so: cannot open shared object file: No such file or directory
[...]

build.log

Edited by José Luis Salvador Rufo