libretro / libretro/RetroArch

Segfault unless using gdb on FreeBSD 14.3

Open
#18,377 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

Is there an existing issue for this?
  • This is a bug in RetroArch frontend
  • I have searched the existing issues
Description

So this is a weird one. Using v1.19.1 worked fine. I could run it from the CLI without issue using retroarch, or from Emulationstation. After upgrading to v1.21.0, running retroarch from the CLI results in a segmentation fault. However, when I run gdb --args retroarch -v, then run it from gdb, v1.21.0 loads fine and works fine (loads/plays games).

Not sure why running from gdb lets it work, or what gdb is doing to cause it to work, though. I also tried with the vulkan video driver, but it segfaulted as well.

Any ideas/next steps to troubleshoot?

Expected behavior

No response

Steps to reproduce the bug

See description

Version/Commit

1.21.0

Bisect Results

No response

Present in the nightly version

I don't know

Platform & operating system

FreeBSD 14.3

Affected Cores

No response

Environment information

Installed using pkg, and also tried compiling via ports.

Relevant log output
Running with gdb:
$ gdb --args retroarch -v 
GNU gdb (GDB) 15.1 [GDB v15.1 for FreeBSD]
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd14.3".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from retroarch...
(No debugging symbols found in retroarch)
(gdb) run
Starting program: /usr/local/bin/retroarch -v
[INFO] [Config]: Looking for config in: "/home/user/.config/retroarch/retroarch.cfg".
[INFO] === Build =======================================
[INFO] CPU Model Name: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
[INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX 
[INFO] Version: 1.21.0
[INFO] Built: Nov 11 2025
[INFO] =================================================
[New LWP 207472 of process 67410]
[INFO] [Input]: Found input driver: "sdl2".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Core]: Geometry: 320x240, Aspect: 1.333, FPS: 60.00, Sample rate: 48000.00 Hz.
[INFO] [Video]: Set video size to: fullscreen.
[New LWP 207473 of process 67410]
[New LWP 207474 of process 67410]
[INFO] [GLX]: GLX_EXT_swap_control_tear supported.
[INFO] [GL]: Found GL context: "x".
[INFO] [GL]: Detecting screen resolution: 2048x1080.
[INFO] [XINERAMA]: Xinerama version: 1.1.
[INFO] [XINERAMA]: Xinerama screens: 1.
[INFO] [GLX]: Using Xinerama on screen #0.
[INFO] [GLX]: X = 0, Y = 0, W = 2048, H = 1080.
[INFO] [GLX]: Using windowed fullscreen.
[New LWP 207475 of process 67410]
[New LWP 207476 of process 67410]
[INFO] [GLX]: Found swap function: glXSwapIntervalEXT.
[INFO] [GL]: Vendor: Intel, Renderer: Mesa Intel(R) UHD Graphics 630 (CML GT2).
[INFO] [GL]: Version: 4.6 (Compatibility Profile) Mesa 24.1.7.
[INFO] [GL]: Using resolution 2048x1080.
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[INFO] [GLSL]: Checking GLSL shader support ...
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 4 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Using GL_RGB565 for texture uploads.
[INFO] [X11]: Master pointer, 2 "Virtual core pointer"
[New LWP 207477 of process 67410]
[New LWP 207478 of process 67410]
[New LWP 207479 of process 67410]
[WARN] [SDL]: Couldn't open haptic device of the joypad #0: Haptic: There are 0 haptic devices available
[INFO] [SDL]: Falling back to joystick rumble
[INFO] [Joypad]: Found joypad driver: "sdl2".
[INFO] [Autoconf]: Xbox 360 Controller configured in port 1.
[INFO] [Video]: Found display server: "x11".
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Audio]: Started synchronous audio driver.
[ERROR] [Microphone]: Failed to start microphone driver. Will continue without audio input.
[INFO] [Display]: Found display driver: "gl".
[INFO] [Playlist]: Loading history file: "/home/user/.config/retroarch/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/user/.config/retroarch/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/user/.config/retroarch/content_image_history.lpl".
[INFO] [Playlist]: Loading favorites file: "/home/user/.config/retroarch/content_favorites.lpl".
[New LWP 207480 of process 67410]
[New LWP 207481 of process 67410]
[Detaching after fork from child process 67411]
[New LWP 207483 of process 67410]
[New LWP 207484 of process 67410]
[WARN] [SDL]: Couldn't open haptic device of the joypad #0: Haptic: There are 0 haptic devices available
[INFO] [SDL]: Falling back to joystick rumble
[INFO] [Autoconf]: Xbox 360 Controller configured in port 1.
[INFO] [GLX]: Resized fullscreen resolution to 2048x1080.
[INFO] [Config]: Saved new config to "/home/user/.config/retroarch/retroarch.cfg".
[INFO] [Core]: Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
[INFO] [Autoconf]: Xbox 360 Controller disconnected from port 1.
[LWP 207476 of process 67410 exited]
[LWP 207475 of process 67410 exited]
[INFO] [XINERAMA]: Xinerama version: 1.1.
[INFO] [XINERAMA]: Xinerama screens: 1.
[INFO] [XINERAMA]: Saved monitor #0.
[LWP 207472 of process 67410 exited]
[LWP 207484 of process 67410 exited]
[LWP 207483 of process 67410 exited]
[LWP 207479 of process 67410 exited]
[LWP 207478 of process 67410 exited]
[LWP 207477 of process 67410 exited]
[LWP 207481 of process 67410 exited]
QThreadStorage: entry 2 destroyed before end of thread 0x805ea60e0
QThreadStorage: entry 1 destroyed before end of thread 0x805ea60e0
[LWP 207474 of process 67410 exited]
[LWP 207473 of process 67410 exited]
[LWP 207480 of process 67410 exited]
[Inferior 1 (process 67410) exited normally]


