* [Buildroot] [PATCH 1/1] package/libglib2: fix atomic handling
@ 2023-09-17 18:51 Fabrice Fontaine
2024-05-02 8:31 ` Thomas Petazzoni via buildroot
2024-05-21 20:12 ` Peter Korsgaard
0 siblings, 2 replies; 3+ messages in thread
From: Fabrice Fontaine @ 2023-09-17 18:51 UTC (permalink / raw)
To: buildroot; +Cc: Fabrice Fontaine
Correctly fix atomic handling to avoid the following build failure with
all users of libglib2 (e.g. gdk-pixbuf) raised since bump to version
2.76.1 in commit 3f9622fe3d85b4d9f734b879abc1d485afea19b2:
/usr/lib/libglib-2.0.a(gthread-posix.c.o): in function `g_mutex_trylock':
gthread-posix.c:(.text+0xda8): undefined reference to `__atomic_compare_exchange_4'
Fixes:
- http://autobuild.buildroot.org/results/24a358869b98d83ab374c7c3a185ced450064d35
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
.../0004-link-with-latomic-when-needed.patch | 45 +++++++++++++++++++
package/libglib2/libglib2.mk | 5 ---
2 files changed, 45 insertions(+), 5 deletions(-)
create mode 100644 package/libglib2/0004-link-with-latomic-when-needed.patch
diff --git a/package/libglib2/0004-link-with-latomic-when-needed.patch b/package/libglib2/0004-link-with-latomic-when-needed.patch
new file mode 100644
index 0000000000..275d86032b
--- /dev/null
+++ b/package/libglib2/0004-link-with-latomic-when-needed.patch
@@ -0,0 +1,45 @@
+From d1814dbd3a88c95a43d4c9805bb4a523cf62d97b Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Date: Sun, 17 Sep 2023 20:42:00 +0200
+Subject: [PATCH] link with -latomic when needed
+
+Some architecture such as sparc and some flavors of arm needs -latomic
+to avoid the following build failure:
+
+gthread-posix.c:(.text+0xda8): undefined reference to `__atomic_compare_exchange_4'
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
+Upstream: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3586
+---
+ glib/meson.build | 1 +
+ meson.build | 2 ++
+ 2 files changed, 3 insertions(+)
+
+diff --git a/glib/meson.build b/glib/meson.build
+index c26a35e42..7a761306b 100644
+--- a/glib/meson.build
++++ b/glib/meson.build
+@@ -426,6 +426,7 @@ libglib = library('glib-2.0',
+ pcre2,
+ platform_deps,
+ thread_dep,
++ atomic_dep
+ ],
+ c_args : glib_c_args,
+ objc_args : glib_c_args,
+diff --git a/meson.build b/meson.build
+index 25ae10fc2..5ae84b3b3 100644
+--- a/meson.build
++++ b/meson.build
+@@ -2130,6 +2130,8 @@ libffi_dep = dependency('libffi', version : '>= 3.0.0')
+
+ libz_dep = dependency('zlib')
+
++atomic_dep = cc.find_library('atomic', required: false)
++
+ # First check in libc, fallback to libintl, and as last chance build
+ # proxy-libintl subproject.
+ # FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
+--
+2.40.1
+
diff --git a/package/libglib2/libglib2.mk b/package/libglib2/libglib2.mk
index c06ded2a5b..bffc565f11 100644
--- a/package/libglib2/libglib2.mk
+++ b/package/libglib2/libglib2.mk
@@ -64,11 +64,6 @@ ifeq ($(BR2_PACKAGE_ELFUTILS),y)
LIBGLIB2_DEPENDENCIES += elfutils
endif
-# Uses __atomic_compare_exchange_4
-ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
-LIBGLIB2_LDFLAGS += -latomic
-endif
-
ifeq ($(BR2_PACKAGE_LIBICONV),y)
LIBGLIB2_DEPENDENCIES += libiconv
endif
--
2.40.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/libglib2: fix atomic handling
2023-09-17 18:51 [Buildroot] [PATCH 1/1] package/libglib2: fix atomic handling Fabrice Fontaine
@ 2024-05-02 8:31 ` Thomas Petazzoni via buildroot
2024-05-21 20:12 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-05-02 8:31 UTC (permalink / raw)
To: Fabrice Fontaine; +Cc: buildroot
Hello Fabrice,
On Sun, 17 Sep 2023 20:51:16 +0200
Fabrice Fontaine <fontaine.fabrice@gmail.com> wrote:
> Correctly fix atomic handling to avoid the following build failure with
> all users of libglib2 (e.g. gdk-pixbuf) raised since bump to version
> 2.76.1 in commit 3f9622fe3d85b4d9f734b879abc1d485afea19b2:
>
> /usr/lib/libglib-2.0.a(gthread-posix.c.o): in function `g_mutex_trylock':
> gthread-posix.c:(.text+0xda8): undefined reference to `__atomic_compare_exchange_4'
>
> Fixes:
> - http://autobuild.buildroot.org/results/24a358869b98d83ab374c7c3a185ced450064d35
>
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
> ---
> .../0004-link-with-latomic-when-needed.patch | 45 +++++++++++++++++++
> package/libglib2/libglib2.mk | 5 ---
> 2 files changed, 45 insertions(+), 5 deletions(-)
> create mode 100644 package/libglib2/0004-link-with-latomic-when-needed.patch
Applied to master, thanks. However, could you follow-up with upstream?
They re-opened a MR at
https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3606 but then had
to close it because it broke the build in some situations. If you could
have a look and submit a new iteration of the patch upstream, it'd be
nice.
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/libglib2: fix atomic handling
2023-09-17 18:51 [Buildroot] [PATCH 1/1] package/libglib2: fix atomic handling Fabrice Fontaine
2024-05-02 8:31 ` Thomas Petazzoni via buildroot
@ 2024-05-21 20:12 ` Peter Korsgaard
1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2024-05-21 20:12 UTC (permalink / raw)
To: Fabrice Fontaine; +Cc: buildroot
>>>>> "Fabrice" == Fabrice Fontaine <fontaine.fabrice@gmail.com> writes:
> Correctly fix atomic handling to avoid the following build failure with
> all users of libglib2 (e.g. gdk-pixbuf) raised since bump to version
> 2.76.1 in commit 3f9622fe3d85b4d9f734b879abc1d485afea19b2:
> /usr/lib/libglib-2.0.a(gthread-posix.c.o): in function `g_mutex_trylock':
> gthread-posix.c:(.text+0xda8): undefined reference to `__atomic_compare_exchange_4'
> Fixes:
> - http://autobuild.buildroot.org/results/24a358869b98d83ab374c7c3a185ced450064d35
> Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Committed to 2024.02.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-21 20:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-17 18:51 [Buildroot] [PATCH 1/1] package/libglib2: fix atomic handling Fabrice Fontaine
2024-05-02 8:31 ` Thomas Petazzoni via buildroot
2024-05-21 20:12 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox