Subject: Re: bug#74383: 29.4; Emacs PGTK crashes on Void Linux

From: Eli Zaretskii <[email-masked]>
Date: Sun, 17 Nov 2024 08:06:16 +0200

> From: Po Lu <[email-masked]>
> Cc: Taha Aziz Ben Ali <[email-masked]>,  [email-masked]
> Date: Sun, 17 Nov 2024 08:12:39 +0800
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> From: Taha Aziz Ben Ali <[email-masked]>
> >> Date: Sat, 16 Nov 2024 13:42:39 +0100
> >> 
> >> I've been failing to get Emacs to launch under Sway on Void Linux, the
> >> configuration I'm using was working fine on Arch Linux (using the same
> >> Emacs version). Note that `emacs -Q' also segfaults, but `emacs -nw' is
> >> able to launch emacs with all of my configuration without a single
> >> warning.
> >> 
> >> You can find the backtrace leading up to this error in this paste:
> >> 
> >>   https://paste.sr.ht/~grtcdr/c39dad4913262557228d1158680f52613b728c6a
> >> 
> >> I tracked the issue down to a cairo_surface_create_similar_image() call
> >> that results in the crash.
> >> 
> >> Before the program crashes, a warning about the "xpm" image type not
> >> being supported is shown which may be relevant:
> >> 
> >>   (emacs:8670): GdkPixbuf-WARNING **: 13:38:44.606: Error loading XPM
> >>   image loader: Image type “xpm” is not supported
> >
> > Do you have the XPM library installed and available to Emacs?
> >
> > Your build details indicate that Emacs was configured to be built with
> > XPM:
> >
> >> Configured using:
> >>  'configure --with-pgtk --prefix=/usr --sysconfdir=/etc
> >>  --sbindir=/usr/bin --bindir=/usr/bin --mandir=/usr/share/man
> >>  --infodir=/usr/share/info --localstatedir=/var
> >>  --host=x86_64-unknown-linux-musl --build=x86_64-unknown-linux-musl
> >>  '--libdir=${exec_prefix}/lib64' --with-file-notification=inotify
> >>  --with-modules --with-jpeg --with-tiff --with-gif --with-png
> >>  --with-webp --with-xpm --with-rsvg --without-imagemagick --with-xml2
> >                ^^^^^^^^^^
> >>  --with-gnutls --with-sound --with-m17n-flt --with-json --with-harfbuzz
> >>  --with-cairo --with-libgmp --with-sqlite3 --with-tree-sitter
> >>  --with-native-compilation=aot 'CFLAGS=-fno-PIE -mtune=generic -O2 -pipe
> >>  -g -ffile-prefix-map=/builddir/emacs-29.4=.' 'CPPFLAGS= '
> >>  'LDFLAGS=-no-pie -Wl,--as-needed ''
> >
> > But the features actually available to Emacs don't include XPM:
> >
> >> Configured features:
> >> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
> >> LCMS2 LIBOTF LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG
> >> RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
> >> WEBP XIM GTK3 ZLIB
> >
> > So I wonder how this happened.
> >
> > Did you build Emacs yourself, or was it installed from some distro?
> 
> The PGTK configuration always enables Emacs's built-in XPM library (in
> image.c).
> 
> All the same, the OP's problem is that the gdk-pixbuf library invoked by
> the toolkit to load tool-bar images no longer enables XPM support by
> default, because, in their words, it was "not being used."  Someone must
> volunteer to enable loading tool-bar images with Emacs's image system
> instead.

Which GTK versions dropped XPM support?  We should probably reject
those versions at configure time, if they lead to Emacs that crashes
on startup.