diff --git a/meta-oe/recipes-support/fastfetch/fastfetch/0001-CMake-Only-use-copy-dt-needed-entries-if-the-linker-.patch b/meta-oe/recipes-support/fastfetch/fastfetch/0001-CMake-Only-use-copy-dt-needed-entries-if-the-linker-.patch new file mode 100644 index 0000000000..5327a11eca --- /dev/null +++ b/meta-oe/recipes-support/fastfetch/fastfetch/0001-CMake-Only-use-copy-dt-needed-entries-if-the-linker-.patch @@ -0,0 +1,37 @@ +From ded9ccd14cb81e19a3d9335f21f68bf76f0c5ebe Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 11 Nov 2026 17:50:38 -0800 +Subject: [PATCH 1/3] CMake: Only use --copy-dt-needed-entries if the linker + supports it + +LLD does not implement --copy-dt-needed-entries. With +BINARY_LINK_TYPE=dynamic the flag is added to CMAKE_EXE_LINKER_FLAGS +before the configure checks run, so every check that links (utmpx.h, +glob, wordexp, pthread_timedjoin_np, ...) fails and fastfetch is built +with those features silently disabled. + +Check that the linker accepts the flag before adding it. + +Upstream-Status: Submitted [https://github.com/fastfetch-cli/fastfetch/pull/2714] +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a2723050..93cb984f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1732,7 +1732,11 @@ if(NOT BINARY_LINK_TYPE STREQUAL "dlopen") + message(STATUS "Enabling custom link type: ${BINARY_LINK_TYPE}") + target_compile_definitions(libfastfetch PUBLIC FF_DISABLE_DLOPEN=1) + if(NOT WIN32) +- set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--copy-dt-needed-entries") ++ include(CheckLinkerFlag) ++ check_linker_flag(C "-Wl,--copy-dt-needed-entries" HAVE_LINKER_COPY_DT_NEEDED_ENTRIES) ++ if(HAVE_LINKER_COPY_DT_NEEDED_ENTRIES) ++ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--copy-dt-needed-entries") ++ endif() + endif() + endif() + diff --git a/meta-oe/recipes-support/fastfetch/fastfetch/0002-users-Map-endutxent-to-endutent-when-utmpx.h-is-unav.patch b/meta-oe/recipes-support/fastfetch/fastfetch/0002-users-Map-endutxent-to-endutent-when-utmpx.h-is-unav.patch new file mode 100644 index 0000000000..b96285fe5f --- /dev/null +++ b/meta-oe/recipes-support/fastfetch/fastfetch/0002-users-Map-endutxent-to-endutent-when-utmpx.h-is-unav.patch @@ -0,0 +1,29 @@ +From e1bd0ad4ce45a612db3db27687836036a3e76581 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 11 Nov 2026 17:50:39 -0800 +Subject: [PATCH 2/3] users: Map endutxent to endutent when utmpx.h is + unavailable + +The utmp.h fallback maps setutxent and getutxent but not endutxent, +which is called unconditionally, so the build fails with: + +error: use of undeclared identifier 'endutxent'; did you mean 'endutent'? + +Upstream-Status: Submitted [https://github.com/fastfetch-cli/fastfetch/pull/2714] +Signed-off-by: Khem Raj +--- + src/detection/users/users_linux.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/detection/users/users_linux.c b/src/detection/users/users_linux.c +index e304b29c..d39fb765 100644 +--- a/src/detection/users/users_linux.c ++++ b/src/detection/users/users_linux.c +@@ -15,6 +15,7 @@ + #define utmpx utmp + #define setutxent setutent + #define getutxent getutent ++ #define endutxent endutent + #endif + #if __linux__ || __GNU__ + #include diff --git a/meta-oe/recipes-support/fastfetch/fastfetch/0003-CMake-links-libxcb-and-libX11-explicitly-when-not-us.patch b/meta-oe/recipes-support/fastfetch/fastfetch/0003-CMake-links-libxcb-and-libX11-explicitly-when-not-us.patch new file mode 100644 index 0000000000..5b39e94846 --- /dev/null +++ b/meta-oe/recipes-support/fastfetch/fastfetch/0003-CMake-links-libxcb-and-libX11-explicitly-when-not-us.patch @@ -0,0 +1,45 @@ +From 43d0a65e74b2198b53e66b87499e2eb73c8701c4 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 11 Nov 2026 17:57:05 -0800 +Subject: [PATCH 3/3] CMake: links libxcb and libX11 explicitly when not using + dlopen + +fastfetch calls libxcb and libX11 functions directly, but only links +xcb-randr and xrandr, whose pkg-config files list the core libraries in +Requires.private. GNU ld resolves them through +--copy-dt-needed-entries; LLD has no such option and fails with +undefined symbols such as xcb_connect and XOpenDisplay. + +Link libxcb and libX11 explicitly in the dynamic and static link modes. + +Upstream-Status: Submitted [https://github.com/fastfetch-cli/fastfetch/pull/2714] +Signed-off-by: Khem Raj +--- + CMakeLists.txt | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 93cb984f..de6864a2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1926,6 +1926,20 @@ ff_lib_enable(ELF + "libelf" + "libelf" + ) ++# xcb-randr and xrandr only list libxcb and libX11 in Requires.private, but ++# fastfetch calls into them directly, so link them explicitly. ++if(NOT BINARY_LINK_TYPE STREQUAL "dlopen" AND PKG_CONFIG_FOUND) ++ if(XCB_RANDR_FOUND) ++ pkg_check_modules(XCB QUIET xcb) ++ target_link_directories(libfastfetch PRIVATE ${XCB_LIBRARY_DIRS}) ++ target_link_libraries(libfastfetch PRIVATE ${XCB_LIBRARIES}) ++ endif() ++ if(XRANDR_FOUND OR GLX_FOUND OR VAX11_FOUND) ++ pkg_check_modules(X11 QUIET x11) ++ target_link_directories(libfastfetch PRIVATE ${X11_LIBRARY_DIRS}) ++ target_link_libraries(libfastfetch PRIVATE ${X11_LIBRARIES}) ++ endif() ++endif() + if(ENABLE_LUA) + # Lua is a special case since its CMake config does not follow the usual pattern + find_package(Lua QUIET) diff --git a/meta-oe/recipes-support/fastfetch/fastfetch_2.71.0.bb b/meta-oe/recipes-support/fastfetch/fastfetch_2.71.0.bb index c9ba3519b0..359736e7c0 100644 --- a/meta-oe/recipes-support/fastfetch/fastfetch_2.71.0.bb +++ b/meta-oe/recipes-support/fastfetch/fastfetch_2.71.0.bb @@ -10,7 +10,11 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2090e7d93df7ad5a3d41f6fb4226ac76" DEPENDS = "yyjson" -SRC_URI = "git://github.com/fastfetch-cli/fastfetch.git;protocol=https;branch=master;tag=${PV}" +SRC_URI = "git://github.com/fastfetch-cli/fastfetch.git;protocol=https;branch=master;tag=${PV} \ + file://0001-CMake-Only-use-copy-dt-needed-entries-if-the-linker-.patch \ + file://0002-users-Map-endutxent-to-endutent-when-utmpx.h-is-unav.patch \ + file://0003-CMake-links-libxcb-and-libX11-explicitly-when-not-us.patch \ + " SRCREV = "8c9d9c0449dd515e0088c4a60a38d2dc40c5ccd0" inherit cmake pkgconfig