mcst-linux-kernel/patches-2024.06.26/hadoop-3.2.2/0004-cross-compiling-protoc...

33 lines
1.7 KiB
Diff

Subject: fix 'cannot execute binary' while cross compiling
Bug: 111656
Tags: cross
diff -rupN a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt 2022-05-24 23:44:35.349224970 +0300
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/proto/CMakeLists.txt 2022-05-25 00:30:11.342627478 +0300
@@ -37,8 +37,13 @@ protobuf_generate_cpp(PROTO_SRCS PROTO_H
${PROTO_HADOOP_DIR}/HAServiceProtocol.proto
)
-add_executable(protoc-gen-hrpc protoc_gen_hrpc.cc)
-target_link_libraries(protoc-gen-hrpc ${PROTOBUF_PROTOC_LIBRARY} ${PROTOBUF_LIBRARY})
+if(NOT CROSS_COMPILE)
+ add_executable(protoc-gen-hrpc protoc_gen_hrpc.cc)
+ target_link_libraries(protoc-gen-hrpc ${PROTOBUF_PROTOC_LIBRARY} ${PROTOBUF_LIBRARY})
+ set(PROTOC_GEN_HRPC ${CMAKE_CURRENT_BINARY_DIR}/protoc-gen-hrpc)
+else()
+ set(PROTOC_GEN_HRPC "$ENV{PROTOC_GEN_HRPC}")
+endif()
function(GEN_HRPC SRCS)
if(NOT ARGN)
@@ -67,7 +72,7 @@ function(GEN_HRPC SRCS)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.hrpc.inl"
COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
- ARGS --plugin=protoc-gen-hrpc=${CMAKE_CURRENT_BINARY_DIR}/protoc-gen-hrpc --hrpc_out=${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
+ ARGS --plugin=protoc-gen-hrpc=${PROTOC_GEN_HRPC} --hrpc_out=${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} protoc-gen-hrpc
COMMENT "Running HRPC protocol buffer compiler on ${FIL}"
VERBATIM )