Running without gdb:
$ retroarch -v
[INFO] [Config]: Looking for config in: "/home/user/.config/retroarch/retroarch.cfg".
[INFO] === Build =======================================
[INFO] CPU Model Name: Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
[INFO] Capabilities: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX 
[INFO] Version: 1.21.0
[INFO] Built: Nov 11 2025
[INFO] =================================================
[INFO] [Input]: Found input driver: "sdl2".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Core]: Geometry: 320x240, Aspect: 1.333, FPS: 60.00, Sample rate: 48000.00 Hz.
[INFO] [Video]: Set video size to: fullscreen.
[INFO] [GLX]: GLX_EXT_swap_control_tear supported.
[INFO] [GL]: Found GL context: "x".
[INFO] [GL]: Detecting screen resolution: 2048x1080.
[INFO] [XINERAMA]: Xinerama version: 1.1.
[INFO] [XINERAMA]: Xinerama screens: 1.
[INFO] [GLX]: Using Xinerama on screen #0.
[INFO] [GLX]: X = 0, Y = 0, W = 2048, H = 1080.
[INFO] [GLX]: Using windowed fullscreen.
[INFO] [GLX]: Found swap function: glXSwapIntervalEXT.
[INFO] [GL]: Vendor: Intel, Renderer: Mesa Intel(R) UHD Graphics 630 (CML GT2).
[INFO] [GL]: Version: 4.6 (Compatibility Profile) Mesa 24.1.7.
[INFO] [GL]: Using resolution 2048x1080.
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[INFO] [GLSL]: Checking GLSL shader support ...
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 4 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Using GL_RGB565 for texture uploads.
[INFO] [X11]: Master pointer, 2 "Virtual core pointer"
[WARN] [SDL]: Couldn't open haptic device of the joypad #0: Haptic: There are 0 haptic devices available
[INFO] [SDL]: Falling back to joystick rumble
[INFO] [Joypad]: Found joypad driver: "sdl2".
[INFO] [Autoconf]: Xbox 360 Controller configured in port 1.
[INFO] [Video]: Found display server: "x11".
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Audio]: Started synchronous audio driver.
[ERROR] [Microphone]: Failed to start microphone driver. Will continue without audio input.
[INFO] [Display]: Found display driver: "gl".
[INFO] [Playlist]: Loading history file: "/home/user/.config/retroarch/content_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/user/.config/retroarch/content_music_history.lpl".
[INFO] [Playlist]: Loading history file: "/home/user/.config/retroarch/content_image_history.lpl".
[INFO] [Playlist]: Loading favorites file: "/home/user/.config/retroarch/content_favorites.lpl".
Segmentation fault         retroarch -v

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing retroarch -v outside and inside GDB on FreeBSD 14.3, then capture a backtrace from the CLI segmentation fault and compare the two runs. Use the reported 1.19.1-to-1.21.0 change as a regression boundary; done means identifying the failing startup path and verifying that normal CLI launch no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
desktop-dev, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.