From 5bce7dfab30a142491330529a86f87091b0c1ec0 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Mon, 30 Dec 2024 13:15:00 -0600 Subject: [PATCH] build-rootfs: Copy GCC libs to target Software written in C++ typically depends on `libstdc++.so.6` and `libgcc_s.so.1`. These library dependencies are implicit, as Gentoo expects GCC to be installed as part of the _@system_ set. Since that set does not get installed in the target root, anything that depends on those libraries will not function. Rather than install _sys-devel/gcc_ in the target environment to get those libraries, we can copy ones built by `crossdev` manually. This way, we do not end up with a full C compiler and development toolchain in the target environment, while still making the libraries available for applications that need them. --- build-rootfs.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build-rootfs.sh b/build-rootfs.sh index 6a9d1f3..e377363 100755 --- a/build-rootfs.sh +++ b/build-rootfs.sh @@ -76,6 +76,14 @@ if [ -f /mnt/gentoo/etc/udev/hwdb.bin ]; then mv /mnt/gentoo/etc/udev/hwdb.bin /mnt/gentoo/usr/lib/udev/ fi +gccver=$(qlist -I -F '%{PV}' cross-${target}/gcc | sed 's/[^0-9].*//') +for lib in \ + libstdc++ \ + libgcc_s \ +; do + cp /usr/lib/gcc/${target}/${gccver}/${lib}.so.* /mnt/gentoo/usr/lib64/ +done + qemu-${target%%-*} \ /mnt/gentoo/usr/sbin/ldconfig \ -r /mnt/gentoo \