Skip to content

Commit eb4b43e

Browse files
committed
partial fix
1 parent aa6beba commit eb4b43e

File tree

3 files changed

+72
-4
lines changed

3 files changed

+72
-4
lines changed

dev-support/docker/pkg-resolver/install-protobuf.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,12 @@ if [ "$version_to_install" == "3.25.5" ]; then
4545
https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.25.5.tar.gz \
4646
-o /opt/protobuf.tar.gz &&
4747
tar xzf /opt/protobuf.tar.gz --strip-components 1 -C /opt/protobuf-src &&
48-
mkdir -p /opt/abseil-cpp-src &&
4948
curl -L -s -S \
5049
https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.1.tar.gz \
5150
-o /opt/abseil-cpp.tar.gz &&
5251
tar xzf /opt/abseil-cpp.tar.gz --strip-components 1 -C /opt/protobuf-src/third_party/abseil-cpp &&
5352
cd /opt/protobuf-src &&
54-
cmake -S . -B build -Dprotobuf_BUILD_TESTS=OFF &&
53+
cmake -S . -B build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF &&
5554
cmake --build build --parallel $(nproc) &&
5655
cmake --install build --prefix /opt/protobuf &&
5756
cd /root &&

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/CMakeLists.txt

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,70 @@ SET(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${CYRUS_SASL_DIR};${GSASL_DIR};$ENV{
4343
# Specify PROTOBUF_HOME so that find_package picks up the correct version
4444
SET(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};$ENV{PROTOBUF_HOME}")
4545

46+
if (BUILD_SHARED_LIBS AND MSVC)
47+
# On MSVC Abseil is bundled into a single DLL.
48+
# This condition is necessary as of abseil 20230125.3 when abseil is consumed via add_subdirectory,
49+
# the abseil_dll target is named abseil_dll, while if abseil is consumed via find_package, the target
50+
# is called absl::abseil_dll
51+
# Once https://github.com/abseil/abseil-cpp/pull/1466 is merged and released in the minimum version of
52+
# abseil required by protobuf, it is possible to always link absl::abseil_dll and absl::abseil_test_dll
53+
# and remove the if
54+
if(protobuf_ABSL_PROVIDER STREQUAL "package")
55+
set(protobuf_ABSL_USED_TARGETS absl::abseil_dll)
56+
set(protobuf_ABSL_USED_TEST_TARGETS absl::abseil_test_dll)
57+
else()
58+
set(protobuf_ABSL_USED_TARGETS abseil_dll)
59+
set(protobuf_ABSL_USED_TEST_TARGETS abseil_test_dll)
60+
endif()
61+
else()
62+
set(protobuf_ABSL_USED_TARGETS
63+
absl::absl_check
64+
absl::absl_log
65+
absl::algorithm
66+
absl::base
67+
absl::bind_front
68+
absl::bits
69+
absl::btree
70+
absl::cleanup
71+
absl::cord
72+
absl::core_headers
73+
absl::debugging
74+
absl::die_if_null
75+
absl::dynamic_annotations
76+
absl::flags
77+
absl::flat_hash_map
78+
absl::flat_hash_set
79+
absl::function_ref
80+
absl::hash
81+
absl::layout
82+
absl::log_initialize
83+
absl::log_severity
84+
absl::memory
85+
absl::node_hash_map
86+
absl::node_hash_set
87+
absl::optional
88+
absl::span
89+
absl::status
90+
absl::statusor
91+
absl::strings
92+
absl::synchronization
93+
absl::time
94+
absl::type_traits
95+
absl::utility
96+
absl::variant
97+
utf8_range::utf8_validity
98+
utf8_range::utf8_range
99+
)
100+
set(protobuf_ABSL_USED_TEST_TARGETS
101+
absl::scoped_mock_log
102+
)
103+
endif ()
104+
46105
find_package(Doxygen)
47106
find_package(OpenSSL REQUIRED)
48107
find_package(Protobuf REQUIRED)
108+
find_package(absl REQUIRED)
109+
find_package(utf8_range REQUIRED)
49110
find_package(CyrusSASL)
50111
find_package(GSasl)
51112
find_package(Threads)
@@ -89,7 +150,10 @@ endif (NOT THREAD_LOCAL_SUPPORTED)
89150
# to compile some dummy code
90151
unset (PROTOC_IS_COMPATIBLE CACHE)
91152
set (CMAKE_REQUIRED_INCLUDES ${PROTOBUF_INCLUDE_DIRS})
92-
set (CMAKE_REQUIRED_LIBRARIES ${PROTOBUF_LIBRARY} ${PROTOBUF_PROTOC_LIBRARY})
153+
set (CMAKE_REQUIRED_LIBRARIES
154+
${PROTOBUF_LIBRARY}
155+
${PROTOBUF_PROTOC_LIBRARY}
156+
${protobuf_ABSL_USED_TARGETS})
93157
check_cxx_source_compiles(
94158
"#include <google/protobuf/io/printer.h>
95159
#include <string>
@@ -280,6 +344,7 @@ if (HADOOP_BUILD AND NOT MSVC)
280344
hadoop_target_link_dual_libraries(hdfspp
281345
${LIB_DL}
282346
${PROTOBUF_LIBRARY}
347+
${protobuf_ABSL_USED_TARGETS}
283348
${OPENSSL_LIBRARIES}
284349
${SASL_LIBRARIES}
285350
${CMAKE_THREAD_LIBS_INIT}
@@ -291,6 +356,7 @@ else (HADOOP_BUILD AND NOT MSVC)
291356
target_link_libraries(hdfspp_static PUBLIC
292357
${LIB_DL}
293358
${PROTOBUF_LIBRARY}
359+
${protobuf_ABSL_USED_TARGETS}
294360
${OPENSSL_LIBRARIES}
295361
${SASL_LIBRARIES}
296362
${CMAKE_THREAD_LIBS_INIT}

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS
3838
)
3939

4040
add_executable(protoc-gen-hrpc protoc_gen_hrpc.cc)
41-
target_link_libraries(protoc-gen-hrpc ${PROTOBUF_PROTOC_LIBRARY} ${PROTOBUF_LIBRARY})
41+
target_link_libraries(protoc-gen-hrpc
42+
${PROTOBUF_PROTOC_LIBRARY}
43+
${PROTOBUF_LIBRARY}
44+
${protobuf_ABSL_USED_TARGETS})
4245

4346
function(GEN_HRPC SRCS)
4447
if(NOT ARGN)

0 commit comments

Comments
 (0)