From c018073384cc235f2caa3c3afe72cadd631ea9b9 Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Fri, 6 Nov 2026 20:13:14 +0100 Subject: [PATCH] Libc (FreeBSD): uses base objdump to detect libc version The FBSD version was only detected when binutils' /usr/local/bin/objdump was installed. Supported FreeBSD releases ship llvm-objdump as /usr/bin/objdump in base, which gives the same result, so try it first like MidnightBSD already does and keep /usr/local/bin/objdump as a fallback. DragonFly sets FreeBSD too, so exclude it from both branches. Until now the FreeBSD branch caught DragonFly first and the DF version was never detected. --- CHANGELOG.md | 5 +++++ CMakeLists.txt | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e020d1289..7ec3cee64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# Unreleased + +Bugfixes: +* Fixed libc version detection on FreeBSD without binutils installed, and on DragonFly BSD. (Libc, FreeBSD / DragonFly) + # 2.71.0 Features: diff --git a/CMakeLists.txt b/CMakeLists.txt index a27230502..42b98908c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1610,14 +1610,14 @@ if(APPLE AND EXISTS "/usr/bin/otool") target_compile_definitions(libfastfetch PUBLIC FF_LIBSYSTEM_VERSION="${CMAKE_MATCH_1}") endif() endif() -if(MidnightBSD AND EXISTS "/usr/bin/objdump") +if(FreeBSD AND NOT DragonFly AND EXISTS "/usr/bin/objdump") execute_process(COMMAND /bin/sh -c "/usr/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1" OUTPUT_VARIABLE OBJDUMP_T_RESULT) if("${OBJDUMP_T_RESULT}" MATCHES "FBSD_([0-9]+\\.[0-9]+)") message(STATUS "Found FBSD ${CMAKE_MATCH_1}") target_compile_definitions(libfastfetch PUBLIC FF_FBSD_VERSION="${CMAKE_MATCH_1}") endif() -elseif(FreeBSD AND EXISTS "/usr/local/bin/objdump") +elseif(FreeBSD AND NOT DragonFly AND EXISTS "/usr/local/bin/objdump") execute_process(COMMAND /bin/sh -c "/usr/local/bin/objdump -T /lib/libc.so.* | grep 'FBSD_[0-9][0-9]*\\.[0-9][0-9]*' -o | sort -Vru | head -1" OUTPUT_VARIABLE OBJDUMP_T_RESULT) if("${OBJDUMP_T_RESULT}" MATCHES "FBSD_([0-9]+\\.[0-9]+)")