Repository navigation
Conversation
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 with LLD 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. Signed-off-by: Khem Raj <raj.khem@gmail.com>
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'? Signed-off-by: Khem Raj <raj.khem@gmail.com>
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. Signed-off-by: Khem Raj <raj.khem@gmail.com>
| 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") |
| target_link_directories(libfastfetch PRIVATE ${X11_LIBRARY_DIRS}) | ||
| target_link_libraries(libfastfetch PRIVATE ${X11_LIBRARIES}) | ||
| endif() | ||
| endif() |
There was a problem hiding this comment.
-Wl,--copy-dt-needed-entries is unnecessary if you add this.
|
Why do you want to use |
Hi, I added the fastfetch recipe to meta-oe for use in Yocto/OpenEmbedded and keep it up-to-date. The latest version is on master-next where I switched the link type. The initial issue was that, for example, enabling the I chose to switch to If |
Summary
Building with
-DBINARY_LINK_TYPE=dynamicfails when the linker is LLD (e.g. a clang/LLD cross toolchain in Yocto/OpenEmbedded).-Wl,--copy-dt-needed-entriesis added toCMAKE_EXE_LINKER_FLAGSbefore the configure checks run. LLD does not implement that option, so every check that links fails (utmpx.h, glob, wordexp,pthread_timedjoin_np, ...) and the features are silently disabled. Onceutmpx.his reported missing, theutmp.hfallback inusers_linux.cfails to compile:Even with the flag dropped, the final link then fails because fastfetch calls libxcb and libX11 directly but only links
xcb-randr/xrandr, which carry them inRequires.private:Related issue (required for new logos for new distros)
None
Changes
--copy-dt-needed-entriesonly ifcheck_linker_flagreports the linker accepts itendutxenttoendutentin theutmp.hfallbackScreenshots
N/A
Checklist
Tested on Arch Linux x86_64 with clang and
-DBINARY_LINK_TYPE=dynamic:-fuse-ld=lld: configure checks pass (HAVE_UTMPX,HAVE_WORDEXP, ...), links,ctest20/20 passed, Users/Display/OpenGL modules work-fuse-ld=bfd: flag still detected and used, builds and runs as before-DHAVE_UTMPX=0: theutmp.hfallback compiles and the Users module works