Skip to content

Commit

Permalink
GH-43467: [C++] Add support for the official LZ4 CMake package (#43468)
Browse files Browse the repository at this point in the history
### Rationale for this change

LZ4 1.10.0 provides `LZ4::lz4` but LZ4 1.9.4 provides only `LZ4::lz4_shared` and `LZ4::lz4_static`. So we need to prepare `LZ4::lz4` in our side.

### What changes are included in this PR?

Define `LZ4::lz4` by `LZ4::lz4_shared` or `LZ4::lz4_static` if `LZ4::lz4` doesn't exist.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes.
* GitHub Issue: #43467

Authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Jacob Wujciak-Jens <[email protected]>
  • Loading branch information
kou authored and jonkeane committed Jul 31, 2024
1 parent 5b284b7 commit 84386f8
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 5 deletions.
12 changes: 9 additions & 3 deletions cpp/cmake_modules/Findlz4Alt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ endif()
find_package(lz4 ${find_package_args})
if(lz4_FOUND)
set(lz4Alt_FOUND TRUE)
# Conan uses lz4::lz4 not LZ4::lz4
if(NOT TARGET LZ4::lz4 AND TARGET lz4::lz4)
add_library(LZ4::lz4 ALIAS lz4::lz4)
if(NOT TARGET LZ4::lz4)
# Conan uses lz4::lz4 not LZ4::lz4
if(TARGET lz4::lz4)
add_library(LZ4::lz4 ALIAS lz4::lz4)
elseif(ARROW_LZ4_USE_SHARED)
add_library(LZ4::lz4 ALIAS LZ4::lz4_shared)
else()
add_library(LZ4::lz4 ALIAS LZ4::lz4_static)
endif()
endif()
return()
endif()
Expand Down
5 changes: 4 additions & 1 deletion cpp/cmake_modules/ThirdpartyToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4507,9 +4507,12 @@ function(build_orc)
OFF
CACHE BOOL "" FORCE)
get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES)
if(NOT LZ4_INCLUDE_DIR)
find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
endif()
get_filename_component(LZ4_ROOT "${LZ4_INCLUDE_DIR}" DIRECTORY)
set(LZ4_HOME
${LZ4_ROOT}
"${LZ4_ROOT}"
CACHE STRING "" FORCE)
set(LZ4_LIBRARY
LZ4::lz4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ RUN \
libssl-dev \
libthrift-dev \
libutf8proc-dev \
libxxhash-dev \
libzstd-dev \
llvm-dev \
lsb-release \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ RUN \
libssl-dev \
libthrift-dev \
libutf8proc-dev \
libxxhash-dev \
libzstd-dev \
llvm-dev \
lsb-release \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ RUN \
libssl-dev \
libthrift-dev \
libutf8proc-dev \
libxxhash-dev \
libzstd-dev \
llvm-dev \
lsb-release \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ RUN \
libssl-dev \
libthrift-dev \
libutf8proc-dev \
libxxhash-dev \
libzstd-dev \
llvm-dev \
lsb-release \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ RUN \
libssl-dev \
libthrift-dev \
libutf8proc-dev \
libxxhash-dev \
libzstd-dev \
llvm-dev \
lsb-release \
Expand Down
2 changes: 2 additions & 0 deletions dev/tasks/linux-packages/apache-arrow/debian/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Build-Depends:
libssl-dev,
libthrift-dev,
libutf8proc-dev,
libxxhash-dev,
libzstd-dev,
meson,
ninja-build,
Expand Down Expand Up @@ -151,6 +152,7 @@ Depends:
libsnappy-dev,
libssl-dev,
libutf8proc-dev,
libxxhash-dev,
libzstd-dev,
nlohmann-json-dev | nlohmann-json3-dev,
@USE_SYSTEM_GRPC@ protobuf-compiler-grpc,
Expand Down
4 changes: 3 additions & 1 deletion dev/tasks/linux-packages/apache-arrow/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ override_dh_auto_test:

# libarrow.so: avoid failing with "Unknown DWARF DW_OP_172"
# libgandiva.so: avoid failing with "Unknown DWARF DW_OP_255"
# libparquet.so: avoid failing with "Unknown DWARF DW_OP_4"
# See also: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=949296
override_dh_dwz:
dh_dwz \
--exclude=libarrow.so \
--exclude=libgandiva.so
--exclude=libgandiva.so \
--exclude=libparquet.so

0 comments on commit 84386f8

Please sign in to comment.