forked from mindspore-Ecosystem/mindspore
!14494 internal openssl stub for grpc & libevent
From: @zhoufeng54 Reviewed-by: @kisnwang,@xu-yfei Signed-off-by: @xu-yfei
This commit is contained in:
commit
c8107390d1
|
@ -56,10 +56,6 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
|
|||
find_required_program(tclsh)
|
||||
endif()
|
||||
|
||||
if(MS_BUILD_GRPC)
|
||||
find_required_package(OpenSSL)
|
||||
endif()
|
||||
|
||||
## packages used in GPU mode only
|
||||
if(ENABLE_GPU)
|
||||
find_library(gmp_LIB gmp)
|
||||
|
|
|
@ -30,9 +30,8 @@ else()
|
|||
endif()
|
||||
message("grpc using absl_DIR : " ${_FINDPACKAGE_ABSL_CONFIG_DIR})
|
||||
|
||||
set(_CMAKE_ARGS_OPENSSL_ROOT_DIR "")
|
||||
if(OPENSSL_ROOT_DIR)
|
||||
set(_CMAKE_ARGS_OPENSSL_ROOT_DIR "-DOPENSSL_ROOT_DIR:PATH=${OPENSSL_ROOT_DIR}")
|
||||
if(EXISTS ${openssl_ROOT})
|
||||
set(_CMAKE_ARGS_OPENSSL_ROOT_DIR "-DOPENSSL_ROOT_DIR:PATH=${openssl_ROOT}")
|
||||
endif()
|
||||
|
||||
if(ENABLE_GITEE)
|
||||
|
@ -77,10 +76,7 @@ target_link_libraries(grpc::grpc++ INTERFACE mindspore::z)
|
|||
target_link_libraries(grpc::grpc++ INTERFACE mindspore::cares)
|
||||
target_link_libraries(grpc::grpc++ INTERFACE mindspore::absl_strings mindspore::absl_throw_delegate
|
||||
mindspore::absl_raw_logging_internal mindspore::absl_int128 mindspore::absl_bad_optional_access)
|
||||
|
||||
# link system openssl
|
||||
find_package(OpenSSL REQUIRED)
|
||||
target_link_libraries(grpc::grpc++ INTERFACE OpenSSL::SSL OpenSSL::Crypto)
|
||||
target_link_libraries(grpc::grpc++ INTERFACE mindspore::ssl mindspore::crypto)
|
||||
|
||||
|
||||
function(ms_grpc_generate c_var h_var)
|
||||
|
|
|
@ -12,12 +12,14 @@ else()
|
|||
set(MD5 "b5333f021f880fe76490d8a799cd79f4")
|
||||
endif()
|
||||
|
||||
message("libevent using openssl stub dir: " ${openssl_ROOT})
|
||||
|
||||
mindspore_add_pkg(libevent
|
||||
VER 2.1.12
|
||||
LIBS event event_pthreads event_core
|
||||
URL ${REQ_URL}
|
||||
MD5 ${MD5}
|
||||
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING=OFF)
|
||||
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING=OFF -DOPENSSL_ROOT_DIR:PATH=${openssl_ROOT})
|
||||
|
||||
include_directories(${libevent_INC})
|
||||
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
if(ENABLE_GITEE)
|
||||
set(REQ_URL "https://gitee.com/mirrors/openssl/repository/archive/OpenSSL_1_1_0l.tar.gz")
|
||||
set(MD5 "9d18479e0cac8ff62f7e3df3cceb69dc")
|
||||
else()
|
||||
set(REQ_URL "https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_0l.tar.gz")
|
||||
set(MD5 "46d9a2a92fd39198501503b40954e6f0")
|
||||
endif()
|
||||
mindspore_add_pkg(openssl
|
||||
VER 1.1.0
|
||||
LIBS ssl crypto
|
||||
URL ${REQ_URL}
|
||||
MD5 ${MD5}
|
||||
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/openssl-stub/openssl-stub.patch001
|
||||
CONFIGURE_COMMAND ./config no-zlib)
|
||||
|
||||
include_directories(${openssl_INC})
|
||||
add_library(mindspore::ssl ALIAS openssl::ssl)
|
||||
add_library(mindspore::crypto ALIAS openssl::crypto)
|
|
@ -17,6 +17,7 @@ include(${CMAKE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake)
|
|||
|
||||
if(MS_BUILD_GRPC)
|
||||
# build dependencies of gRPC
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/openssl_stub.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/absl.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/c-ares.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/zlib.cmake)
|
||||
|
|
|
@ -1,11 +1,44 @@
|
|||
diff -Npur glog/CMakeLists.txt glog_modify/CMakeLists.txt
|
||||
diff -Npur glog/CMakeLists.txt glog-patch/CMakeLists.txt
|
||||
--- glog/CMakeLists.txt 2019-03-22 10:51:46.000000000 +0800
|
||||
+++ glog_modify/CMakeLists.txt 2021-03-07 16:58:38.386879400 +0800
|
||||
@@ -470,6 +470,7 @@ add_library (glog
|
||||
+++ glog-patch/CMakeLists.txt 2021-04-01 10:32:25.753140500 +0800
|
||||
@@ -64,7 +64,6 @@ check_include_file (dlfcn.h HAVE_DLFCN_H
|
||||
check_include_file (execinfo.h HAVE_EXECINFO_H)
|
||||
check_include_file (glob.h HAVE_GLOB_H)
|
||||
check_include_file (inttypes.h HAVE_INTTYPES_H)
|
||||
-check_include_file (libunwind.h HAVE_LIBUNWIND_H)
|
||||
check_include_file (memory.h HAVE_MEMORY_H)
|
||||
check_include_file (pwd.h HAVE_PWD_H)
|
||||
check_include_file (stdint.h HAVE_STDINT_H)
|
||||
@@ -80,7 +79,6 @@ check_include_file (syscall.h HAVE_SYSCA
|
||||
check_include_file (syslog.h HAVE_SYSLOG_H)
|
||||
check_include_file (ucontext.h HAVE_UCONTEXT_H)
|
||||
check_include_file (unistd.h HAVE_UNISTD_H)
|
||||
-check_include_file (unwind.h HAVE_UNWIND_H)
|
||||
check_include_file (pwd.h HAVE_PWD_H)
|
||||
|
||||
check_include_file_cxx ("ext/hash_map" HAVE_EXT_HASH_MAP)
|
||||
@@ -116,12 +114,8 @@ check_cxx_compiler_flag (-Wunnamed-type-
|
||||
# snprintf as an inline function
|
||||
check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
|
||||
|
||||
-check_library_exists (unwind get_static_proc_name "" HAVE_LIB_UNWIND)
|
||||
check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP)
|
||||
|
||||
-find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library")
|
||||
-mark_as_advanced (UNWIND_LIBRARY)
|
||||
-
|
||||
check_c_source_compiles ("
|
||||
#include <stdlib.h>
|
||||
static void foo(void) __attribute__ ((unused));
|
||||
@@ -470,10 +464,7 @@ add_library (glog
|
||||
add_library(glog::glog ALIAS glog)
|
||||
|
||||
set_target_properties (glog PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
-
|
||||
-if (UNWIND_LIBRARY)
|
||||
- target_link_libraries (glog PUBLIC ${UNWIND_LIBRARY})
|
||||
-endif (UNWIND_LIBRARY)
|
||||
+set_target_properties (glog PROPERTIES OUTPUT_NAME mindspore_glog)
|
||||
|
||||
if (UNWIND_LIBRARY)
|
||||
target_link_libraries (glog PUBLIC ${UNWIND_LIBRARY})
|
||||
if (HAVE_DBGHELP)
|
||||
target_link_libraries (glog PUBLIC dbghelp)
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
diff -Npur openssl-OpenSSL_1_1_0l/Makefile.shared openssl-OpenSSL_1_1_0l-patch/Makefile.shared
|
||||
--- openssl-OpenSSL_1_1_0l/Makefile.shared 2019-09-10 21:16:54.000000000 +0800
|
||||
+++ openssl-OpenSSL_1_1_0l-patch/Makefile.shared 2021-04-01 09:26:06.018179700 +0800
|
||||
@@ -154,7 +154,7 @@ LINK_SO_SHLIB_UNPACKED= \
|
||||
DETECT_GNU_LD=($(CC) -Wl,-V /dev/null 2>&1 | grep '^GNU ld' )>/dev/null
|
||||
|
||||
DO_GNU_SO_COMMON=\
|
||||
- SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$(SHLIBNAME_FULL)'
|
||||
+ SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$(SHLIBNAME)'
|
||||
DO_GNU_DSO=\
|
||||
$(DO_GNU_SO_COMMON)
|
||||
DO_GNU_SO=\
|
||||
@@ -181,7 +181,7 @@ link_app.gnu:
|
||||
link_shlib.linux-shared:
|
||||
@$(PERL) $(SRCDIR)/util/mkdef.pl $(LIBNAME) linux >$(LIBNAME).map; \
|
||||
$(DO_GNU_SO); \
|
||||
- ALLSYMSFLAGS='-Wl,--whole-archive,--version-script=$(LIBNAME).map'; \
|
||||
+ ALLSYMSFLAGS='-Wl,--whole-archive'; \
|
||||
$(LINK_SO_SHLIB)
|
||||
|
||||
link_dso.bsd:
|
||||
@@ -380,7 +380,7 @@ link_dso.irix:
|
||||
else \
|
||||
ALLSYMSFLAGS=''; \
|
||||
NOALLSYMSFLAGS=''; \
|
||||
- SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME_FULL),-B,symbolic'; \
|
||||
+ SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME),-B,symbolic'; \
|
||||
fi; \
|
||||
$(LINK_SO_DSO)
|
||||
link_shlib.irix:
|
||||
@@ -391,7 +391,7 @@ link_shlib.irix:
|
||||
($(CC) -v 2>&1 | grep gcc) > /dev/null && MINUSWL='-Wl,'; \
|
||||
ALLSYMSFLAGS="$${MINUSWL}-all"; \
|
||||
NOALLSYMSFLAGS="$${MINUSWL}-none"; \
|
||||
- SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME_FULL),-B,symbolic'; \
|
||||
+ SHAREDFLAGS='$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-soname,$(SHLIBNAME),-B,symbolic'; \
|
||||
fi; \
|
||||
$(LINK_SO_SHLIB)
|
||||
link_app.irix:
|
Loading…
Reference in New Issue