Skip to content

Commit cf6a61b

Browse files
committed
Fix building
1 parent aa52a90 commit cf6a61b

File tree

5 files changed

+20
-23
lines changed

5 files changed

+20
-23
lines changed

BUILDING.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Refer to dev-support/docker/Dockerfile):
8484
$ tar -zxvf protobuf-3.25.5.tar.gz
8585
$ tar -zxvf abseil-cpp-20230802.1.tar.gz --strip-components 1 -C protobuf-3.25.5/third_party/abseil-cpp
8686
$ cd protobuf-3.25.5
87-
$ cmake -S . -B build -Dprotobuf_BUILD_TESTS=OFF
87+
$ cmake -S . -B build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF
8888
$ cmake --build build --parallel $(nproc)
8989
$ sudo cmake --install build
9090
* Boost
@@ -442,7 +442,7 @@ you may optionally install zlib, lz4, etc.
442442
$ tar -zxvf protobuf-3.25.5.tar.gz
443443
$ tar -zxvf abseil-cpp-20230802.1.tar.gz --strip-components 1 -C protobuf-3.25.5/third_party/abseil-cpp
444444
$ cd protobuf-3.25.5
445-
$ cmake -S . -B build -Dprotobuf_BUILD_TESTS=OFF
445+
$ cmake -S . -B build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF
446446
$ cmake --build build --parallel $(nproc)
447447
$ cmake --install build
448448
$ protoc --version
@@ -482,7 +482,7 @@ Building on Rocky Linux 8
482482
$ tar -zxvf protobuf-3.25.5.tar.gz
483483
$ tar -zxvf abseil-cpp-20230802.1.tar.gz --strip-components 1 -C protobuf-3.25.5/third_party/abseil-cpp
484484
$ cd protobuf-3.25.5
485-
$ cmake -S . -B build -Dprotobuf_BUILD_TESTS=OFF
485+
$ cmake -S . -B build -DCMAKE_POSITION_INDEPENDENT_CODE=ON -Dprotobuf_BUILD_TESTS=OFF
486486
$ cmake --build build --parallel $(nproc)
487487
$ sudo cmake --install build --prefix /usr/local
488488
$ cd ..

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/protoc_gen_hrpc.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class StubGenerator : public CodeGenerator {
4848

4949
bool StubGenerator::Generate(const FileDescriptor *file, const std::string &,
5050
GeneratorContext *ctx, std::string *) const {
51-
namespace pb = ::google::protobuf;
5251
std::unique_ptr<ZeroCopyOutputStream> os(
5352
ctx->Open(StripProto(file->name()) + ".hrpc.inl"));
5453
Printer out(os.get(), '$');

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ target_link_libraries(get_jni_test
9090
add_memcheck_test(get_jni get_jni_test)
9191

9292
add_executable(remote_block_reader_test remote_block_reader_test.cc)
93-
target_link_libraries(remote_block_reader_test test_common reader proto common connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
93+
target_link_libraries(remote_block_reader_test test_common reader proto common connection ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
9494
add_memcheck_test(remote_block_reader remote_block_reader_test)
9595

9696
add_executable(sasl_digest_md5_test sasl_digest_md5_test.cc)
97-
target_link_libraries(sasl_digest_md5_test common ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
97+
target_link_libraries(sasl_digest_md5_test common ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
9898
add_memcheck_test(sasl_digest_md5 sasl_digest_md5_test)
9999

100100
add_executable(retry_policy_test retry_policy_test.cc)
@@ -103,15 +103,15 @@ add_memcheck_test(retry_policy retry_policy_test)
103103

104104
include_directories(${CMAKE_CURRENT_BINARY_DIR})
105105
add_executable(rpc_engine_test rpc_engine_test.cc ${PROTO_TEST_SRCS} ${PROTO_TEST_HDRS})
106-
target_link_libraries(rpc_engine_test test_common rpc proto common ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
106+
target_link_libraries(rpc_engine_test test_common rpc proto common ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
107107
add_memcheck_test(rpc_engine rpc_engine_test)
108108

109109
add_executable(bad_datanode_test bad_datanode_test.cc)
110-
target_link_libraries(bad_datanode_test rpc reader proto fs bindings_c rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
110+
target_link_libraries(bad_datanode_test rpc reader proto fs bindings_c rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
111111
add_memcheck_test(bad_datanode bad_datanode_test)
112112

113113
add_executable(node_exclusion_test node_exclusion_test.cc)
114-
target_link_libraries(node_exclusion_test fs gmock_main common ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
114+
target_link_libraries(node_exclusion_test fs gmock_main common ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
115115
add_memcheck_test(node_exclusion node_exclusion_test)
116116

117117
add_executable(configuration_test $<TARGET_OBJECTS:test_utils> configuration_test.cc)
@@ -125,30 +125,30 @@ target_link_libraries(hdfs_configuration_test common gmock_main ${CMAKE_THREAD_L
125125
add_memcheck_test(hdfs_configuration hdfs_configuration_test)
126126

127127
add_executable(hdfspp_errors_test hdfspp_errors.cc)
128-
target_link_libraries(hdfspp_errors_test common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
128+
target_link_libraries(hdfspp_errors_test common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
129129
add_memcheck_test(hdfspp_errors hdfspp_errors_test)
130130

131131
add_executable(hdfs_builder_test $<TARGET_OBJECTS:test_utils> hdfs_builder_test.cc)
132132
target_include_directories(hdfs_builder_test PRIVATE ../lib)
133-
target_link_libraries(hdfs_builder_test test_common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
133+
target_link_libraries(hdfs_builder_test test_common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
134134
add_memcheck_test(hdfs_builder_test hdfs_builder_test)
135135

136136
add_executable(logging_test logging_test.cc $<TARGET_OBJECTS:x_platform_obj>)
137137
target_include_directories(logging_test PRIVATE ../lib)
138-
target_link_libraries(logging_test common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
138+
target_link_libraries(logging_test common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} gmock_main ${CMAKE_THREAD_LIBS_INIT})
139139
add_memcheck_test(logging_test logging_test)
140140

141141
add_executable(hdfs_ioservice_test hdfs_ioservice_test.cc)
142-
target_link_libraries(hdfs_ioservice_test fs gmock_main common ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
142+
target_link_libraries(hdfs_ioservice_test fs gmock_main common ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
143143
add_memcheck_test(hdfs_ioservice hdfs_ioservice_test)
144144

145145
add_executable(user_lock_test user_lock_test.cc)
146-
target_link_libraries(user_lock_test fs gmock_main common ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
146+
target_link_libraries(user_lock_test fs gmock_main common ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
147147
add_memcheck_test(user_lock user_lock_test)
148148

149149
add_executable(hdfs_config_connect_bugs_test $<TARGET_OBJECTS:test_utils> hdfs_config_connect_bugs.cc)
150150
target_include_directories(hdfs_config_connect_bugs_test PRIVATE ../lib)
151-
target_link_libraries(hdfs_config_connect_bugs_test common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
151+
target_link_libraries(hdfs_config_connect_bugs_test common gmock_main bindings_c fs rpc proto common reader connection ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} ${SASL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
152152
add_memcheck_test(hdfs_config_connect_bugs hdfs_config_connect_bugs_test)
153153

154154

@@ -178,22 +178,22 @@ add_dependencies(hdfspp_test_static proto)
178178
#TODO: Link against full library rather than just parts
179179

180180
build_libhdfs_test(libhdfs_threaded hdfspp_test_shim_static expect.c test_libhdfs_threaded.c ${OS_DIR}/thread.c)
181-
link_libhdfs_test(libhdfs_threaded hdfspp_test_shim_static fs reader rpc proto common connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} native_mini_dfs ${JAVA_JVM_LIBRARY} ${SASL_LIBRARIES} )
181+
link_libhdfs_test(libhdfs_threaded hdfspp_test_shim_static fs reader rpc proto common connection ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} native_mini_dfs ${JAVA_JVM_LIBRARY} ${SASL_LIBRARIES} )
182182
add_libhdfs_test (libhdfs_threaded hdfspp_test_shim_static)
183183

184184
build_libhdfs_test(hdfspp_mini_dfs_smoke hdfspp_test_shim_static ${CMAKE_CURRENT_LIST_DIR}/hdfspp_mini_dfs_smoke.cc)
185-
link_libhdfs_test (hdfspp_mini_dfs_smoke hdfspp_test_shim_static fs reader rpc proto common connection gmock_main ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} native_mini_dfs ${JAVA_JVM_LIBRARY} ${SASL_LIBRARIES})
185+
link_libhdfs_test (hdfspp_mini_dfs_smoke hdfspp_test_shim_static fs reader rpc proto common connection gmock_main ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} native_mini_dfs ${JAVA_JVM_LIBRARY} ${SASL_LIBRARIES})
186186
add_libhdfs_test (hdfspp_mini_dfs_smoke hdfspp_test_shim_static)
187187

188188
if (NOT MSVC)
189189
build_libhdfs_test(libhdfs_mini_stress_valgrind hdfspp_test_static expect.c test_libhdfs_mini_stress.c ${OS_DIR}/thread.c)
190-
link_libhdfs_test(libhdfs_mini_stress_valgrind hdfspp_test_static fs reader rpc proto common connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} native_mini_dfs ${JAVA_JVM_LIBRARY} ${SASL_LIBRARIES})
190+
link_libhdfs_test(libhdfs_mini_stress_valgrind hdfspp_test_static fs reader rpc proto common connection ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} native_mini_dfs ${JAVA_JVM_LIBRARY} ${SASL_LIBRARIES})
191191
add_memcheck_test(libhdfs_mini_stress_valgrind_hdfspp_test_static libhdfs_mini_stress_valgrind_hdfspp_test_static)
192192
set_target_properties(libhdfs_mini_stress_valgrind_hdfspp_test_static PROPERTIES COMPILE_DEFINITIONS "VALGRIND")
193193
endif (NOT MSVC)
194194

195195
build_libhdfs_test(libhdfs_mini_stress hdfspp_test_shim_static expect.c test_libhdfs_mini_stress.c ${OS_DIR}/thread.c)
196-
link_libhdfs_test(libhdfs_mini_stress hdfspp_test_shim_static fs reader rpc proto common connection ${PROTOBUF_LIBRARIES} ${OPENSSL_LIBRARIES} native_mini_dfs ${JAVA_JVM_LIBRARY} ${SASL_LIBRARIES})
196+
link_libhdfs_test(libhdfs_mini_stress hdfspp_test_shim_static fs reader rpc proto common connection ${PROTOBUF_LIBRARIES} ${protobuf_ABSL_USED_TARGETS} ${OPENSSL_LIBRARIES} native_mini_dfs ${JAVA_JVM_LIBRARY} ${SASL_LIBRARIES})
197197
add_libhdfs_test(libhdfs_mini_stress hdfspp_test_shim_static)
198198

199199
build_libhdfs_test(hdfs_ext hdfspp_test_shim_static ${CMAKE_CURRENT_LIST_DIR}/hdfs_ext_test.cc)

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/remote_block_reader_test.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ using ::testing::Return;
5858
using std::make_pair;
5959
using std::string;
6060

61-
namespace pb = ::google::protobuf;
62-
namespace pbio = pb::io;
61+
namespace pbio = ::google::protobuf::io;
6362

6463
namespace hdfs {
6564

@@ -114,7 +113,7 @@ class PartialMockReader : public BlockReaderImpl {
114113

115114
}
116115

117-
static inline string ToDelimitedString(const pb::MessageLite *msg) {
116+
static inline string ToDelimitedString(const google::protobuf::MessageLite *msg) {
118117
string res;
119118
res.reserve(hdfs::DelimitedPBMessageSize(msg));
120119
pbio::StringOutputStream os(&res);

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/rpc_engine_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ using ::testing::Return;
4848
using ::std::make_pair;
4949
using ::std::string;
5050

51-
namespace pb = ::google::protobuf;
5251
namespace pbio = ::google::protobuf::io;
5352

5453
namespace hdfs {

0 commit comments

Comments
 (0)