Skip to content

Commit

Permalink
Add zlib to cudfjni link when using static libcudf library dependency (
Browse files Browse the repository at this point in the history
…#9890)

When the Java bindings use libcudf as a static library dependency, the resulting link is missing zlib as a dynamic link dependency.  This can result in runtime errors such as `undefined symbol: inflateInit2_` when trying to load a file using gzip compression.  This adds zlib to the cudfjni link when using libcudf.a as the cudf dependency.

Authors:
  - Jason Lowe (https://github.com/jlowe)

Approvers:
  - Alessandro Bellina (https://github.com/abellina)
  - Nghia Truong (https://github.com/ttnghia)
  - Gera Shegalov (https://github.com/gerashegalov)

URL: #9890
  • Loading branch information
jlowe authored Dec 11, 2021
1 parent b359a0f commit e581734
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion java/src/main/native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ set(CUDF_LIB_HINTS HINTS "$ENV{CUDF_ROOT}" "$ENV{CUDF_ROOT}/lib" "$ENV{CONDA_PRE

find_library(CUDF_LIB "cudf" REQUIRED HINTS ${CUDF_LIB_HINTS})

# ##################################################################################################
# * ZLIB ------------------------------------------------------------------------------------------

# find zlib
rapids_find_package(ZLIB REQUIRED)

# ##################################################################################################
# * RMM -------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -321,7 +327,7 @@ target_compile_definitions(cudfjni PUBLIC SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${RMM

set(CUDF_LINK ${CUDF_LIB})
if(CUDF_JNI_LIBCUDF_STATIC)
set(CUDF_LINK -Wl,--whole-archive ${CUDF_LIB} -Wl,--no-whole-archive)
set(CUDF_LINK -Wl,--whole-archive ${CUDF_LIB} -Wl,--no-whole-archive ZLIB::ZLIB)
endif()

target_link_libraries(
Expand Down

0 comments on commit e581734

Please sign in to comment.