Skip to content

build: Add fallbacks for non-glibc libcs and libc++ - #2215

Open
Renkoto wants to merge 3 commits into
flightlessmango:masterfrom
Renkoto:pr1-compat
Open

Renkoto wants to merge 3 commits into
flightlessmango:masterfrom
Renkoto:pr1-compat

Conversation

@Renkoto

@Renkoto Renkoto commented Nov 17, 2026 •

Copy link
Copy Markdown

This PR addresses three build and runtime issues encountered when compiling MangoHud against non-glibc C libraries and LLVM's libc++.

)This is part of a series, by the way):

  • ElfW() macro (include/elfhacks.h, mangohud-next/client/elfhacks.h): ElfW() is a glibc <link.h> extension. Define it from __elf64 / __elf32 when not already provided by the system headers.
  • OpenGL shim library resolution (src/gl/shim.c): dladdr1(..., RTLD_DL_LINKMAP) is glibc-specific, which previously disabled load_adjacent_opengl_lib() on non-glibc targets. Gate dladdr1 on #ifdef RTLD_DL_LINKMAP and fall back to standard POSIX dladdr() (Dl_info::dli_fname) otherwise.
  • std::atomic<std::shared_ptr<T>> (src/overlay_params.cpp): LLVM libc++ does not implement the C++20 std::atomic<std::shared_ptr<T>> specialization yet (__cpp_lib_atomic_shared_ptr is undefined). Provide a small wrapper using the C++11 std::atomic_load_explicit / std::atomic_store_explicit overloads when __cpp_lib_atomic_shared_ptr is unavailable.

Impact & Testing

  • glibc / libstdc++: No functional change. RTLD_DL_LINKMAP and __cpp_lib_atomic_shared_ptr remain active and take the same code paths as before.
  • Tested on: FreeBSD with Clang and libc++ (including functional verification of the OpenGL shim loading the adjacent libMangoHud.so). Also expected to unblock Linux builds using Clang + libc++ but I don't have a Linux install to confirm that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant