Bug 289429 - games/retroarch is crashing frequently and doesn't build from ports
Summary: games/retroarch is crashing frequently and doesn't build from ports
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Some People
Assignee: Vladimir Druzenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-10 10:07 UTC by Roman Schmidt
Modified: 2025-11-14 13:52 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (dmenelkir)


Attachments
make log (34.74 KB, text/plain)
2025-09-10 10:07 UTC, Roman Schmidt
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Schmidt 2025-09-10 10:07:56 UTC
Created attachment 263667 [details]
make log

On FreeBSD 14.3 RetroArch fails to run about 3 out of 4 times.
I'm using the swayimg window manager (Wayland).

$ retroarch
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
Segmentation fault (core dumped)

$ gdb /usr/local/bin/retroarch
GNU gdb (GDB) 15.1 [GDB v15.1 for FreeBSD]
[...]
Reading symbols from /usr/local/bin/retroarch...
(No debugging symbols found in /usr/local/bin/retroarch)
(gdb) core retroarch.core
[New LWP 103767]
[New LWP 105528]
[New LWP 105529]
[New LWP 105530]
[New LWP 105531]
[New LWP 105532]
[New LWP 105533]
[New LWP 105534]
[New LWP 105535]
[New LWP 105536]
[New LWP 105537]
[New LWP 105538]
[New LWP 105539]
[New LWP 105540]
[New LWP 105541]
[New LWP 105542]
Core was generated by `retroarch'.
Program terminated with signal SIGSEGV, Segmentation fault.
Address not mapped to object.
#0  0x0000000000adf4bc in ?? ()
[Current thread is 1 (LWP 103767)]
(gdb) bt full
#0  0x0000000000adf4bc in ?? ()
No symbol table info available.
#1  0x0000000000adcc0b in ?? ()
No symbol table info available.
#2  0x0000000000b1151e in ?? ()
No symbol table info available.
#3  0x0000000000b0703e in ?? ()
No symbol table info available.
#4  0x0000000000ac8fcd in ?? ()
No symbol table info available.
#5  0x0000000000ac89e7 in ?? ()
No symbol table info available.
#6  0x0000000000a8ed12 in ?? ()
No symbol table info available.
#7  0x0000000000ab287e in ?? ()
No symbol table info available.
#8  0x0000000000aacd4c in ?? ()
No symbol table info available.
#9  0x00000000009c3a4f in ?? ()
No symbol table info available.
#10 0x00000000009b5476 in ?? ()
No symbol table info available.
#11 0x00000008410f8e34 in __libc_start1 () from /lib/libc.so.7
No symbol table info available.
#12 0x00000000009ab810 in ?? ()
No symbol table info available.
(gdb)

I wanted to compile from ports to enable debug symbols, but the compilation fails on pipewire.c. I've disabled all options with "make config", but there seems to be no option to disable the pipewire audio driver.

# make WITH_DEBUG=YES MAKE_JOBS_UNSAFE=yes install clean
===>  Building for RetroArch-1.21.0
[...]
WINDRES:
CC audio/drivers/pipewire.c
audio/drivers/pipewire.c:160:14: error: static declaration of 'pipewire_init' follows non-static declaration
  160 | static void *pipewire_init(const char *device, unsigned rate,
      |              ^
/usr/local/include/pipewire-0.3/pipewire/pipewire.h:53:1: note: previous declaration is here
   53 | pipewire_init(int *argc, char **argv[]);
      | ^
audio/drivers/pipewire.c:446:7: error: incompatible function pointer types initializing 'void *(*)(const char *, unsigned int, unsigned int, unsigned int, unsigned int *)' with an expression of type 'void (int *, char ***)' [-Wincompatible-function-pointer-types]
  446 |       pipewire_init,
      |       ^~~~~~~~~~~~~
2 errors generated.
gmake: *** [Makefile:236: obj-unix/release/audio/drivers/pipewire.o] Error 1
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/games/retroarch
*** Error code 1

Stop.
make: stopped in /usr/ports/games/retroarch

The error is the same for "main" and "2025Q3" ports branches.

Attaching the full build logs.
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2025-09-10 14:33:25 UTC
About build on live system.
You have installed multimedia/pipewire.
It's silent grab pipewire during build of games/retroarch.
For me build log look like bug in implementation of pipewire in the games/retroarch.
I did patch with fix build. But this bug better to report to upstream:
games/retroarch/files/patch-audio_drivers_pipewire.c:
--- audio/drivers/pipewire.c.orig       2025-05-01 00:17:50 UTC
+++ audio/drivers/pipewire.c
@@ -157,7 +157,7 @@ static const struct pw_registry_events registry_events
       .global = registry_event_global,
 };

-static void *pipewire_init(const char *device, unsigned rate,
+static void *_pipewire_init(const char *device, unsigned rate,
       unsigned latency,
       unsigned block_frames,
       unsigned *new_rate)
@@ -443,7 +443,7 @@ audio_driver_t audio_pipewire = {
 }

 audio_driver_t audio_pipewire = {
-      pipewire_init,
+      _pipewire_init,
       pipewire_write,
       pipewire_stop,
       pipewire_start,

games/retroarch/files/patch-camera_drivers_pipewire.c:
--- camera/drivers/pipewire.c.orig      2025-05-01 00:17:50 UTC
+++ camera/drivers/pipewire.c
@@ -364,7 +364,7 @@ static void pipewire_free(void *data)
    free(camera);
 }

-static void *pipewire_init(const char *device, uint64_t caps,
+static void *_pipewire_init(const char *device, uint64_t caps,
       unsigned width, unsigned height)
 {
    int               res, n_params;
@@ -457,7 +457,7 @@ camera_driver_t camera_pipewire = {
 }

 camera_driver_t camera_pipewire = {
-      pipewire_init,
+      _pipewire_init,
       pipewire_free,
       pipewire_start,
       pipewire_stop,

Also we can create patch with make detection of pipewire optional.
Comment 2 Vladimir Druzenko freebsd_committer freebsd_triage 2025-09-10 20:20:16 UTC
Fix for pipewire - new option PIPEWIRE:
games/retroarch/Makefile:
@@ -40,7 +40,7 @@
 SUB_FILES=     pkg-message

 OPTIONS_DEFINE=                ALSA CACA DOCS FFMPEG FREETYPE JACK OPENAL OPENGL OSS \
-                       PULSEAUDIO QT SDL UDEV V4L X11
+                       PIPEWIRE PULSEAUDIO QT SDL UDEV V4L X11
 OPTIONS_DEFINE_amd64=  WAYLAND # svgalib is x86 only
 OPTIONS_DEFINE_i386=   WAYLAND
 OPTIONS_DEFAULT=       FFMPEG FREETYPE OPENAL OPENGL OSS QT SDL UDEV V4L X11
@@ -68,6 +68,8 @@
 OPENGL_USE=                    GL=egl,gbm,gl
 OPENGL_CONFIGURE_ENABLE=       opengl
 OSS_CONFIGURE_ENABLE=          oss
+PIPEWIRE_LIB_DEPENDS=          libpipewire-0.3.so:multimedia/pipewire
+PIPEWIRE_CONFIGURE_ENABLE=     pipewire
 PULSEAUDIO_LIB_DEPENDS=                libpulse.so:audio/pulseaudio
 PULSEAUDIO_CONFIGURE_ENABLE=   pulse
 QT_USES=                       qt:6
@@ -96,6 +98,9 @@
 X11_USES=                      xorg
 X11_USE=                       XORG=x11,xcb,xext,xi,xinerama,xrandr,xscrnsaver,xv,xxf86vm
 X11_CONFIGURE_ENABLE=          x11
+
+post-patch-PIPEWIRE-off:
+       ${ECHO} HAVE_PIPEWIRE=no >> ${WRKSRC}/qb/config.params.sh

 post-install:
        @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/retroarch

retroarch/files/patch-qb_config.libs.sh:
--- qb/config.libs.sh.orig      2025-05-01 00:17:50 UTC
+++ qb/config.libs.sh
@@ -269,8 +269,10 @@ check_val '' PULSE -lpulse '' libpulse '' '' false
 check_pkgconf ROAR libroar 1.0.12
 check_val '' JACK -ljack '' jack 0.120.1 '' false
 check_val '' PULSE -lpulse '' libpulse '' '' false
+if [ "$HAVE_PIPEWIRE" != 'no' ]; then
 check_val '' PIPEWIRE -lpipewire-0.3 '' libpipewire-0.3 '' '' false
 check_val '' PIPEWIRE_STABLE -lpipewire-0.3 '' libpipewire-0.3 1.0.0 '' false
+fi
 check_val '' SDL -lSDL SDL sdl 1.2.10 '' false
 check_val '' SDL2 -lSDL2 SDL2 sdl2 2.0.0 '' false
Comment 3 Vladimir Druzenko freebsd_committer freebsd_triage 2025-09-10 22:35:48 UTC
This part is not needed:
+post-patch-PIPEWIRE-off:
+       ${ECHO} HAVE_PIPEWIRE=no >> ${WRKSRC}/qb/config.params.sh
Comment 4 commit-hook freebsd_committer freebsd_triage 2025-09-15 20:38:44 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8f270dd4b52979124c89a3bacb137c69d93d2255

commit 8f270dd4b52979124c89a3bacb137c69d93d2255
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2025-09-15 20:33:55 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-09-15 20:37:19 +0000

    games/retroarch: Fix build if multimedia/pipewire installed

    This does not affect clean builds (as with Poudriere).

    PR:             289429
    Approved by:    Daniel Menelkir <dmenelkir@gmail.com> (maintainer, implicit - fix build)
    MFH:            2025Q3

 games/retroarch/Makefile                             |  4 +++-
 .../files/patch-audio_drivers_pipewire.c (new)       | 20 ++++++++++++++++++++
 .../files/patch-camera_drivers_pipewire.c (new)      | 20 ++++++++++++++++++++
 games/retroarch/files/patch-qb_config.libs.sh (new)  | 13 +++++++++++++
 4 files changed, 56 insertions(+), 1 deletion(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2025-09-15 20:39:45 UTC
A commit in branch 2025Q3 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6900b55dd8e16b850c5497ec6e41e44756cac42b

commit 6900b55dd8e16b850c5497ec6e41e44756cac42b
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2025-09-15 20:33:55 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-09-15 20:39:14 +0000

    games/retroarch: Fix build if multimedia/pipewire installed

    This does not affect clean builds (as with Poudriere).

    PR:             289429
    Approved by:    Daniel Menelkir <dmenelkir@gmail.com> (maintainer, implicit - fix build)
    MFH:            2025Q3

    (cherry picked from commit 8f270dd4b52979124c89a3bacb137c69d93d2255)

 games/retroarch/Makefile                             |  4 +++-
 .../files/patch-audio_drivers_pipewire.c (new)       | 20 ++++++++++++++++++++
 .../files/patch-camera_drivers_pipewire.c (new)      | 20 ++++++++++++++++++++
 games/retroarch/files/patch-qb_config.libs.sh (new)  | 13 +++++++++++++
 4 files changed, 56 insertions(+), 1 deletion(-)
Comment 6 Vladimir Druzenko freebsd_committer freebsd_triage 2025-09-15 21:49:52 UTC
(In reply to Roman Schmidt from comment #0)
Can you build the port after this commit?