Skip to content

SDL2: point alias to sdl2-compat#393386

Merged
K900 merged 9 commits intoNixOS:stagingfrom
LordGrimmauld:sdl2-replace
Mar 27, 2025
Merged

SDL2: point alias to sdl2-compat#393386
K900 merged 9 commits intoNixOS:stagingfrom
LordGrimmauld:sdl2-replace

Conversation

@LordGrimmauld
Copy link
Contributor

This is a mass rebuild mostly because of ffmpeg. The only component in ffmpeg depending on sdl is ffplay, which is easy enough to test.
Most other rebuilds caused by this are leaf packages (or close to being leaf packages) and thus can be fixed wither once this hits staging-nexet or retroactively on master once this passes through hydra.

sdl2-compat no longer propagates libX11, libGL or libGLU. movit has somewhat used dependencies like Krita, so i fixed it. I also fixed the-powder-toy with similar breaks as an example. Switching to sdl2-compat automagically made it use wayland-native, which is neat.

I do expect more apps to break due to losing libX11/libGL/libGLU and will fix those in follow-up(s). This change is important imo, because SDL2 has no maintainer in nixpkgs and is basically unmaintained upstream too.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@LordGrimmauld LordGrimmauld marked this pull request as draft March 26, 2025 12:50
@LordGrimmauld LordGrimmauld force-pushed the sdl2-replace branch 2 times, most recently from e08c80f to d99cc3f Compare March 26, 2025 12:56
@LordGrimmauld LordGrimmauld marked this pull request as ready for review March 26, 2025 12:59
@github-actions github-actions bot added the 6.topic: games Gaming on NixOS label Mar 26, 2025
@LordGrimmauld
Copy link
Contributor Author

Alright, eval should now be fixed - the SDL2 specific overrides obviously fail on current sdl2-compat, so those were switched back to SDL2_legacy

@github-actions github-actions bot added 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. labels Mar 26, 2025
@LordGrimmauld
Copy link
Contributor Author

This was cleanup for the commit history, makes review easier and there now is no single commit that doesn't eval

Copy link
Contributor

@marcin-serwin marcin-serwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've run into some issues when moving some packages manually from SDL2 to sdl2-compat, mostly minor things, like fullscreen not being on by default on wayland, but also hedgewars crashing on aarch64-linux: libsdl-org/SDL#12560. Some other apps may also be affected.

@LordGrimmauld
Copy link
Contributor Author

LordGrimmauld commented Mar 26, 2025

I've run into some issues when moving some packages manually from SDL2 to sdl2-compat, mostly minor things, like fullscreen not being on by default on wayland, but also hedgewars crashing on aarch64-linux

apart from ffmpeg/ffplay (which i tested), none of the affected packages would be mass rebuilds. Yes, i expect things to break - but those can trivially be fixed by pinning SDL2_legacy/.SDL2_classic. Maybe even before 25.05 hits.

@LordGrimmauld
Copy link
Contributor Author

Related: #395499

@trofi
Copy link
Contributor

trofi commented Apr 3, 2025

Proposed love_0_10 fix as well:

@trofi
Copy link
Contributor

trofi commented Apr 6, 2025

Bisect says d96d13a SDL2: point alias to sdl2-compat broke python3Packages.pygame ion staging and staging-next on x86_64-linux as:

$ nix build --no-link -f. python3Packages.pygame
...
FAILED (failures=7, errors=1, skipped=6)
====================================================================
ERROR: test_num_fingers (pygame.tests.touch_test.TouchTest.test_num_fingers)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nix/store/ng89gwad6r45z0pl18n443izc8j15qa8-python3.12-pygame-2.6.1/lib/python3.12/site-packages/pygame/tests/touch_test.py", line 33, in test_num_fingers
    touch.get_num_fingers(touch.get_device(0))
pygame.error: Unknown touch device index -1234

@LordGrimmauld
Copy link
Contributor Author

I had built pygame after this PR to ensure the libX11 drops didn't affect it - pygame built successfully for me.
However, to just unbreak it it might be worth trying SDL2_classic for pygame, just to see what happens.

@trofi
Copy link
Contributor

trofi commented Apr 6, 2025

@WheelsForReals WheelsForReals mentioned this pull request Apr 18, 2025
3 tasks
keenanweaver added a commit to keenanweaver/nixpkgs that referenced this pull request Apr 18, 2025
Rhys-T added a commit to Rhys-T/nur-packages that referenced this pull request Apr 21, 2025
NixOS/nixpkgs#393386 replaced SDL2 with sdl2-compat, which no longer
propagates libX11. I can't tell why drl is trying to link against that,
but it is, so let's give it what it wants.
Rhys-T added a commit to Rhys-T/nur-packages that referenced this pull request Apr 21, 2025
NixOS/nixpkgs#393386 replaced SDL2 with sdl2-compat, which no longer
propagates libX11. I can't tell why drl is trying to link against that,
but it is, so let's give it what it wants.
khabdrick pushed a commit to khabdrick/nixpkgs that referenced this pull request Apr 21, 2025
@7c6f434c
Copy link
Member

7c6f434c commented May 1, 2025

Hmm, looks like RenPy triggers vague segfaults with sdl2-compat but works fine with SDL2_classic, so builds passing is not all…

@LordGrimmauld
Copy link
Contributor Author

Hmm, looks like RenPy triggers vague segfaults with sdl2-compat but works fine with SDL2_classic, so builds passing is not all…

feel free to pin it to SDL2_classic then! It was known sdl2-compat might not always be an adequate replacement. While upstream is trying to fix all the compatibility issues, we can pin. Ideally we wouldn't need SDL2_classic by 25.11, but for now it is around. pygames has similar-ish issues.

@7c6f434c
Copy link
Member

7c6f434c commented May 1, 2025

So far I am not yet sure whether going deeper recursively helps (I suspect that in some cases yes, at least for pygames-sdl2)

@marcin-serwin
Copy link
Contributor

Hmm, looks like RenPy triggers vague segfaults with sdl2-compat but works fine with SDL2_classic, so builds passing is not all…

Do you have some reliable repro or is it random? I've tried clicking through the tutorial but nothing happened.

@7c6f434c
Copy link
Member

7c6f434c commented May 8, 2025

(Not to leave it without the answer completely) so far I have impression that some large games are more likely to crash when clicking through stuff quickly, so not close to reliable reproduction yet, sorry. Also, I have not yet found how much overriding is needed to bring segfaults to zero. I guess I should also check if the recent sdl2-compat bumps have improved things…

LordGrimmauld added a commit to LordGrimmauld/nixpkgs that referenced this pull request May 16, 2025
This was preliminarily pinned to SDL2_classic in 2532c66 (NixOS#393386).
The reason for that was DRM support and an incompatible override interface.
sdl3 is build with drm enabled by default, which means building things
that depend on drm through sdl2-compat should just work, no override needed.
nixpkgs-ci bot pushed a commit that referenced this pull request May 20, 2025
This was preliminarily pinned to SDL2_classic in 2532c66 (#393386).
The reason for that was DRM support and an incompatible override interface.
sdl3 is build with drm enabled by default, which means building things
that depend on drm through sdl2-compat should just work, no override needed.

(cherry picked from commit 8f2001f)
@bobby285271 bobby285271 mentioned this pull request May 26, 2025
13 tasks
@7c6f434c
Copy link
Member

Hm, backtrace makes no sense, the context is too large to be a usable reproduction, but the crash frequency change seems to be there…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: games Gaming on NixOS 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 1001-2500 This PR causes many rebuilds on Darwin and should most likely target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants