Skip to contentSkip to conversation

package/libsoup3: fix reference to atomic

PATCH In review Thomas Devoogdt 3 participants 12 messages Apr 20, 2024 – May 2, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/8 package/libsoup3: fix reference to atomic

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

Fixes:
- http://autobuild.buildroot.net/results/4fb9f4c49777dde3abc30bb9f324816d3ed87567

---
 package/libsoup3/libsoup3.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/libsoup3/libsoup3.mk +5 -0
index 10caa5bea4..99eee466b3 100644
@@ -30,6 +30,11 @@ LIBSOUP3_CONF_OPTS = \
 	-Dtests=false \
 	-Dtls_check=false
 
+# Uses __atomic_compare_exchange_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+LIBSOUP3_LDFLAGS += -latomic
+endif
+
 ifeq ($(BR2_PACKAGE_BROTLI),y)
 LIBSOUP3_CONF_OPTS += -Dbrotli=enabled
 LIBSOUP3_DEPENDENCIES += brotli
Signature · 6 lines
2.34.1

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

PATCH 2/8 package/gssdp: fix reference to atomic

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

---
 package/gssdp/gssdp.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/gssdp/gssdp.mk +7 -0
index 3b446496ea..0ba8672ac7 100644
@@ -18,6 +18,13 @@ GSSDP_CONF_OPTS = \
 	-Dmanpages=false \
 	-Dsniffer=false
 
+GSSDP_LDFLAGS = $(TARGET_LDFLAGS)
+
+# Uses __atomic_compare_exchange_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GSSDP_LDFLAGS += -latomic
+endif
+
 ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
 GSSDP_CONF_OPTS += -Dintrospection=true -Dvapi=true
 GSSDP_DEPENDENCIES += host-vala gobject-introspection
Signature · 6 lines
2.34.1

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

PATCH 3/8 package/gupnp: fix reference to atomic

In reply to Thomas Devoogdt

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

---
 package/gupnp/gupnp.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/gupnp/gupnp.mk +7 -0
index cfcc114189..8f91439ff5 100644
@@ -15,6 +15,13 @@ GUPNP_INSTALL_STAGING = YES
 GUPNP_DEPENDENCIES = host-pkgconf libglib2 libxml2 gssdp util-linux
 GUPNP_CONF_OPTS = -Dexamples=false
 
+GUPNP_LDFLAGS = $(TARGET_LDFLAGS)
+
+# Uses __atomic_compare_exchange_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GUPNP_LDFLAGS += -latomic
+endif
+
 ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
 GUPNP_CONF_OPTS += -Dintrospection=true -Dvapi=true
 GUPNP_DEPENDENCIES += host-vala gobject-introspection
Signature · 6 lines
2.34.1

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

PATCH 4/8 package/gupnp-av: fix reference to atomic

In reply to Thomas Devoogdt

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

---
 package/gupnp-av/gupnp-av.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/gupnp-av/gupnp-av.mk +7 -0
index 3821c4e170..a27f451a64 100644
@@ -13,6 +13,13 @@ GUPNP_AV_LICENSE_FILES = COPYING
 GUPNP_AV_INSTALL_STAGING = YES
 GUPNP_AV_DEPENDENCIES = host-pkgconf libglib2 libxml2 gupnp
 
+GUPNP_AV_LDFLAGS = $(TARGET_LDFLAGS)
+
+# Uses __atomic_compare_exchange_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GUPNP_AV_LDFLAGS += -latomic
+endif
+
 ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
 GUPNP_AV_CONF_OPTS += -Dintrospection=true -Dvapi=true
 GUPNP_AV_DEPENDENCIES += host-vala gobject-introspection
Signature · 6 lines
2.34.1

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

PATCH 5/8 package/gupnp-dlna: fix reference to atomic

In reply to Thomas Devoogdt

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

---
 package/gupnp-dlna/gupnp-dlna.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/gupnp-dlna/gupnp-dlna.mk +7 -0
index 0064700fd2..8de25e6347 100644
@@ -15,6 +15,13 @@ GUPNP_DLNA_LICENSE_FILES = COPYING
 GUPNP_DLNA_INSTALL_STAGING = YES
 GUPNP_DLNA_DEPENDENCIES = host-pkgconf libglib2 libxml2
 
+GUPNP_DLNA_LDFLAGS = $(TARGET_LDFLAGS)
+
+# Uses __atomic_compare_exchange_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GUPNP_DLNA_LDFLAGS += -latomic
+endif
+
 ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
 GUPNP_DLNA_CONF_OPTS += -Dintrospection=true -Dvapi=true
 GUPNP_DLNA_DEPENDENCIES += host-vala gobject-introspection
Signature · 6 lines
2.34.1

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

PATCH 6/8 package/at-spi2-core: fix reference to atomic

In reply to Thomas Devoogdt

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

---
 package/at-spi2-core/at-spi2-core.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/at-spi2-core/at-spi2-core.mk +5 -0
index 828280de1a..43befa99f0 100644
@@ -38,4 +38,9 @@ endif
 
 AT_SPI2_CORE_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
 
+# Uses __atomic_compare_exchange_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+AT_SPI2_CORE_LDFLAGS += -latomic
+endif
+
 $(eval $(meson-package))
Signature · 6 lines
2.34.1

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

PATCH 7/8 package/gdk-pixbuf: fix reference to atomic

