Use system SDL2 on Linux instead of Conan#3058
Draft
tomjn wants to merge 1 commit into
Draft
Conversation
The Conan SDL2 recipe hard-links Wayland/EGL into the binary instead of letting SDL dlopen them at runtime (unlike X11), which breaks SDL's portable Linux model and causes runtime failures under Wayland. Take SDL2 from Conan only on Windows; on Linux link against the system libSDL2 (libsdl2-dev), restoring the runtime-dlopen behaviour that matches current releases. - conanfile.py: require and configure sdl only on Windows - all-linux Dockerfile: install libsdl2-dev - restore FindSDL2.cmake: use a Conan config package if present, else locate the system SDL2 via pkg-config - find_package(SDL2 MODULE ...) at the call sites so the finder runs even with Conan's CMAKE_FIND_PACKAGE_PREFER_CONFIG and the target-less system SDL 2.0.8 cmake config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on top of #2900 (the Conan migration). Targets the
conanbranch.Problem
The conan-center SDL2 recipe hard-links Wayland/EGL into the binary instead of letting SDL
dlopen()them at runtime — unlike X11, which the recipe already lets SDL load dynamically. Concretely the recipe tiesSDL_WAYLAND_SHAREDto the (static) conanwaylanddependency and force-injectswayland/xkbcommon/eglinto the consumer link line. The result is the runtime Wayland breakage reported in #2900 (segfaults unlessEGL_PLATFORM=waylandis set).This is Marek's sanctioned option 1: keep taking SDL2 from the system on Linux (where the distro
libSDL2.soalready follows SDL's portable "link glibc, dlopen the rest" model), and only use the Conan SDL2 on Windows where there's no system SDL2 to rely on.An upstream fix for the recipe itself is tracked in conan-io/conan-center-index#30465 — if accepted, Linux could take SDL2 from Conan again and this workaround could be retired.
Changes
conanfile.py— require & configuresdlonly on Windowsdocker-build-v2/images/all-linux/Dockerfile— installlibsdl2-devrts/build/cmake/FindSDL2.cmake— restored: use a Conan config package if present, otherwise locate the system SDL2 via pkg-configfind_package(SDL2 MODULE ...)at the call sites — needed because Conan's toolchain setsCMAKE_FIND_PACKAGE_PREFER_CONFIG ONand Ubuntu 18.04'ssdl2-config.cmake(2.0.8) setsSDL2_LIBRARIESbut defines noSDL2::SDL2target; withoutMODULEthe finder is bypassed and the target is never createdVerification
Built natively on
arm64-linux(image + engine) and inspected the link signature:conan graph info: SDL/Wayland/EGL gone from the Linux graph;sdl/2.32.10still present for Windowsrc=0)readelf -d spring: linkslibSDL2-2.0.so.0(system, dynamic),libX11/libXcursor(the engine's own usage), and nolibwayland*/libEGLdirect entries — matching the current working releasespring-headless/spring-dedicated: no SDL (stub only)Caveats
libstdc++.so.6still appears as aNEEDEDentry onspring; that's a pre-existing item on theconanbranch, unrelated to this change.Draft pending a runtime check and review.