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.
dev/gentoo
Dustin 2024-12-30 13:15:00 -06:00
parent c30da6a5ff
commit 5bce7dfab3
1 changed files with 8 additions and 0 deletions

View File

@ -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/ mv /mnt/gentoo/etc/udev/hwdb.bin /mnt/gentoo/usr/lib/udev/
fi 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%%-*} \ qemu-${target%%-*} \
/mnt/gentoo/usr/sbin/ldconfig \ /mnt/gentoo/usr/sbin/ldconfig \
-r /mnt/gentoo \ -r /mnt/gentoo \