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.
This commit is contained in:
Piotr Kubaj
2026-11-06 20:13:14 +01:00
committed by Carter Li
parent 8c9d9c0449
commit c018073384
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -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:
+2 -2
View File
@@ -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]+)")