#64377 closed defect (fixed)
GLib2 not working on Apple Silicon
Reported by: | lb90 | Owned by: | ryandesign (Ryan Carsten Schmidt) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | arm64 | Cc: | oleaamot (Ole Aamot), mituharu (YAMAMOTO Mitsuharu), dqh-au, kencu (Ken), snarkhunter (Steve Langer), evanmiller (Evan Miller), mascguy (Christopher Nielsen), tcwan (TC Wan), Akkiesoft (Akira Ouchi), jianli-github (Jian Li) |
Port: | glib2, glib2-devel |
Description
Hi! It was reported that GLib2 is not working correctly on Mac M1 systems, see https://discourse.gnome.org/t/gtk3-on-m1-mac-with-monterey/8348/14
During the configure stage Meson checks for the availability of either va_copy() or _va_copy() but the check fails.
Change History (30)
comment:1 Changed 3 years ago by jmroot (Joshua Root)
Keywords: | arm64 added |
---|---|
Owner: | set to ryandesign |
Port: | glib2 added |
Status: | new → assigned |
comment:2 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Port: | glib2-devel added |
---|
comment:4 follow-up: 10 Changed 3 years ago by mituharu (YAMAMOTO Mitsuharu)
The following hunk in universal.patch looks suspicious:
@@ -114,7 +157,10 @@ @glib_os@ -@glib_vacopy@ +#ifdef __LP64__ +#define G_VA_COPY_AS_ARRAY 1 +#endif + @g_have_iso_c_varargs@ @g_have_iso_cxx_varargs@
comment:5 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | oleaamot mituharu added |
---|
Has duplicate #63881.
mituharu, thanks for pointing out the possible cause of the problem. (I haven't had time to investigate.) The patch was written before Apple Silicon systems existed and we believed the patch was correct for Intel and PowerPC systems. The patch was necessary to support universal builds, which the developers of glib2 refused to support on their own.
comment:6 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | dqh-au added |
---|
Has duplicate #64484.
comment:7 Changed 3 years ago by dqh-au
Apologies if it's not worth pointing out, but Homebrew GTK3 is working on Apple silicon with seemingly unpatched glib 2.70.2, so I wonder if moving to the same version of glib is worth considering given that it's probably widely tested as not causing problems for homebrew users.
comment:8 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
We have patches to support building universal. I do not wish to remove them, thereby losing universal support, and they do not apply without adjustment on newer versions of glib2. I began, but did not complete, investigations into what changes are needed to move up to the next version. That is why we have not upgraded yet.
I don't want to move up more than one major version at a time, both in order to give the many other ports that use glib2 time to adapt to the changes, and in order to give me less to have to evaluate during the update process.
comment:9 Changed 3 years ago by dqh-au
Fair enough.
A couple more test results - I modified the Portfile to build 2.64.6 +quartz without any of the patches, and my GTK3 +quartz hello world test works again. I then tested 2.70.2 without any of the patches and that worked as well.
In the meantime - is it possible to only include the universal patches on universal builds, or similar? It sounds like the current plan will take a lot of work, and in the meantime GTK3 +quartz is completely broken.
At least I have local workaround now, which I'll use for the upcoming VICE arm binary distribution.
comment:10 Changed 3 years ago by michaelld (Michael Dickens)
This change is indeed what's causing the issue. I tested both with and without it (I have to rebuild glib2-devel and gtk3), and with it GTK3 usage fails; removing it, and things work again. Admittedly I'm just using ARM64 native, not actual +universal.
Replying to mituharu:
The following hunk in universal.patch looks suspicious:
@@ -114,7 +157,10 @@ @glib_os@ -@glib_vacopy@ +#ifdef __LP64__ +#define G_VA_COPY_AS_ARRAY 1 +#endif + @g_have_iso_c_varargs@ @g_have_iso_cxx_varargs@
comment:11 Changed 3 years ago by michaelld (Michael Dickens)
Cc: | kencu added |
---|
Also: moving to glib 2.70 changes the final change in universal.patch since they redid the atomics testing to be more robust as well as change the macro name. It's not clear that the current PPC code is relevant; guessing it needs to be tweaked ... my PPC Macs will require some work to get working again ... anybody else have access to one? Will add KenCU to this chat as a possible PPC Mac tester ...
comment:12 follow-up: 30 Changed 3 years ago by michaelld (Michael Dickens)
My vote for the current issue is to move the universal.patch is to remove the VA_COPY part of it. I think the rest looks fine & the final change with respect to PPC code is fine as is with 2.64 (or I think any 2.6x) code. This would be the minimal change required to get things working again, and folks can then work on upgrading to a newer 2.6x or even 2.7x version. One step at a time ...
comment:13 Changed 3 years ago by snarkhunter (Steve Langer)
Cc: | snarkhunter added |
---|
comment:14 Changed 3 years ago by snarkhunter (Steve Langer)
glib2 fails to build with +quartz -x11 on my Intel processor too. Commenting out the vacopy part of universal.patch allows it to build.
comment:15 follow-up: 16 Changed 3 years ago by snarkhunter (Steve Langer)
However, it does not fix the original problem on an M1 Mac, reported in the discourse.gnome.org bug report, which is that
import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk w = Gtk.Window()
fails with a “Trace/BPT trap: 5” error.
comment:16 Changed 3 years ago by pftbest (Vadzim Dambrouski)
Replying to snarkhunter:
I also had to remove the same option from "files/config.h.ed", then rebuild glib2 and gtk3 ports and it works for me now.
comment:17 Changed 3 years ago by lb90
Anyone interested in opening a PR? :)
I'd gladly do that myself but I don't have a Mac at hand right now...
comment:18 Changed 3 years ago by evanmiller (Evan Miller)
Cc: | evanmiller added |
---|
comment:19 Changed 3 years ago by mascguy (Christopher Nielsen)
Cc: | mascguy added |
---|
comment:20 Changed 3 years ago by tcwan (TC Wan)
Cc: | tcwan added |
---|
comment:21 Changed 3 years ago by Akkiesoft (Akira Ouchi)
Cc: | Akkiesoft added |
---|
comment:22 Changed 3 years ago by jianli-github (Jian Li)
Cc: | jianli-github added |
---|
comment:23 Changed 3 years ago by michaelld (Michael Dickens)
comment:24 follow-up: 25 Changed 3 years ago by Akkiesoft (Akira Ouchi)
Hi.
I have updated to glib2 @2.64.6_2+universal+x11.
However, gtk3 @ 3.24.31_1 + x11 seems to be broken now (architechture issue for my env?).
Log is here:
:info:build libtool: link: /usr/bin/clang -arch x86_64 -o /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31/gdk/tmp-introspect0trr5vm0/.libs/Gdk-3.0 -I/opt/local/include -DX_LOCALE -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -pipe -Os -fstrict-aliasing -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64 -Wall /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31/gdk/tmp-introspect0trr5vm0/Gdk-3.0.o -Wl,-headerpad_max_install_names -Wl,-syslibroot -Wl,/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -arch x86_64 -L. ./.libs/libgdk-3.dylib -L/opt/local/lib -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -lgdk_pixbuf-2.0 -lcairo-gobject -lfontconfig -lfreetype -lXinerama -lXi -lXrandr -lXcursor -lXcomposite -lXdamage -lXfixes -lcairo -lX11 -lXext -lepoxy -lfribidi -lm -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl :info:build ld: warning: ignoring file /opt/local/lib/libXi.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 :info:build ld: warning: ignoring file /opt/local/lib/libXcomposite.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 :info:build ld: warning: ignoring file /opt/local/lib/libXdamage.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 :info:build ld: warning: ignoring file /opt/local/lib/libXcursor.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 :info:build ld: warning: ignoring file /opt/local/lib/libepoxy.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64 :info:build dyld[49368]: symbol not found in flat namespace '_XCompositeGetOverlayWindow' :info:build Command '['/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31/gdk/tmp-introspect0trr5vm0/Gdk-3.0', '--introspect-dump=/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31/gdk/tmp-introspect0trr5vm0/functions.txt,/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31/gdk/tmp-introspect0trr5vm0/dump.xml']' died with <Signals.SIGABRT: 6>. :info:build make[4]: *** [Gdk-3.0.gir] Error 1 :info:build make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31/gdk' :info:build make[3]: *** [all-recursive] Error 1 :info:build make[3]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31/gdk' :info:build make[2]: *** [all] Error 2 :info:build make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31/gdk' :info:build make[1]: *** [all-recursive] Error 1 :info:build make[1]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31' :info:build make: *** [all] Error 2 :info:build make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31' :info:build Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/work/gtk+-3.24.31" && /usr/bin/make -j8 -w all CC="/usr/bin/clang -arch x86_64" CC_FOR_BUILD="/usr/bin/clang -arch x86_64" V=1 CPP_FOR_BUILD="/usr/bin/cpp" :info:build Exit code: 2 :error:build Failed to build gtk3: command execution failed :debug:build Error code: CHILDSTATUS 43815 2 :debug:build Backtrace: command execution failed :debug:build while executing :debug:build "system {*}$notty {*}$callback {*}$nice $fullcmdstring" :debug:build invoked from within :debug:build "command_exec -callback portprogress::target_progress_callback build" :debug:build (procedure "portbuild::build_main" line 8) :debug:build invoked from within :debug:build "$procedure $targetname" :error:build See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_gnome_gtk3/gtk3/main.log for details.
Thanks.
comment:25 follow-up: 26 Changed 3 years ago by Akkiesoft (Akira Ouchi)
Replying to Akkiesoft:
However, gtk3 @ 3.24.31_1 + x11 seems to be broken now (architechture issue for my env?).
I completely uninstalled and reinstalled MacPorts. Then install gtk3 and it worked.
comment:26 Changed 3 years ago by mascguy (Christopher Nielsen)
Replying to Akkiesoft:
Replying to Akkiesoft:
However, gtk3 @ 3.24.31_1 + x11 seems to be broken now (architechture issue for my env?).
I completely uninstalled and reinstalled MacPorts. Then install gtk3 and it worked.
Great, glad that the issue is resolved!
Relative to the overarching ticket though, can we consider this fixed? Or are there any other issues that need to be addressed?
comment:28 Changed 3 years ago by snarkhunter (Steve Langer)
It's working in my application now too. Thanks for fixing it.
comment:29 Changed 3 years ago by mascguy (Christopher Nielsen)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It looks like this has been resolved.
If anyone is still seeing an issue, please let us know ASAP!
comment:30 Changed 11 months ago by barracuda156
Replying to michaelld:
My vote for the current issue is to move the universal.patch is to remove the VA_COPY part of it. I think the rest looks fine & the final change with respect to PPC code is fine as is with 2.64 (or I think any 2.6x) code. This would be the minimal change required to get things working again, and folks can then work on upgrading to a newer 2.6x or even 2.7x version. One step at a time ...
Did GTK actually work for you on PPC? All apps crash on start, apparently, at least with GTK3.
The glib2 and glib2-devel ports are several major versions out of date. I plan to update them one major version at a time, giving some time in between each update for any issues caused by the update to be worked out. The update to the next major version is not as straightforward as just updating the version; some investigation is still needed to determine how to adapt our patches as there have been some conflicting upstream changes.
If this problem persists after updating all the way to the latest version then I guess it's a glib2 bug and will need to be solved by the developers of glib2.