Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Changes:

Bugfixes:
* Fixed libc version detection on FreeBSD without binutils installed, and on DragonFly BSD. (Libc, FreeBSD / DragonFly)
* Fixed feature detection and linking failing with `BINARY_LINK_TYPE=dynamic` when linking with LLD, which does not support `--copy-dt-needed-entries`. (CMake)
* Fixed building when `utmpx.h` is unavailable. (Users, Linux)

# 2.71.0

Expand Down
20 changes: 19 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,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")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is for xcb and x11

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()

Expand Down Expand Up @@ -1923,6 +1927,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()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Wl,--copy-dt-needed-entries is unnecessary if you add this.

if(ENABLE_LUA)
# Lua is a special case since its CMake config does not follow the usual pattern
find_package(Lua QUIET)
Expand Down
1 change: 1 addition & 0 deletions src/detection/users/users_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define utmpx utmp
#define setutxent setutent
#define getutxent getutent
#define endutxent endutent
#endif
#if __linux__ || __GNU__
#include <netinet/in.h>
Expand Down