libsdl3: Fix build with cmake 4.4
PATCH 1/2 libsdl3: Fix build with cmake 4.4
cmake's check_symbol_exists() does not forward CMAKE_REQUIRED_FLAGS to the try_compile() it runs, unlike check_include_file() and Internal/CheckSourceCompiles which both pass it along as -DCOMPILE_DEFINITIONS. So the -D_GNU_SOURCE=1 that SDL adds to CMAKE_REQUIRED_FLAGS never reaches any symbol check, and every glibc extension hidden behind __USE_GNU is detected as missing.
HAVE_GETRESUID being unset is fatal, since SDL_gtk.c then compiles its own static fallback which collides with the <unistd.h> declaration:
SDL_gtk.c:90:19: error: static declaration of 'getresuid' follows
non-static declaration
Pass _GNU_SOURCE via CMAKE_REQUIRED_DEFINITIONS as well. This also restores detection of memfd_create, ppoll, posix_spawn_file_actions_addchdir, fopen64 and fseeko64, which were silently disabled.
--- ...SOURCE-via-CMAKE_REQUIRED_DEFINITION.patch | 53 +++++++++++++++++++ .../libsdl3/libsdl3_3.4.12.bb | 4 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-graphics/libsdl3/libsdl3/0001-cmake-Pass-_GNU_SOURCE-via-CMAKE_REQUIRED_DEFINITION.patch
meta-oe/recipes-graphics/libsdl3/libsdl3/0001-cmake-Pass-_GNU_SOURCE-via-CMAKE_REQUIRED_DEFINITION.patch new file +53 -0
@@ -0,0 +1,53 @@ +From c8a74ad998879e52badd09e9e52477c8e87d0e5d Mon Sep 17 00:00:00 2001 +From: Khem Raj <[email protected]> +Date: Fri, 31 Jul 2026 02:25:45 -0700 +Subject: [PATCH] cmake: Pass _GNU_SOURCE via CMAKE_REQUIRED_DEFINITIONS too + +CMake's check_symbol_exists() does not forward CMAKE_REQUIRED_FLAGS to the +try_compile() it performs - it only forwards CMAKE_REQUIRED_DEFINITIONS, +CMAKE_REQUIRED_INCLUDES, CMAKE_REQUIRED_LINK_OPTIONS and +CMAKE_REQUIRED_LIBRARIES. Its sibling modules (CheckIncludeFile, +Internal/CheckSourceCompiles) do pass CMAKE_REQUIRED_FLAGS along as +-DCOMPILE_DEFINITIONS, which is why only check_symbol_exists() is affected. + +As a result the -D_GNU_SOURCE=1 added to CMAKE_REQUIRED_FLAGS never reaches +any check_symbol_exists() test, and every glibc extension guarded by +__USE_GNU in the system headers is detected as missing: + + HAVE_GETRESUID, HAVE_GETRESGID, HAVE_MEMFD_CREATE, HAVE_PPOLL, + HAVE_POSIX_SPAWN_FILE_ACTIONS_ADDCHDIR, LIBC_HAS_FOPEN64, ... + +Most of these just silently disable functionality, but HAVE_GETRESUID being +unset is a hard build failure, because src/core/unix/SDL_gtk.c then defines +its own static fallback which collides with the declaration in <unistd.h>: + + SDL_gtk.c:90:19: error: static declaration of 'getresuid' follows + non-static declaration + /usr/include/unistd.h:755:12: note: previous declaration is here + +Add -D_GNU_SOURCE=1 to CMAKE_REQUIRED_DEFINITIONS as well so that the +symbol checks see it too. + +Upstream-Status: Pending + +Signed-off-by: Khem Raj <[email protected]> +--- + CMakeLists.txt | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 93a99bc..e37858d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,6 +122,11 @@ set(SDL_CHECK_REQUIRED_LINK_OPTIONS "" CACHE STRING "Extra link options (for CMA + mark_as_advanced(SDL_CHECK_REQUIRED_INCLUDES SDL_CHECK_REQUIRED_LINK_OPTIONS) + + string(APPEND CMAKE_REQUIRED_FLAGS " -D_GNU_SOURCE=1") ++# check_symbol_exists() does not forward CMAKE_REQUIRED_FLAGS to try_compile(), ++# so _GNU_SOURCE has to be passed via CMAKE_REQUIRED_DEFINITIONS as well, ++# otherwise every check for a glibc extension (getresuid, memfd_create, ppoll, ++# posix_spawn_file_actions_addchdir, ...) is misdetected as missing. ++list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE=1") + list(APPEND CMAKE_REQUIRED_INCLUDES ${SDL_CHECK_REQUIRED_INCLUDES}) + list(APPEND CMAKE_REQUIRED_LINK_OPTIONS ${SDL_CHECK_REQUIRED_LINK_OPTIONS}) +
meta-oe/recipes-graphics/libsdl3/libsdl3_3.4.12.bb +3 -1
@@ -14,7 +14,9 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=036a54229112040a743509a86b30c80c \ file://src/video/yuv2rgb/LICENSE;md5=79f8f3418d91531e05f0fc94ca67e071 \ " -SRC_URI = "http://www.libsdl.org/release/SDL3-${PV}.tar.gz" +SRC_URI = "http://www.libsdl.org/release/SDL3-${PV}.tar.gz \ + file://0001-cmake-Pass-_GNU_SOURCE-via-CMAKE_REQUIRED_DEFINITION.patch \ +" S = "${UNPACKDIR}/SDL3-${PV}"
PATCH 2/2 libhtml-tree-perl, libmodule-build-tiny-perl: Drop obsolete TMPDIR scrubbing
oe-core 3c2bb7bce1 ("cpan_build: disable .packlist and html doc") moved --create_packlist=0 into cpan_build.bbclass and disabled html doc generation there as well. Neither .packlist nor the html docs are generated anymore, so the do_install:append() hooks that sed'ed TMPDIR out of them now run find(1) over paths that no longer exist and hand sed an empty argument list:
find: '.../image/usr/share/doc/perl/html/site/lib/HTML/': No such file or directory
sed: no input files
WARNING: exit code 4 from a shell command.
Remove the now dead hooks.
--- meta-perl/recipes-perl/libhtml/libhtml-tree-perl_5.07.bb | 7 ------- .../libmodule/libmodule-build-tiny-perl_0.053.bb | 7 ------- 2 files changed, 14 deletions(-)
meta-perl/recipes-perl/libhtml/libhtml-tree-perl_5.07.bb +0 -7
@@ -25,13 +25,6 @@ export PERL_USE_UNSAFE_INC = "1" DEPENDS += "libmodule-build-perl-native \ " -do_install:append() { - sed -i \ - -e 's|${TMPDIR}||g' \ - `find ${D}/usr/share/doc/perl/html/site/lib/HTML/ -type f` \ - `find ${D}/usr/lib/perl5 -type f -name .packlist` -} - RPROVIDES:${PN} = " libhtml-element-perl \ libhtml-tree-assubs-perl \ libhtml-tree-perl \
meta-perl/recipes-perl/libmodule/libmodule-build-tiny-perl_0.053.bb +0 -7
@@ -21,13 +21,6 @@ S = "${UNPACKDIR}/Module-Build-Tiny-${PV}" inherit cpan_build ptest-perl -do_install:append() { - sed -i \ - -e 's|${TMPDIR}||g' \ - `find ${D}/usr/lib/perl5 -type f -name .packlist` -} - - RDEPENDS:${PN} += " \ libextutils-config-perl \ libextutils-helpers-perl \