toolchain-external: Fix external toolchains when BR2_ROOTFS_MERGED_USR
PATCH v2 1/1 toolchain-external: Fix external toolchains when BR2_ROOTFS_MERGED_USR
External toolchains like crosstool-ng place libraries at /lib. When BR2_ROOTFS_MERGED_USR is enabled, these libraries were not being copied into the target. This caused these toolchains to be unusable with this option.
WHen BR2_ROOTFS_MERGED_USR is selected, copy the /lib and /lib64 directories into /usr/lib and /usr/lib64 respectively.
---
I originally reported this issue here [1].
[1] https://lore.kernel.org/buildroot/Z86AGdrKHaUqgLVt@ghost/T/#t
---
Changes in v2:
- Reduce rsync to root cause. The previous solution was very
heavy-handed as pointed out by Arnout. This seems to be the proper way
of doing this.
- Link to v1: https://lore.kernel.org/r/[email protected]
--- toolchain/helpers.mk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
toolchain/helpers.mk +12 -3
@@ -55,6 +55,9 @@ copy_toolchain_lib_root = \ # corresponding architecture variants), and we don't want to import # them. # +# Furthermore, when BR2_ROOTFS_MERGED_USR is enabled, the 'lib*' directories +# need to be copied over to usr/'lib*'. +# # If ARCH_LIB_DIR is not a singular directory component, e.g. # 'lib32/octeon2', then symbolic links in ARCH_LIB_DIR and # usr/ARCH_LIB_DIR may be broken because Buildroot will flatten the
@@ -114,9 +117,15 @@ copy_toolchain_sysroot = \ continue ; \ fi ; \ if [ "$$i" = "usr" ]; then \ - rsync -au --chmod=u=rwX,go=rX --exclude 'locale/' \ - --include '/libexec*/' --exclude '/lib*/' \ - $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \ + if [ "$(BR2_ROOTFS_MERGED_USR)" == "y" ]; then \ + rsync -au --chmod=u=rwX,go=rX --exclude 'locale/' \ + --include '/libexec*/' \ + $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \ + else \ + rsync -au --chmod=u=rwX,go=rX --exclude 'locale/' \ + --include '/libexec*/' --exclude '/lib*/' \ + $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \ + fi ; \ else \ rsync -au --chmod=u=rwX,go=rX --exclude 'locale/' \ $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \
---
base-commit: 4809690d42f9b395ccb76ee7583c199fdd8d42c5
change-id: 20250310-fix_external_toolchains-d1b8c4da0be8
Signature · 6 lines
- Charlie _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot