Skip to content

Commit

Permalink
GH-40577: [C++] Ensure pkg-config flags include -ldl for static builds (
Browse files Browse the repository at this point in the history
#40578)

### Rationale for this change

When linking statically, pkg-config doesn't pick up the new dependency on libdl introduced by #39067

This produces [unresolved symbol errors](#39067 (comment))

### What changes are included in this PR?

Addition of `-ldl` to `ARROW_PC_LIBS_PRIVATE` to ensure linkage to the necessary library

### Are these changes tested?

yes

### Are there any user-facing changes?

no

* GitHub Issue: #40577

Authored-by: Benjamin Kietzman <bengilgit@gmail.com>
Signed-off-by: Benjamin Kietzman <bengilgit@gmail.com>
  • Loading branch information
bkietz authored Mar 16, 2024
1 parent 681be03 commit 2224a29
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,22 +136,21 @@ endif()

if(ARROW_ENABLE_THREADING)
list(APPEND ARROW_SHARED_PRIVATE_LINK_LIBS Threads::Threads)
list(APPEND ARROW_STATIC_LINK_LIBS Threads::Threads)
list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS Threads::Threads)
endif()

if(NOT MSVC_TOOLCHAIN)
list(APPEND ARROW_SHARED_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS})
list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS})
endif()

set(ARROW_TEST_LINK_TOOLCHAIN ${ARROW_GTEST_GMOCK} ${ARROW_GTEST_GTEST_MAIN})
set(ARROW_TEST_STATIC_LINK_LIBS arrow::flatbuffers arrow_testing_static arrow_static
${ARROW_TEST_LINK_TOOLCHAIN})
set(ARROW_TEST_SHARED_LINK_LIBS arrow::flatbuffers arrow_testing_shared arrow_shared
${ARROW_TEST_LINK_TOOLCHAIN})
if(NOT MSVC)

if(CMAKE_DL_LIBS)
list(APPEND ARROW_SHARED_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS})
list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS ${CMAKE_DL_LIBS})
list(APPEND ARROW_TEST_SHARED_LINK_LIBS ${CMAKE_DL_LIBS})
list(APPEND ARROW_TEST_STATIC_LINK_LIBS ${CMAKE_DL_LIBS})
string(APPEND ARROW_PC_LIBS_PRIVATE " -l${CMAKE_DL_LIBS}")
endif()

# ----------------------------------------------------------------------
Expand Down

0 comments on commit 2224a29

Please sign in to comment.