Skip to contentSkip to conversation

package/gcc: Fix gcc finale library installation

PATCH In review Damien Le Moal 3 participants 8 messages Oct 30, 2023 – Nov 12, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/gcc: Fix gcc finale library installation

When BR2_TOOLCHAIN_HAS_LIBATOMIC is "n", there is no gcc libatomic.so library to install. For configurations with such settings, compilation fails as gcc-final.mk unconditionally adds libatomic as an installation target. This error, for instance, shows for all Canaan K210 riscv configs, as they all use uclibc flat binary format which disabled libatomic:

Fix this by modifying package/gcc/gcc-final/gcc-final.mk to add libatomic to GCC_FINAL_LIBS only for configurations that have BR2_TOOLCHAIN_HAS_LIBATOMIC set to "y".

---
 package/gcc/gcc-final/gcc-final.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
package/gcc/gcc-final/gcc-final.mk +5 -1
index edb9b2f73a..99d7047b5f 100644
@@ -144,7 +144,11 @@ HOST_GCC_FINAL_POST_INSTALL_HOOKS += TOOLCHAIN_WRAPPER_INSTALL
 # -cc symlink to the wrapper is not created.
 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
 
-GCC_FINAL_LIBS = libatomic
+GCC_FINAL_LIBS =
+
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GCC_FINAL_LIBS += libatomic
+endif
 
 ifeq ($(BR2_STATIC_LIBS),)
 GCC_FINAL_LIBS += libgcc_s
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 7 lines · Damien Le Moal

When BR2_TOOLCHAIN_HAS_LIBATOMIC is "n", there is no gcc libatomic.so library to install. For configurations with such settings, compilation fails as gcc-final.mk unconditionally adds libatomic as an installation target. This error, for instance, shows for all Canaan K210 riscv configs, as they all use uclibc flat binary format which disabled libatomic:

Quoted 5 lines

Fix this by modifying package/gcc/gcc-final/gcc-final.mk to add libatomic to GCC_FINAL_LIBS only for configurations that have BR2_TOOLCHAIN_HAS_LIBATOMIC set to "y".

Ping ?

I received a build failure report (again) for the RISC-V Canaan & Sipeed boards configs. This patch fixes these build failures.

Quoted 21 lines
---
 package/gcc/gcc-final/gcc-final.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
package/gcc/gcc-final/gcc-final.mk +5 -1
index edb9b2f73a..99d7047b5f 100644
@@ -144,7 +144,11 @@ HOST_GCC_FINAL_POST_INSTALL_HOOKS += TOOLCHAIN_WRAPPER_INSTALL
 # -cc symlink to the wrapper is not created.
 HOST_GCC_FINAL_POST_INSTALL_HOOKS += HOST_GCC_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
 
-GCC_FINAL_LIBS = libatomic
+GCC_FINAL_LIBS =
+
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GCC_FINAL_LIBS += libatomic
+endif
 
 ifeq ($(BR2_STATIC_LIBS),)
 GCC_FINAL_LIBS += libgcc_s
Signature · 7 lines
Damien Le Moal
Western Digital Research

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
Quoted 2 lines · On Mon, 6 Nov 2023 11:17:41 +0900 Damien Le Moal <[email protected]> wrote:

I received a build failure report (again) for the RISC-V Canaan & Sipeed boards configs. This patch fixes these build failures.

I need to dig deeper into this. We looked into this issue with Romain, and I believe our conclusion is that it was unfortunately more complex than this, because in fact BR2_TOOLCHAIN_HAS_LIBATOMIC is not a fully accurate representation of whether gcc has libatomic or not.

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
#3 lore raw
Quoted 10 lines · Thomas Petazzoni
Quoted 2 lines · On Mon, 6 Nov 2023 11:17:41 +0900 Damien Le Moal <[email protected]> wrote:

I received a build failure report (again) for the RISC-V Canaan & Sipeed boards configs. This patch fixes these build failures.

I need to dig deeper into this. We looked into this issue with Romain, and I believe our conclusion is that it was unfortunately more complex than this, because in fact BR2_TOOLCHAIN_HAS_LIBATOMIC is not a fully accurate representation of whether gcc has libatomic or not.

Understood. Thanks.

Signature · 7 lines
Damien Le Moal
Western Digital Research

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw
In reply to Thomas Petazzoni via buildroot
Quoted 10 lines · Thomas Petazzoni via buildroot
Quoted 2 lines · On Mon, 6 Nov 2023 11:17:41 +0900 Damien Le Moal <[email protected]> wrote:

I received a build failure report (again) for the RISC-V Canaan & Sipeed boards configs. This patch fixes these build failures.

I need to dig deeper into this. We looked into this issue with Romain, and I believe our conclusion is that it was unfortunately more complex than this, because in fact BR2_TOOLCHAIN_HAS_LIBATOMIC is not a fully accurate representation of whether gcc has libatomic or not.

Even so, we could apply this already as a first step that fixes many
configurations, and improve the fix later? Currently there are quite a lot of configurations for which we simply can't build a toolchain...

BTW, Damien, you forgot the Fixes line:

(there are about 10 failures per day on various architectures, I don't think we need to enumerate them all.)

Regards,
Arnout

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

#5 lore raw
Quoted 3 lines · On Mon, 6 Nov 2023 21:18:04 +0100 Arnout Vandecappelle <[email protected]> wrote:

Even so, we could apply this already as a first step that fixes many
configurations, and improve the fix later? Currently there are quite a lot of configurations for which we simply can't build a toolchain...

Oh, yes, absolutely. This patch is better than doing nothing, that's for sure.

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
#6 lore raw
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni via buildroot <[email protected]> writes:

Quoted 3 lines · On Mon, 6 Nov 2023 21:18:04 +0100 Arnout Vandecappelle <[email protected]> wrote:

Even so, we could apply this already as a first step that fixes many configurations, and improve the fix later? Currently there are quite a lot of configurations for which we simply can't build a toolchain...

Oh, yes, absolutely. This patch is better than doing nothing, that's for sure.

Committed, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#7 lore raw
In reply to Arnout Vandecappelle via buildroot
Quoted 14 lines · Arnout Vandecappelle
Quoted 10 lines · Thomas Petazzoni via buildroot
Quoted 2 lines · On Mon, 6 Nov 2023 11:17:41 +0900 Damien Le Moal <[email protected]> wrote:

I received a build failure report (again) for the RISC-V Canaan & Sipeed boards configs. This patch fixes these build failures.

I need to dig deeper into this. We looked into this issue with Romain, and I believe our conclusion is that it was unfortunately more complex than this, because in fact BR2_TOOLCHAIN_HAS_LIBATOMIC is not a fully accurate representation of whether gcc has libatomic or not.

Quoted 8 lines

Even so, we could apply this already as a first step that fixes many
configurations, and improve the fix later? Currently there are quite a lot of configurations for which we simply can't build a toolchain...

BTW, Damien, you forgot the Fixes line:

Fixes:
http://autobuild.buildroot.net/results/98f/98fedf4969c260f73a01b937b9625e66dcd86b3c

Thomas, can you add this if you apply the patch ? I can send a v2 of the patch as well if you prefer that.

Quoted 7 lines

(there are about 10 failures per day on various architectures, I don't think we need to enumerate them all.)

Regards,
Arnout

Signature · 7 lines
Damien Le Moal
Western Digital Research

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