In reply to Thomas Devoogdt

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

---
 package/gdk-pixbuf/gdk-pixbuf.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/gdk-pixbuf/gdk-pixbuf.mk +7 -0
index e041d2cbde..9d272be382 100644
@@ -31,6 +31,13 @@ HOST_GDK_PIXBUF_CONF_OPTS = \
 	-Drelocatable=true \
 	-Dman=false
 
+GDK_PIXBUF_LDFLAGS = $(TARGET_LDFLAGS)
+
+# Uses __atomic_compare_exchange_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+GDK_PIXBUF_LDFLAGS += -latomic
+endif
+
 ifeq ($(BR2_STATIC_LIBS),y)
 GDK_PIXBUF_CONF_OPTS += -Dbuiltin_loaders=all
 endif
Signature · 6 lines
2.34.1

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

PATCH 8/8 package/libqmi: fix reference to atomic

In reply to Thomas Devoogdt

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

---
 package/libqmi/libqmi.mk | 7 +++++++
 1 file changed, 7 insertions(+)
package/libqmi/libqmi.mk +7 -0
index 524333feba..8aa2b4a5f2 100644
@@ -14,6 +14,13 @@ LIBQMI_INSTALL_STAGING = YES
 LIBQMI_DEPENDENCIES = libglib2
 LIBQMI_CONF_OPTS = -Dman=false -Dfuzzer=false
 
+LIBQMI_LDFLAGS = $(TARGET_LDFLAGS)
+
+# Uses __atomic_compare_exchange_4
+ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
+LIBQMI_LDFLAGS += -latomic
+endif
+
 ifeq ($(BR2_PACKAGE_GOBJECT_INTROSPECTION),y)
 LIBQMI_DEPENDENCIES += gobject-introspection
 LIBQMI_CONF_OPTS += -Dintrospection=true
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#8 lore raw
In reply to Thomas Devoogdt

Hello,

Quoted 7 lines · On Sat, 20 Apr 2024 20:58:46 +0200 Thomas Devoogdt <[email protected]> wrote:

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

Fixes:
- http://autobuild.buildroot.net/results/4fb9f4c49777dde3abc30bb9f324816d3ed87567

I think this whole patch series is not the right way to fix the problem. Indeed, what's using libatomic here is libglib2, and with your solution, you have to chase down *all* reverse dependencies of libglib2.

Instead, what I'd like to see is that the glib-2.0.pc (pkg-config) file gets updated to include -latomic in the Libs.private flags, so that it gets automatically picked up by all reverse dependencies of libglib2 when they are static linking.

This also brings the advantage that you're not linking say libsoup3 directly with libatomic, like you're doing with your patch. Instead, in a dynamic linking case, we keep on having libsoup3 linked just with libglib2, and libglib2 linked with libatomic. It's only in the static linking case that when we're building a final executable that uses libsoup3, we need to also bring libatomic.a into the mix.

Could you have a look at fixing glib-2.0.pc instead?

Thanks!

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
#9 lore raw

Hello Thomas,

Quoted 23 lines · Thomas Petazzoni

Hello,

Quoted 7 lines · On Sat, 20 Apr 2024 20:58:46 +0200 Thomas Devoogdt <[email protected]> wrote:

gthread-posix.c:(.text+0x137c): undefined reference to `__atomic_compare_exchange_4'
collect2: error: ld returned 1 exit status

Fixes:
- http://autobuild.buildroot.net/results/4fb9f4c49777dde3abc30bb9f324816d3ed87567

I think this whole patch series is not the right way to fix the problem. Indeed, what's using libatomic here is libglib2, and with your solution, you have to chase down *all* reverse dependencies of libglib2.

Instead, what I'd like to see is that the glib-2.0.pc (pkg-config) file gets updated to include -latomic in the Libs.private flags, so that it gets automatically picked up by all reverse dependencies of libglib2 when they are static linking.

Quoted 8 lines

This also brings the advantage that you're not linking say libsoup3 directly with libatomic, like you're doing with your patch. Instead, in a dynamic linking case, we keep on having libsoup3 linked just with libglib2, and libglib2 linked with libatomic. It's only in the static linking case that when we're building a final executable that uses libsoup3, we need to also bring libatomic.a into the mix.

Could you have a look at fixing glib-2.0.pc instead?

This patch is available since September 2023:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training
https://bootlin.com

Best Regards,

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

#10 lore raw
Quoted 4 lines · On Thu, 2 May 2024 10:15:53 +0200 Fabrice Fontaine…
Quoted 1 line

Could you have a look at fixing glib-2.0.pc instead?

This patch is available since September 2023:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Awesome, I went ahead and applied this patch!

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
#11 lore raw

Ah,

Thanks, Thomas for pointing that out, and Fabrice for the patch.

Kr,

Thomas

Op do 2 mei 2024 om 10:30 schreef Thomas Petazzoni <[email protected]>:

Quoted 9 lines
Quoted 4 lines · On Thu, 2 May 2024 10:15:53 +0200 Fabrice Fontaine…
Quoted 1 line

Could you have a look at fixing glib-2.0.pc instead?

This patch is available since September 2023:
https://patchwork.ozlabs.org/project/buildroot/patch/[email protected]/

Quoted 8 lines

Awesome, I went ahead and applied this patch!

Thomas
--
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