Linux: add ${CMAKE_DL_LIBS} to libHttpClient.Linux and WebSocketCompressionTests target_link_libraries#986
Conversation
…nTests
Both targets transitively pull dlfcn symbols (via OpenSSL's dso_dlfcn.c)
but don't link against libdl. On glibc < 2.34 (e.g. Ubuntu 20.04) the
dl* symbols still live in libdl.so, so the link fails:
/usr/bin/ld: dso_dlfcn.c:(.text+0xda): undefined reference to `dlerror'
Add ${CMAKE_DL_LIBS} to:
- libHttpClient.Linux (shared lib) target_link_libraries
- WebSocketCompressionTests.Linux target_link_libraries
CMAKE_DL_LIBS resolves to "dl" on Linux and is empty on platforms that
don't need it (Windows, macOS), so this is a no-op everywhere except
the affected Linux configurations.
No-op on glibc >= 2.34 (where dl symbols are merged into libc).
|
Pinging for review — would appreciate eyes from anyone with libHttpClient.Linux context: Fix is a 2-line CMake change adding |
|
Let's wait for the CI checks to pass before merging |
|
Closing this PR — the consumer side (Microsoft Xbox PlayFab.SDKs.All TestDrop pipeline) that motivated this fix is migrating its Linux build agent from Ubuntu 20.04 (glibc 2.31, Verified empirically: lab build 148767526 ran the unpatched The fix is still correct on its merits for anyone building libHttpClient on older glibc — feel free to re-open / cherry-pick if useful — but our specific consumer no longer needs it. Apologies for the noise! |
Both targets transitively call
dlfcnfunctions (via OpenSSL'sdso_dlfcn.c) but don't link againstlibdl. On linkers that don't auto-resolve, the link fails:Adds
${CMAKE_DL_LIBS}to:libHttpClient.Linux(shared lib)target_link_librariesWebSocketCompressionTests.Linuxtarget_link_libraries${CMAKE_DL_LIBS}is the idiomatic CMake variable for this — it expands todlon platforms that need it and is empty elsewhere. Safe no-op on Windows/macOS.Surfaced via the
PlayFab.SDKs.All.TestDropLinux pipeline.