Skip to contentSkip to conversation

toolchain: follow symlinks in ld.*so.* install helper

PATCH In review Sergey Matyukevich 2 participants 4 messages Dec 7, 2024 – Jan 21, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toolchain: follow symlinks in ld.*so.* install helper

Current toolchain install helper fails to setup external toolchains with merged-usr sysroot. It does not follow lib symlinks when looking for ld.*.so.* files. As a result builds fail with various linker errors. Follow symlinks in find tool when installing ld*.so.* linker scripts from external toolchain directory to staging and target directories.

---
 toolchain/helpers.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
toolchain/helpers.mk +2 -2
index f3fdaaec07..92ad53d064 100644
@@ -140,8 +140,8 @@ copy_toolchain_sysroot = \
 			$(call simplify_symlink,$$i,$(STAGING_DIR)) ; \
 		done ; \
 	fi ; \
-	if [[ ! $$(find $(STAGING_DIR)/lib -name 'ld*.so.*' -print -quit) ]]; then \
-		find $${ARCH_SYSROOT_DIR}/lib -name 'ld*.so.*' -print0 | xargs -0 -I % cp % $(STAGING_DIR)/lib/; \
+	if [[ ! $$(find -L $(STAGING_DIR)/lib -name 'ld*.so.*' -print -quit) ]]; then \
+		find -L $${ARCH_SYSROOT_DIR}/lib -name 'ld*.so.*' -print0 | xargs -0 -I % cp % $(STAGING_DIR)/lib/; \
 	fi ; \
 	if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \
 		if [ ! -d $${ARCH_SYSROOT_DIR}/usr/include ] ; then \
Signature · 6 lines
2.47.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Sergey,

Quoted 7 lines · On Sat, 7 Dec 2024 23:36:26 +0300 Sergey Matyukevich <[email protected]>…

Current toolchain install helper fails to setup external toolchains with merged-usr sysroot. It does not follow lib symlinks when looking for ld.*.so.* files. As a result builds fail with various linker errors. Follow symlinks in find tool when installing ld*.so.* linker scripts from external toolchain directory to staging and target directories.

Thanks for the patch!

I need to get back to my backlog, but I believe I had investigated some toolchain issue, and came back to the same patch/change as you.

This regression was introduced by commit 92207bc03f2358b28e0fd2cc3a41e40504b5d3d4 ("toolchain: handle toolchains with multiple ld*.so.* files").

I am wondering how I got to debug this? Are there some autobuilder issues?

Thomas

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hi Thomas,

Quoted 18 lines · Thomas Petazzoni

Hello Sergey,

Quoted 7 lines · On Sat, 7 Dec 2024 23:36:26 +0300 Sergey Matyukevich <[email protected]>…

Current toolchain install helper fails to setup external toolchains with merged-usr sysroot. It does not follow lib symlinks when looking for ld.*.so.* files. As a result builds fail with various linker errors. Follow symlinks in find tool when installing ld*.so.* linker scripts from external toolchain directory to staging and target directories.

Thanks for the patch!

I need to get back to my backlog, but I believe I had investigated some toolchain issue, and came back to the same patch/change as you.

Quoted 6 lines

This regression was introduced by commit 92207bc03f2358b28e0fd2cc3a41e40504b5d3d4 ("toolchain: handle toolchains with multiple ld*.so.* files").

I am wondering how I got to debug this? Are there some autobuilder issues?

I didn't see any autobuilder issues. Actually I was working with a 3rd party vendor toolchain. Thanks for finding the commit that introduced the regression. That commit enabled the use of multilib toolchains with multiple ld*.so.* files. It turned out that my toolchain had both properties:
- multilib with multiple ld*.so.* files
- merged-usr property

BTW, I did the following quick test. I baked a Buildroot merged-usr SDK for aarch64 starting from qemu_aarch64_virt_defconfig. That SDK had a single ld*.so.* file. Then I rebuilt qemu_aarch64_virt_defconfig image using that SDK w/o my patch and w/o any issues. So indeed, we have to use multilib _and_ merged-usr toolchain to trigger this symlink issue.

Should I resend v2 with 'Fixes' tag ?

Regards,
Sergey
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
Quoted 36 lines · Sergey Matyukevich

Hi Thomas,

Quoted 18 lines · Thomas Petazzoni

Hello Sergey,

Quoted 7 lines · On Sat, 7 Dec 2024 23:36:26 +0300 Sergey Matyukevich <[email protected]>…

Current toolchain install helper fails to setup external toolchains with merged-usr sysroot. It does not follow lib symlinks when looking for ld.*.so.* files. As a result builds fail with various linker errors. Follow symlinks in find tool when installing ld*.so.* linker scripts from external toolchain directory to staging and target directories.

Thanks for the patch!

I need to get back to my backlog, but I believe I had investigated some toolchain issue, and came back to the same patch/change as you.

Quoted 6 lines

This regression was introduced by commit 92207bc03f2358b28e0fd2cc3a41e40504b5d3d4 ("toolchain: handle toolchains with multiple ld*.so.* files").

I am wondering how I got to debug this? Are there some autobuilder issues?

I didn't see any autobuilder issues. Actually I was working with a 3rd party vendor toolchain. Thanks for finding the commit that introduced the regression. That commit enabled the use of multilib toolchains with multiple ld*.so.* files. It turned out that my toolchain had both properties:
- multilib with multiple ld*.so.* files
- merged-usr property

Quoted 7 lines

BTW, I did the following quick test. I baked a Buildroot merged-usr SDK for aarch64 starting from qemu_aarch64_virt_defconfig. That SDK had a single ld*.so.* file. Then I rebuilt qemu_aarch64_virt_defconfig image using that SDK w/o my patch and w/o any issues. So indeed, we have to use multilib _and_ merged-usr toolchain to trigger this symlink issue.

Should I resend v2 with 'Fixes' tag ?

Friendly ping. Any thoughts or comments concerning this fix ?

Regards,
Sergey
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot