From 5297a2dc4b2f22c07b9bfd5aef6190efd51de0bb Mon Sep 17 00:00:00 2001
From: 雾聪 <wucong.lyb@alibaba-inc.com>
Date: 星期四, 16 十一月 2023 11:12:45 +0800
Subject: [PATCH] Merge branch 'main' of https://github.com/alibaba-damo-academy/FunASR into main
---
runtime/onnxruntime/third_party/glog/src/logging.cc | 99 ---------
runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h | 0
runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in | 8
runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt | 18 +
runtime/docs/websocket_protocol_zh.md | 2
runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h | 2
runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc | 9
runtime/onnxruntime/third_party/glog/src/stacktrace.h | 2
runtime/onnxruntime/third_party/glog/src/config.h.cmake.in | 5
runtime/onnxruntime/third_party/glog/src/demangle.cc | 68 ------
runtime/onnxruntime/third_party/glog/src/glog/logging.h | 0
runtime/onnxruntime/CMakeLists.txt | 17 +
runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h | 0
runtime/onnxruntime/third_party/glog/src/raw_logging.cc | 13
runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in | 7
runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc | 12
runtime/python/libtorch/README.md | 14 +
runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h | 9
runtime/onnxruntime/third_party/glog/src/glog/export.h | 0
runtime/onnxruntime/src/bias-lm.cpp | 4
runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake | 2
runtime/onnxruntime/third_party/glog/src/config.h | 0
runtime/onnxruntime/src/CMakeLists.txt | 1
runtime/websocket/CMakeLists.txt | 4
runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h | 0
runtime/python/onnxruntime/README.md | 2
runtime/onnxruntime/third_party/glog/CMakeLists.txt | 148 ++++++--------
runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake | 18 +
runtime/onnxruntime/third_party/glog/src/glog/logging.h.in | 65 +++---
runtime/onnxruntime/third_party/glog/src/utilities.cc | 2
runtime/onnxruntime/third_party/glog/src/demangle.h | 2
runtime/onnxruntime/third_party/glog/src/symbolize.h | 4
runtime/onnxruntime/third_party/glog/src/signalhandler.cc | 10
runtime/onnxruntime/third_party/glog/src/utilities.h | 9
runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h | 2
runtime/onnxruntime/third_party/glog/src/mock-log.h | 7
runtime/onnxruntime/third_party/glog/src/symbolize.cc | 4
37 files changed, 219 insertions(+), 350 deletions(-)
diff --git a/runtime/docs/websocket_protocol_zh.md b/runtime/docs/websocket_protocol_zh.md
index cfba8f2..60ff100 100644
--- a/runtime/docs/websocket_protocol_zh.md
+++ b/runtime/docs/websocket_protocol_zh.md
@@ -66,7 +66,7 @@
```text
`mode`锛歚offline`锛岃〃绀烘帹鐞嗘ā寮忎负涓�鍙ヨ瘽璇嗗埆锛沗online`锛岃〃绀烘帹鐞嗘ā寮忎负瀹炴椂璇煶璇嗗埆锛沗2pass`锛氳〃绀轰负瀹炴椂璇煶璇嗗埆锛屽苟涓旇璇濆彞灏鹃噰鐢ㄧ绾挎ā鍨嬭繘琛岀籂閿欍��
`wav_name`锛氳〃绀洪渶瑕佹帹鐞嗛煶棰戞枃浠跺悕
-`wav_format`锛氳〃绀洪煶瑙嗛鏂囦欢鍚庣紑鍚嶏紝鍙�塸cm銆乵p3銆乵p4绛夛紙澶囨敞锛�1.0鐗堟湰鍙敮鎸乸cm闊抽娴侊級
+`wav_format`锛氳〃绀洪煶瑙嗛鏂囦欢鍚庣紑鍚嶏紝鍙�塸cm銆乵p3銆乵p4绛夛紙澶囨敞锛氬彧鏀寔pcm闊抽娴侊級
`is_speaking`锛氳〃绀烘柇鍙ュ熬鐐癸紝渚嬪锛寁ad鍒囧壊鐐癸紝鎴栬�呬竴鏉av缁撴潫
`chunk_size`锛氳〃绀烘祦寮忔ā鍨媗atency閰嶇疆锛宍[5,10,5]`锛岃〃绀哄綋鍓嶉煶棰戜负600ms锛屽苟涓斿洖鐪�300ms锛屽張鐪�300ms銆�
`audio_fs`锛氬綋杈撳叆闊抽涓簆cm鏁版嵁鏄紝闇�瑕佸姞涓婇煶棰戦噰鏍风巼鍙傛暟
diff --git a/runtime/onnxruntime/CMakeLists.txt b/runtime/onnxruntime/CMakeLists.txt
index f91655d..3450be7 100644
--- a/runtime/onnxruntime/CMakeLists.txt
+++ b/runtime/onnxruntime/CMakeLists.txt
@@ -20,12 +20,12 @@
# for onnxruntime
IF(WIN32)
-# file(REMOVE ${PROJECT_SOURCE_DIR}/third_party/glog/src/config.h
-# ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/export.h
-# ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/logging.h
-# ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/raw_logging.h
-# ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/stl_logging.h
-# ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/vlog_is_on.h)
+ file(REMOVE ${PROJECT_SOURCE_DIR}/third_party/glog/src/config.h
+ ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/export.h
+ ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/logging.h
+ ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/raw_logging.h
+ ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/stl_logging.h
+ ${PROJECT_SOURCE_DIR}/third_party/glog/src/glog/vlog_is_on.h)
ELSE()
link_directories(${ONNXRUNTIME_DIR}/lib)
link_directories(${FFMPEG_DIR}/lib)
@@ -55,7 +55,10 @@
# with some patch to fix the make errors.
add_subdirectory(third_party/openfst)
include_directories(${openfst_SOURCE_DIR}/src/include)
-
+ if(WIN32)
+ include_directories(${openfst_SOURCE_DIR}/src/lib)
+ endif()
+
endif()
add_subdirectory(third_party/yaml-cpp)
diff --git a/runtime/onnxruntime/src/CMakeLists.txt b/runtime/onnxruntime/src/CMakeLists.txt
index 1a2ca63..9eac2b6 100644
--- a/runtime/onnxruntime/src/CMakeLists.txt
+++ b/runtime/onnxruntime/src/CMakeLists.txt
@@ -7,6 +7,7 @@
if(WIN32)
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/execution-charset:utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/source-charset:utf-8>")
+add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/bigobj>")
endif()
add_library(funasr SHARED ${files})
diff --git a/runtime/onnxruntime/src/bias-lm.cpp b/runtime/onnxruntime/src/bias-lm.cpp
index 5be87f8..a652f29 100644
--- a/runtime/onnxruntime/src/bias-lm.cpp
+++ b/runtime/onnxruntime/src/bias-lm.cpp
@@ -1,5 +1,7 @@
#include "bias-lm.h"
-
+#ifdef _WIN32
+#include "fst-types.cc"
+#endif
namespace funasr {
void print(std::queue<StateId> &q) {
std::queue<StateId> data = q;
diff --git a/runtime/onnxruntime/third_party/glog/CMakeLists.txt b/runtime/onnxruntime/third_party/glog/CMakeLists.txt
index b6b3a1a..f5c1e55 100644
--- a/runtime/onnxruntime/third_party/glog/CMakeLists.txt
+++ b/runtime/onnxruntime/third_party/glog/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.21)
+cmake_minimum_required (VERSION 3.16)
project (glog
VERSION 0.7.0
DESCRIPTION "C++ implementation of the Google logging module"
@@ -131,7 +131,6 @@
check_cxx_symbol_exists (backtrace execinfo.h HAVE_EXECINFO_BACKTRACE)
check_cxx_symbol_exists (backtrace_symbols execinfo.h
HAVE_EXECINFO_BACKTRACE_SYMBOLS)
-check_cxx_symbol_exists (_chsize_s io.h HAVE__CHSIZE_S)
# NOTE gcc does not fail if you pass a non-existent -Wno-* option as an
# argument. However, it will happily fail if you pass the corresponding -W*
@@ -214,61 +213,50 @@
endif (WITH_TLS)
set (_PC_FIELDS
- "uc_mcontext.gregs[REG_PC]" # Solaris x86 (32 + 64 bit)
- "uc_mcontext.gregs[REG_EIP]" # Linux (i386)
- "uc_mcontext.gregs[REG_RIP]" # Linux (x86_64)
- "uc_mcontext.sc_ip" # Linux (ia64)
- "uc_mcontext.pc" # Linux (mips)
- "uc_mcontext.uc_regs->gregs[PT_NIP]" # Linux (ppc)
- "uc_mcontext.gregs[R15]" # Linux (arm old [untested])
- "uc_mcontext.arm_pc" # Linux (arm arch 5)
- "uc_mcontext.gp_regs[PT_NIP]" # Suse SLES 11 (ppc64)
- "uc_mcontext.mc_eip" # FreeBSD (i386)
- "uc_mcontext.mc_rip" # FreeBSD (x86_64 [untested])
- "uc_mcontext.__gregs[_REG_EIP]" # NetBSD (i386)
- "uc_mcontext.__gregs[_REG_RIP]" # NetBSD (x86_64)
- "uc_mcontext->ss.eip" # OS X (i386, <=10.4)
- "uc_mcontext->__ss.__eip" # OS X (i386, >=10.5)
- "uc_mcontext->ss.rip" # OS X (x86_64)
- "uc_mcontext->__ss.__rip" # OS X (>=10.5 [untested])
- "uc_mcontext->ss.srr0" # OS X (ppc, ppc64 [untested])
- "uc_mcontext->__ss.__srr0" # OS X (>=10.5 [untested])
+ "gregs[REG_PC]"
+ "gregs[REG_EIP]"
+ "gregs[REG_RIP]"
+ "sc_ip"
+ "uc_regs->gregs[PT_NIP]"
+ "gregs[R15]"
+ "arm_pc"
+ "mc_eip"
+ "mc_rip"
+ "__gregs[REG_EIP]"
+ "__gregs[REG_RIP]"
+ "ss.eip"
+ "__ss.__eip"
+ "ss.rip"
+ "__ss.__rip"
+ "ss.srr0"
+ "__ss.__srr0"
)
-if (HAVE_UCONTEXT_H AND NOT DEFINED PC_FROM_UCONTEXT)
- cmake_push_check_state (RESET)
+set (_PC_HEADERS ucontext.h signal.h)
- set (CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
- set (_PC_HEADERS ucontext.h signal.h)
+if (HAVE_UCONTEXT_H AND NOT PC_FROM_UCONTEXT)
+ foreach (_PC_FIELD ${_PC_FIELDS})
+ foreach (_PC_HEADER ${_PC_HEADERS})
+ set (_TMP
+ ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/uctfield.cpp)
+ file (WRITE ${_TMP} "
+#define _GNU_SOURCE 1
+#include <${_PC_HEADER}>
+int main(void)
+{
+ ucontext_t u;
+ return u.${_PC_FIELD} == 0;
+}
+")
+ try_compile (HAVE_PC_FROM_UCONTEXT ${CMAKE_CURRENT_BINARY_DIR} ${_TMP}
+ COMPILE_DEFINITIONS _GNU_SOURCE=1)
- foreach (_PC_FIELD IN LISTS _PC_FIELDS)
- foreach (_PC_HEADER IN LISTS _PC_HEADERS)
- # Replace non-alphanumeric characters by underscores since the name will be
- # used as preprocessor definition.
- string (REGEX REPLACE "[^a-zA-Z0-9]" "_" HAVE_UCONTEXT_FIELD_NAME
- "HAVE_PC_FROM_UCONTEXT_${_PC_FIELD}")
- # Strip trailing underscores for readability
- string (REGEX REPLACE "_+$" "" HAVE_UCONTEXT_FIELD_NAME
- "${HAVE_UCONTEXT_FIELD_NAME}")
-
- check_struct_has_member (ucontext_t ${_PC_FIELD} ${_PC_HEADER}
- ${HAVE_UCONTEXT_FIELD_NAME} LANGUAGE CXX)
-
- if (${HAVE_UCONTEXT_FIELD_NAME})
- set (PC_FROM_UCONTEXT ${_PC_FIELD} CACHE STRING
- "<${_PC_HEADER}> ucontext_t PC member")
- mark_as_advanced (PC_FROM_UCONTEXT)
- break ()
- endif (${HAVE_UCONTEXT_FIELD_NAME})
+ if (HAVE_PC_FROM_UCONTEXT)
+ set (PC_FROM_UCONTEXT ${_PC_FIELD} CACHE)
+ endif (HAVE_PC_FROM_UCONTEXT)
endforeach (_PC_HEADER)
-
- if (${HAVE_UCONTEXT_FIELD_NAME})
- break ()
- endif (${HAVE_UCONTEXT_FIELD_NAME})
endforeach (_PC_FIELD)
-
- cmake_pop_check_state ()
-endif (HAVE_UCONTEXT_H AND NOT DEFINED PC_FROM_UCONTEXT)
+endif (HAVE_UCONTEXT_H AND NOT PC_FROM_UCONTEXT)
set (GOOGLE_NAMESPACE google)
set (_START_GOOGLE_NAMESPACE_ "namespace ${GOOGLE_NAMESPACE} {")
@@ -480,13 +468,16 @@
src/demangle.h
src/logging.cc
src/raw_logging.cc
- src/signalhandler.cc
src/symbolize.cc
src/symbolize.h
src/utilities.cc
src/utilities.h
src/vlog_is_on.cc
)
+
+if (HAVE_PTHREAD OR WIN32 OR CYGWIN)
+ list (APPEND GLOG_SRCS src/signalhandler.cc)
+endif (HAVE_PTHREAD OR WIN32 OR CYGWIN)
if (CYGWIN OR WIN32)
list (APPEND GLOG_SRCS
@@ -500,20 +491,9 @@
${GLOG_SRCS}
)
target_compile_features (glog_internal PUBLIC $<TARGET_PROPERTY:glog,COMPILE_FEATURES>)
-set_target_properties (glog_internal PROPERTIES DEFINE_SYMBOL GOOGLE_GLOG_IS_A_DLL)
-
-# Some generators (such as Xcode) do not generate any output if the target does
-# not reference at least one source file.
-set (_glog_EMPTY_SOURCE ${glog_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/glog.cc)
-
-add_custom_command (
- OUTPUT ${_glog_EMPTY_SOURCE}
- COMMAND ${CMAKE_COMMAND} -E touch ${_glog_EMPTY_SOURCE}
-)
add_library (glog
$<TARGET_OBJECTS:glog_internal>
- ${_glog_EMPTY_SOURCE}
)
target_compile_features (glog PUBLIC cxx_std_14)
@@ -635,30 +615,38 @@
endif (NOT WITH_FUZZING STREQUAL "none")
if (BUILD_TESTING)
- add_library (glog_test INTERFACE)
- target_link_libraries (glog_test INTERFACE $<TARGET_OBJECTS:glog_internal> $<TARGET_PROPERTY:glog,LINK_LIBRARIES>)
- target_compile_definitions (glog_test INTERFACE GLOG_STATIC_DEFINE $<TARGET_PROPERTY:glog,COMPILE_DEFINITIONS>)
- target_include_directories (glog_test INTERFACE $<TARGET_PROPERTY:glog,INCLUDE_DIRECTORIES>)
+ add_library (glogtest STATIC
+ $<TARGET_OBJECTS:glog_internal>
+ )
+
+ target_include_directories (glogtest PUBLIC
+ $<TARGET_PROPERTY:glog,INCLUDE_DIRECTORIES>)
+ target_compile_definitions (glogtest PUBLIC
+ $<TARGET_PROPERTY:glog,COMPILE_DEFINITIONS> GLOG_STATIC_DEFINE)
+ target_link_libraries (glogtest PUBLIC
+ $<TARGET_PROPERTY:glog,LINK_LIBRARIES>)
+
+ set (_GLOG_TEST_LIBS glogtest)
if (HAVE_LIB_GTEST)
- target_link_libraries (glog_test INTERFACE GTest::gtest)
+ list (APPEND _GLOG_TEST_LIBS GTest::gtest)
endif (HAVE_LIB_GTEST)
if (HAVE_LIB_GMOCK)
- target_link_libraries (glog_test INTERFACE GTest::gmock)
+ list (APPEND _GLOG_TEST_LIBS GTest::gmock)
endif (HAVE_LIB_GMOCK)
add_executable (logging_unittest
src/logging_unittest.cc
)
- target_link_libraries (logging_unittest PRIVATE glog_test)
+ target_link_libraries (logging_unittest PRIVATE ${_GLOG_TEST_LIBS})
add_executable (stl_logging_unittest
src/stl_logging_unittest.cc
)
- target_link_libraries (stl_logging_unittest PRIVATE glog_test)
+ target_link_libraries (stl_logging_unittest PRIVATE ${_GLOG_TEST_LIBS})
if (HAVE_NO_DEPRECATED)
set_property (TARGET stl_logging_unittest APPEND PROPERTY COMPILE_OPTIONS
@@ -675,35 +663,35 @@
src/symbolize_unittest.cc
)
- target_link_libraries (symbolize_unittest PRIVATE glog_test)
+ target_link_libraries (symbolize_unittest PRIVATE ${_GLOG_TEST_LIBS})
endif (HAVE_SYMBOLIZE)
add_executable (demangle_unittest
src/demangle_unittest.cc
)
- target_link_libraries (demangle_unittest PRIVATE glog_test)
+ target_link_libraries (demangle_unittest PRIVATE ${_GLOG_TEST_LIBS})
if (HAVE_STACKTRACE)
add_executable (stacktrace_unittest
src/stacktrace_unittest.cc
)
- target_link_libraries (stacktrace_unittest PRIVATE glog_test)
+ target_link_libraries (stacktrace_unittest PRIVATE ${_GLOG_TEST_LIBS})
endif (HAVE_STACKTRACE)
add_executable (utilities_unittest
src/utilities_unittest.cc
)
- target_link_libraries (utilities_unittest PRIVATE glog_test)
+ target_link_libraries (utilities_unittest PRIVATE ${_GLOG_TEST_LIBS})
if (HAVE_STACKTRACE AND HAVE_SYMBOLIZE)
add_executable (signalhandler_unittest
src/signalhandler_unittest.cc
)
- target_link_libraries (signalhandler_unittest PRIVATE glog_test)
+ target_link_libraries (signalhandler_unittest PRIVATE ${_GLOG_TEST_LIBS})
endif (HAVE_STACKTRACE AND HAVE_SYMBOLIZE)
add_test (NAME demangle COMMAND demangle_unittest)
@@ -749,7 +737,7 @@
src/mock-log.h
)
- target_link_libraries (mock-log_unittest PRIVATE glog_test)
+ target_link_libraries (mock-log_unittest PRIVATE ${_GLOG_TEST_LIBS})
add_test (NAME mock-log COMMAND mock-log_unittest)
endif (HAVE_LIB_GMOCK)
@@ -811,17 +799,17 @@
add_executable (cleanup_immediately_unittest
src/cleanup_immediately_unittest.cc)
- target_link_libraries (cleanup_immediately_unittest PRIVATE glog_test)
+ target_link_libraries (cleanup_immediately_unittest PRIVATE ${_GLOG_TEST_LIBS})
add_executable (cleanup_with_absolute_prefix_unittest
src/cleanup_with_absolute_prefix_unittest.cc)
- target_link_libraries (cleanup_with_absolute_prefix_unittest PRIVATE glog_test)
+ target_link_libraries (cleanup_with_absolute_prefix_unittest PRIVATE ${_GLOG_TEST_LIBS})
add_executable (cleanup_with_relative_prefix_unittest
src/cleanup_with_relative_prefix_unittest.cc)
- target_link_libraries (cleanup_with_relative_prefix_unittest PRIVATE glog_test)
+ target_link_libraries (cleanup_with_relative_prefix_unittest PRIVATE ${_GLOG_TEST_LIBS})
set (CLEANUP_LOG_DIR ${CMAKE_CURRENT_BINARY_DIR}/cleanup_tests)
diff --git a/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake b/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake
index 76f2b16..ead3589 100644
--- a/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake
+++ b/runtime/onnxruntime/third_party/glog/cmake/GetCacheVariables.cmake
@@ -1,5 +1,5 @@
cmake_policy (PUSH)
-cmake_policy (VERSION 3.16...3.27)
+cmake_policy (VERSION 3.3)
include (CMakeParseArguments)
diff --git a/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake b/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake
index 2b66c23..97244ab 100644
--- a/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake
+++ b/runtime/onnxruntime/third_party/glog/cmake/TestPackageConfig.cmake
@@ -1,3 +1,13 @@
+# Create the build directory
+execute_process (
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${TEST_BINARY_DIR}
+ RESULT_VARIABLE _DIRECTORY_CREATED_SUCCEEDED
+)
+
+if (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
+ message (FATAL_ERROR "Failed to create build directory")
+endif (NOT _DIRECTORY_CREATED_SUCCEEDED EQUAL 0)
+
if (GENERATOR_TOOLSET)
list (APPEND _ADDITIONAL_ARGS -T ${GENERATOR_TOOLSET})
endif (GENERATOR_TOOLSET)
@@ -11,7 +21,7 @@
# Capture the PATH environment variable content set during project generation
# stage. This is required because later during the build stage the PATH is
# modified again (e.g., for MinGW AppVeyor CI builds) by adding back the
- # directory containing git.exe. Incidentally, the Git installation directory
+ # directory containing git.exe. Incidently, the Git installation directory
# also contains sh.exe which causes MinGW Makefile generation to fail.
COMMAND ${CMAKE_COMMAND} -E env PATH=${PATH}
${CMAKE_COMMAND} -C ${INITIAL_CACHE}
@@ -19,9 +29,9 @@
${_ADDITIONAL_ARGS}
-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON
-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON
- -Dglog_ROOT=${PACKAGE_DIR}
- -S ${SOURCE_DIR}
- -B ${TEST_BINARY_DIR}
+ -DCMAKE_PREFIX_PATH=${PACKAGE_DIR}
+ ${SOURCE_DIR}
+ WORKING_DIRECTORY ${TEST_BINARY_DIR}
RESULT_VARIABLE _GENERATE_SUCCEEDED
)
diff --git a/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h b/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h
index 66c0dae..c011df4 100644
--- a/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h
+++ b/runtime/onnxruntime/third_party/glog/src/base/commandlineflags.h
@@ -59,7 +59,7 @@
#else
-#include "glog/logging.h"
+#include <glog/logging.h>
#define DECLARE_VARIABLE(type, shorttype, name, tn) \
namespace fL##shorttype { \
@@ -140,12 +140,9 @@
: memchr("tTyY1\0", getenv(envname)[0], 6) != nullptr)
#define EnvToInt(envname, dflt) \
- (!getenv(envname) ? (dflt) \
- : static_cast<int>(strtol(getenv(envname), nullptr, 10)))
+ (!getenv(envname) ? (dflt) : strtol(getenv(envname), nullptr, 10))
#define EnvToUInt(envname, dflt) \
- (!getenv(envname) \
- ? (dflt) \
- : static_cast<unsigned>(strtoul(getenv(envname), nullptr, 10)))
+ (!getenv(envname) ? (dflt) : strtoul(getenv(envname), nullptr, 10))
#endif // BASE_COMMANDLINEFLAGS_H__
diff --git a/runtime/onnxruntime/third_party/glog/src/config.h.macos b/runtime/onnxruntime/third_party/glog/src/config.h
similarity index 100%
rename from runtime/onnxruntime/third_party/glog/src/config.h.macos
rename to runtime/onnxruntime/third_party/glog/src/config.h
diff --git a/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in b/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in
index 3fed2a6..9d61010 100644
--- a/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in
+++ b/runtime/onnxruntime/third_party/glog/src/config.h.cmake.in
@@ -130,15 +130,12 @@
/* define if gmtime_r is available in time.h */
#cmakedefine HAVE_GMTIME_R
-/* define if _chsize_s is available in io.h */
-#cmakedefine HAVE__CHSIZE_S
-
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#cmakedefine LT_OBJDIR
/* How to access the PC from a struct ucontext */
-#cmakedefine PC_FROM_UCONTEXT ${PC_FROM_UCONTEXT}
+#cmakedefine PC_FROM_UCONTEXT
/* define if we should print file offsets in traces instead of symbolizing. */
#cmakedefine PRINT_UNSYMBOLIZED_STACK_TRACES
diff --git a/runtime/onnxruntime/third_party/glog/src/demangle.cc b/runtime/onnxruntime/third_party/glog/src/demangle.cc
index 74dff70..b19d446 100644
--- a/runtime/onnxruntime/third_party/glog/src/demangle.cc
+++ b/runtime/onnxruntime/third_party/glog/src/demangle.cc
@@ -36,9 +36,7 @@
#include "demangle.h"
-#include <cstddef>
#include <cstdio> // for nullptr
-#include <limits>
#include "utilities.h"
@@ -111,9 +109,6 @@
short nest_level; // For nested names.
bool append; // Append flag.
bool overflowed; // True if output gets overflowed.
- uint32 local_level;
- uint32 expr_level;
- uint32 arg_level;
};
// We don't use strlen() in libc since it's not guaranteed to be async
@@ -158,9 +153,6 @@
state->nest_level = -1;
state->append = true;
state->overflowed = false;
- state->local_level = 0;
- state->expr_level = 0;
- state->arg_level = 0;
}
// Returns true and advances "mangled_cur" if we find "one_char_token"
@@ -229,10 +221,6 @@
// is set to true for later use. The output string is ensured to
// always terminate with '\0' as long as there is no overflow.
static void Append(State *state, const char * const str, ssize_t length) {
- if (state->out_cur == nullptr) {
- state->overflowed = true;
- return;
- }
for (ssize_t i = 0; i < length; ++i) {
if (state->out_cur + 1 < state->out_end) { // +1 for '\0'
*state->out_cur = str[i];
@@ -306,7 +294,7 @@
}
}
-// A convenient wrapper around MaybeAppendWithLength().
+// A convenient wrapper arount MaybeAppendWithLength().
static bool MaybeAppend(State *state, const char * const str) {
if (state->append) {
size_t length = StrLen(str);
@@ -604,23 +592,9 @@
}
const char *p = state->mangled_cur;
int number = 0;
- constexpr int int_max_by_10 = std::numeric_limits<int>::max() / 10;
for (;*p != '\0'; ++p) {
if (IsDigit(*p)) {
- // Prevent signed integer overflow when multiplying
- if (number > int_max_by_10) {
- return false;
- }
-
- const int digit = *p - '0';
- const int shifted = number * 10;
-
- // Prevent signed integer overflow when summing
- if (digit > std::numeric_limits<int>::max() - shifted) {
- return false;
- }
-
- number = shifted + digit;
+ number = number * 10 + (*p - '0');
} else {
break;
}
@@ -677,10 +651,6 @@
MaybeAppend(state, "(anonymous namespace)");
} else {
MaybeAppendWithLength(state, state->mangled_cur, length);
- }
- if (length < 0 ||
- static_cast<std::size_t>(length) > StrLen(state->mangled_cur)) {
- return false;
}
state->mangled_cur += length;
return true;
@@ -1097,33 +1067,22 @@
// ::= J <template-arg>* E # argument pack
// ::= X <expression> E
static bool ParseTemplateArg(State *state) {
- // Avoid recursion above max_levels
- constexpr uint32 max_levels = 5;
-
- if (state->arg_level > max_levels) {
- return false;
- }
- ++state->arg_level;
-
State copy = *state;
if ((ParseOneCharToken(state, 'I') || ParseOneCharToken(state, 'J')) &&
ZeroOrMore(ParseTemplateArg, state) &&
ParseOneCharToken(state, 'E')) {
- --state->arg_level;
return true;
}
*state = copy;
if (ParseType(state) ||
ParseExprPrimary(state)) {
- --state->arg_level;
return true;
}
*state = copy;
if (ParseOneCharToken(state, 'X') && ParseExpression(state) &&
ParseOneCharToken(state, 'E')) {
- --state->arg_level;
return true;
}
*state = copy;
@@ -1144,20 +1103,11 @@
return true;
}
- // Avoid recursion above max_levels
- constexpr uint32 max_levels = 5;
-
- if (state->expr_level > max_levels) {
- return false;
- }
- ++state->expr_level;
-
State copy = *state;
if (ParseOperatorName(state) &&
ParseExpression(state) &&
ParseExpression(state) &&
ParseExpression(state)) {
- --state->expr_level;
return true;
}
*state = copy;
@@ -1165,35 +1115,30 @@
if (ParseOperatorName(state) &&
ParseExpression(state) &&
ParseExpression(state)) {
- --state->expr_level;
return true;
}
*state = copy;
if (ParseOperatorName(state) &&
ParseExpression(state)) {
- --state->expr_level;
return true;
}
*state = copy;
if (ParseTwoCharToken(state, "st") && ParseType(state)) {
return true;
- --state->expr_level;
}
*state = copy;
if (ParseTwoCharToken(state, "sr") && ParseType(state) &&
ParseUnqualifiedName(state) &&
ParseTemplateArgs(state)) {
- --state->expr_level;
return true;
}
*state = copy;
if (ParseTwoCharToken(state, "sr") && ParseType(state) &&
ParseUnqualifiedName(state)) {
- --state->expr_level;
return true;
}
*state = copy;
@@ -1239,25 +1184,16 @@
// [<discriminator>]
// := Z <(function) encoding> E s [<discriminator>]
static bool ParseLocalName(State *state) {
- // Avoid recursion above max_levels
- constexpr uint32 max_levels = 5;
- if (state->local_level > max_levels) {
- return false;
- }
- ++state->local_level;
-
State copy = *state;
if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) &&
ParseOneCharToken(state, 'E') && MaybeAppend(state, "::") &&
ParseName(state) && Optional(ParseDiscriminator(state))) {
- --state->local_level;
return true;
}
*state = copy;
if (ParseOneCharToken(state, 'Z') && ParseEncoding(state) &&
ParseTwoCharToken(state, "Es") && Optional(ParseDiscriminator(state))) {
- --state->local_level;
return true;
}
*state = copy;
diff --git a/runtime/onnxruntime/third_party/glog/src/demangle.h b/runtime/onnxruntime/third_party/glog/src/demangle.h
index 416f7ee..f347b98 100644
--- a/runtime/onnxruntime/third_party/glog/src/demangle.h
+++ b/runtime/onnxruntime/third_party/glog/src/demangle.h
@@ -71,7 +71,7 @@
#define BASE_DEMANGLE_H_
#include "config.h"
-#include "glog/logging.h"
+#include <glog/logging.h>
_START_GOOGLE_NAMESPACE_
diff --git a/runtime/onnxruntime/third_party/glog/src/glog/export.h.macos b/runtime/onnxruntime/third_party/glog/src/glog/export.h
similarity index 100%
rename from runtime/onnxruntime/third_party/glog/src/glog/export.h.macos
rename to runtime/onnxruntime/third_party/glog/src/glog/export.h
diff --git a/runtime/onnxruntime/third_party/glog/src/glog/logging.h.macos b/runtime/onnxruntime/third_party/glog/src/glog/logging.h
similarity index 100%
rename from runtime/onnxruntime/third_party/glog/src/glog/logging.h.macos
rename to runtime/onnxruntime/third_party/glog/src/glog/logging.h
diff --git a/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in b/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in
index 0a7ebd2..e8e6c41 100644
--- a/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in
+++ b/runtime/onnxruntime/third_party/glog/src/glog/logging.h.in
@@ -60,10 +60,10 @@
#define GLOG_MSVC_POP_WARNING()
#endif
-#include "glog/platform.h"
+#include <glog/platform.h>
#if @ac_cv_have_glog_export@
-#include "glog/export.h"
+#include <glog/export.h>
#endif
// We care a lot about number of bits things take up. Unfortunately,
@@ -290,11 +290,11 @@
// "program with --v=1 or more";
// VLOG_EVERY_N(1, 10)
// << "I'm printed every 10th occurrence, and when you run the program "
-// "with --v=1 or more. Present occurrence is " << google::COUNTER;
+// "with --v=1 or more. Present occurence is " << google::COUNTER;
// VLOG_IF_EVERY_N(1, (size > 1024), 10)
-// << "I'm printed on every 10th occurrence of case when size is more "
+// << "I'm printed on every 10th occurence of case when size is more "
// " than 1024, when you run the program with --v=1 or more. ";
-// "Present occurrence is " << google::COUNTER;
+// "Present occurence is " << google::COUNTER;
//
// The supported severity levels for macros that allow you to specify one
// are (in increasing order of severity) INFO, WARNING, ERROR, and FATAL.
@@ -470,9 +470,6 @@
// Use UTC time for logging
DECLARE_bool(log_utc_time);
-// Mailer used to send logging email
-DECLARE_string(logmailer);
-
// Log messages below the GOOGLE_STRIP_LOG level will be compiled away for
// security reasons. See LOG(severtiy) below.
@@ -599,8 +596,8 @@
@ac_google_start_namespace@
// They need the definitions of integer types.
-#include "glog/log_severity.h"
-#include "glog/vlog_is_on.h"
+#include <glog/log_severity.h>
+#include <glog/vlog_is_on.h>
// Initialize google's logging library. You will see the program name
// specified by argv0 in log outputs.
@@ -845,7 +842,7 @@
#define CHECK_OP_LOG(name, op, val1, val2, log) CHECK((val1) op (val2))
#elif DCHECK_IS_ON()
// In debug mode, avoid constructing CheckOpStrings if possible,
-// to reduce the overhead of CHECK statements by 2x.
+// to reduce the overhead of CHECK statments by 2x.
// Real DCHECK-heavy tests have seen 1.5x speedups.
// The meaning of "string" might be different between now and
@@ -1045,13 +1042,13 @@
constexpr std::chrono::nanoseconds LOG_TIME_PERIOD = \
std::chrono::duration_cast<std::chrono::nanoseconds>( \
std::chrono::duration<double>(seconds)); \
- static std::atomic<@ac_google_namespace@::int64> LOG_PREVIOUS_TIME_RAW; \
+ static std::atomic<@ac_google_namespace@ ::int64> LOG_PREVIOUS_TIME_RAW; \
GLOG_IFDEF_THREAD_SANITIZER( \
AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_TIME_PERIOD, \
- sizeof(@ac_google_namespace@::int64), "")); \
+ sizeof(@ac_google_namespace @ ::int64), "")); \
GLOG_IFDEF_THREAD_SANITIZER( \
AnnotateBenignRaceSized(__FILE__, __LINE__, &LOG_PREVIOUS_TIME_RAW, \
- sizeof(@ac_google_namespace@::int64), "")); \
+ sizeof(@ac_google_namespace @ ::int64), "")); \
const auto LOG_CURRENT_TIME = \
std::chrono::duration_cast<std::chrono::nanoseconds>( \
std::chrono::steady_clock::now().time_since_epoch()); \
@@ -1065,8 +1062,8 @@
.count(), \
std::memory_order_relaxed); \
if (LOG_TIME_DELTA > LOG_TIME_PERIOD) \
- @ac_google_namespace@::LogMessage( \
- __FILE__, __LINE__, @ac_google_namespace@::GLOG_##severity) \
+ @ac_google_namespace@ ::LogMessage( \
+ __FILE__, __LINE__, @ac_google_namespace@ ::GLOG_##severity) \
.stream()
#define SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \
@@ -1347,15 +1344,6 @@
class GLOG_EXPORT LogStream : public std::ostream {
GLOG_MSVC_POP_WARNING()
public:
-#if defined __has_attribute
-# if __has_attribute (used)
- // In some cases, like when compiling glog as a static library with GCC and
- // linking against a Clang-built executable, this constructor will be
- // removed by the linker. We use this attribute to prevent the linker from
- // discarding it.
- __attribute__ ((used))
-# endif
-#endif
LogStream(char *buf, int len, int64 ctr)
: std::ostream(NULL),
streambuf_(buf, len),
@@ -1437,7 +1425,7 @@
// is so that streaming can be done more efficiently.
static const size_t kMaxLogMessageLen;
- // These should not be called directly outside of logging.*,
+ // Theses should not be called directly outside of logging.*,
// only passed as SendMethod arguments to other LogMessage methods:
void SendToLog(); // Actually dispatch to the logs
void SendToSyslogAndLog(); // Actually dispatch to syslog and the logs
@@ -1664,8 +1652,8 @@
GLOG_EXPORT void SetEmailLogging(LogSeverity min_severity,
const char* addresses);
-// A simple function that sends email. dest is a comma-separated
-// list of addresses. Thread-safe.
+// A simple function that sends email. dest is a commma-separated
+// list of addressess. Thread-safe.
GLOG_EXPORT bool SendEmail(const char* dest, const char* subject,
const char* body);
@@ -1780,11 +1768,11 @@
// (they'll never be actually displayed). This will be needed if a
// NullStream& is implicitly converted to LogStream&, in which case
// the overloaded NullStream::operator<< will not be invoked.
- NullStream();
+ NullStream() : LogMessage::LogStream(message_buffer_, 1, 0) { }
NullStream(const char* /*file*/, int /*line*/,
- const CheckOpString& /*result*/);
- NullStream& stream();
-
+ const CheckOpString& /*result*/) :
+ LogMessage::LogStream(message_buffer_, 1, 0) { }
+ NullStream &stream() { return *this; }
private:
// A very short buffer for messages (which we discard anyway). This
// will be needed if NullStream& converted to LogStream& (e.g. as a
@@ -1805,8 +1793,17 @@
// trace), like LogMessageFatal.
class GLOG_EXPORT NullStreamFatal : public NullStream {
public:
- using NullStream::NullStream;
- [[noreturn]] ~NullStreamFatal();
+ NullStreamFatal() { }
+ NullStreamFatal(const char* file, int line, const CheckOpString& result) :
+ NullStream(file, line, result) { }
+#if defined(_MSC_VER)
+#pragma warning(push)
+#pragma warning(disable : 4722)
+#endif // _MSC_VER
+ [[noreturn]] ~NullStreamFatal() throw() { _exit(EXIT_FAILURE); }
+#if defined(_MSC_VER)
+#pragma warning(pop)
+#endif // _MSC_VER
};
// Install a signal handler that will dump signal information and a stack
diff --git a/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.macos b/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h
similarity index 100%
rename from runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.macos
rename to runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h
diff --git a/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in b/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in
index 0bf52b4..66fec91 100644
--- a/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in
+++ b/runtime/onnxruntime/third_party/glog/src/glog/raw_logging.h.in
@@ -39,9 +39,10 @@
#include <ctime>
@ac_google_start_namespace@
-#include "glog/log_severity.h"
-#include "glog/logging.h"
-#include "glog/vlog_is_on.h"
+
+#include <glog/log_severity.h>
+#include <glog/logging.h>
+#include <glog/vlog_is_on.h>
#if defined(__GNUC__)
#pragma GCC diagnostic push
diff --git a/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h.macos b/runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h
similarity index 100%
rename from runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h.macos
rename to runtime/onnxruntime/third_party/glog/src/glog/stl_logging.h
diff --git a/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.macos b/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h
similarity index 100%
rename from runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.macos
rename to runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h
diff --git a/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in b/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in
index be76dff..ed37e0d 100644
--- a/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in
+++ b/runtime/onnxruntime/third_party/glog/src/glog/vlog_is_on.h.in
@@ -61,9 +61,9 @@
#ifndef BASE_VLOG_IS_ON_H_
#define BASE_VLOG_IS_ON_H_
-#include <cstddef>
+#include <glog/log_severity.h>
-#include "glog/log_severity.h"
+#include <cstddef>
#if defined(__GNUC__)
// We emit an anonymous static int* variable at every VLOG_IS_ON(n) site.
@@ -75,8 +75,6 @@
#define VLOG_IS_ON(verboselevel) \
__extension__ \
({ static @ac_google_namespace@::SiteFlag vlocal__ = {NULL, NULL, 0, NULL}; \
- GLOG_IFDEF_THREAD_SANITIZER( \
- AnnotateBenignRaceSized(__FILE__, __LINE__, &vlocal__, sizeof(@ac_google_namespace@::SiteFlag), "")); \
@ac_google_namespace@::int32 verbose_level__ = (verboselevel); \
(vlocal__.level == NULL ? @ac_google_namespace@::InitVLOG3__(&vlocal__, &FLAGS_v, \
__FILE__, verbose_level__) : *vlocal__.level >= verbose_level__); \
@@ -106,7 +104,7 @@
SiteFlag* next;
};
-// Helper routine which determines the logging info for a particular VLOG site.
+// Helper routine which determines the logging info for a particalur VLOG site.
// site_flag is the address of the site-local pointer to the controlling
// verbosity level
// site_default is the default to use for *site_flag
diff --git a/runtime/onnxruntime/third_party/glog/src/logging.cc b/runtime/onnxruntime/third_party/glog/src/logging.cc
index 8d90e2b..53b485c 100644
--- a/runtime/onnxruntime/third_party/glog/src/logging.cc
+++ b/runtime/onnxruntime/third_party/glog/src/logging.cc
@@ -33,11 +33,8 @@
#include <algorithm>
#include <cassert>
-#include <cstddef>
#include <iomanip>
-#include <iterator>
#include <string>
-
#ifdef HAVE_UNISTD_H
# include <unistd.h> // For _exit.
#endif
@@ -59,23 +56,18 @@
#ifdef HAVE_SYSLOG_H
# include <syslog.h>
#endif
-#ifdef HAVE__CHSIZE_S
-#include <io.h> // for truncate log file
-#endif
#include <vector>
#include <cerrno> // for errno
#include <sstream>
-#include <regex>
-#include <cctype> // for std::isspace
#ifdef GLOG_OS_WINDOWS
#include "windows/dirent.h"
#else
#include <dirent.h> // for automatic removal of old logs
#endif
-#include "base/commandlineflags.h" // to get the program name
+#include "base/commandlineflags.h" // to get the program name
+#include <glog/logging.h>
+#include <glog/raw_logging.h>
#include "base/googleinit.h"
-#include "glog/logging.h"
-#include "glog/raw_logging.h"
#ifdef HAVE_STACKTRACE
# include "stacktrace.h"
@@ -1558,15 +1550,9 @@
// allocations).
static thread_local bool thread_data_available = true;
-#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L
-// std::aligned_storage is deprecated in C++23
-alignas(LogMessage::LogMessageData) static thread_local std::byte
- thread_msg_data[sizeof(LogMessage::LogMessageData)];
-#else // !(defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L)
static thread_local std::aligned_storage<
sizeof(LogMessage::LogMessageData),
alignof(LogMessage::LogMessageData)>::type thread_msg_data;
-#endif // defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L
#endif // defined(GLOG_THREAD_LOCAL_STORAGE)
LogMessage::LogMessageData::LogMessageData()
@@ -1932,14 +1918,6 @@
GLOG_EXPORT logging_fail_func_t g_logging_fail_func =
reinterpret_cast<logging_fail_func_t>(&abort);
-NullStream::NullStream() : LogMessage::LogStream(message_buffer_, 1, 0) {}
-NullStream::NullStream(const char* /*file*/, int /*line*/,
- const CheckOpString& /*result*/)
- : LogMessage::LogStream(message_buffer_, 1, 0) {}
-NullStream& NullStream::stream() { return *this; }
-
-NullStreamFatal::~NullStreamFatal() { _exit(EXIT_FAILURE); }
-
void InstallFailureFunction(logging_fail_func_t fail_func) {
g_logging_fail_func = fail_func;
}
@@ -2227,13 +2205,6 @@
}
return result;
}
-
-// Trim whitespace from both ends of the provided string.
-static inline void trim(std::string &s) {
- const auto toRemove = [](char ch) { return std::isspace(ch) == 0; };
- s.erase(s.begin(), std::find_if(s.begin(), s.end(), toRemove));
- s.erase(std::find_if(s.rbegin(), s.rend(), toRemove).base(), s.end());
-}
#endif
// use_logging controls whether the logging functions LOG/VLOG are used
@@ -2243,47 +2214,6 @@
const char*body, bool use_logging) {
#ifndef GLOG_OS_EMSCRIPTEN
if (dest && *dest) {
- // Split the comma-separated list of email addresses, validate each one and
- // build a sanitized new comma-separated string without whitespace.
- std::istringstream ss(dest);
- std::ostringstream sanitized_dests;
- std::string s;
- while (std::getline(ss, s, ',')) {
- trim(s);
- if (s.empty()) {
- continue;
- }
- // We validate the provided email addresses using the same regular
- // expression that HTML5 uses[1], except that we require the address to
- // start with an alpha-numeric character. This is because we don't want to
- // allow email addresses that start with a special character, such as a
- // pipe or dash, which could be misunderstood as a command-line flag by
- // certain versions of `mail` that are vulnerable to command injection.[2]
- // [1] https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address
- // [2] e.g. https://nvd.nist.gov/vuln/detail/CVE-2004-2771
- if (!std::regex_match(
- s,
- std::regex("^[a-zA-Z0-9]"
- "[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]*@[a-zA-Z0-9]"
- "(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9]"
- "(?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"))) {
- if (use_logging) {
- VLOG(1) << "Invalid destination email address:" << s;
- } else {
- fprintf(stderr, "Invalid destination email address: %s\n",
- s.c_str());
- }
- return false;
- }
- if (!sanitized_dests.str().empty()) {
- sanitized_dests << ",";
- }
- sanitized_dests << s;
- }
- // Avoid dangling reference
- const std::string& tmp = sanitized_dests.str();
- dest = tmp.c_str();
-
if ( use_logging ) {
VLOG(1) << "Trying to send TITLE:" << subject
<< " BODY:" << body << " to " << dest;
@@ -2305,8 +2235,8 @@
FILE* pipe = popen(cmd.c_str(), "w");
if (pipe != nullptr) {
- // Add the body if we have one
- if (body) {
+ // Add the body if we have one
+ if (body) {
fwrite(body, sizeof(char), strlen(body), pipe);
}
bool ok = pclose(pipe) != -1;
@@ -2398,13 +2328,8 @@
logging_directories_list = new vector<string>;
if ( !FLAGS_log_dir.empty() ) {
- // Ensure the specified path ends with a directory delimiter.
- if (std::find(std::begin(possible_dir_delim), std::end(possible_dir_delim),
- FLAGS_log_dir.back()) == std::end(possible_dir_delim)) {
- logging_directories_list->push_back(FLAGS_log_dir + "/");
- } else {
- logging_directories_list->push_back(FLAGS_log_dir);
- }
+ // A dir was specified, we should use it
+ logging_directories_list->push_back(FLAGS_log_dir);
} else {
GetTempDirectories(logging_directories_list);
#ifdef GLOG_OS_WINDOWS
@@ -2442,7 +2367,7 @@
}
void TruncateLogFile(const char *path, uint64 limit, uint64 keep) {
-#if defined(HAVE_UNISTD_H) || defined(HAVE__CHSIZE_S)
+#ifdef HAVE_UNISTD_H
struct stat statbuf;
const int kCopyBlockSize = 8 << 10;
char copybuf[kCopyBlockSize];
@@ -2463,11 +2388,7 @@
// all of base/...) with -D_FILE_OFFSET_BITS=64 but that's
// rather scary.
// Instead just truncate the file to something we can manage
-#ifdef HAVE__CHSIZE_S
- if (_chsize_s(fd, 0) != 0) {
-#else
if (truncate(path, 0) == -1) {
-#endif
PLOG(ERROR) << "Unable to truncate " << path;
} else {
LOG(ERROR) << "Truncated " << path << " due to EFBIG error";
@@ -2512,11 +2433,7 @@
// Truncate the remainder of the file. If someone else writes to the
// end of the file after our last read() above, we lose their latest
// data. Too bad ...
-#ifdef HAVE__CHSIZE_S
- if (_chsize_s(fd, write_offset) != 0) {
-#else
if (ftruncate(fd, write_offset) == -1) {
-#endif
PLOG(ERROR) << "Unable to truncate " << path;
}
diff --git a/runtime/onnxruntime/third_party/glog/src/mock-log.h b/runtime/onnxruntime/third_party/glog/src/mock-log.h
index a6c1147..62999b2 100644
--- a/runtime/onnxruntime/third_party/glog/src/mock-log.h
+++ b/runtime/onnxruntime/third_party/glog/src/mock-log.h
@@ -36,12 +36,13 @@
#define GLOG_SRC_MOCK_LOG_H_
// For GOOGLE_NAMESPACE. This must go first so we get _XOPEN_SOURCE.
-#include <gmock/gmock.h>
+#include "utilities.h"
#include <string>
-#include "glog/logging.h"
-#include "utilities.h"
+#include <gmock/gmock.h>
+
+#include <glog/logging.h>
_START_GOOGLE_NAMESPACE_
namespace glog_testing {
diff --git a/runtime/onnxruntime/third_party/glog/src/raw_logging.cc b/runtime/onnxruntime/third_party/glog/src/raw_logging.cc
index 8debc18..9e6cf17 100644
--- a/runtime/onnxruntime/third_party/glog/src/raw_logging.cc
+++ b/runtime/onnxruntime/third_party/glog/src/raw_logging.cc
@@ -39,14 +39,12 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h> // for close() and write()
#endif
-#include <fcntl.h> // for open()
-
+#include <fcntl.h> // for open()
#include <ctime>
-
-#include "base/commandlineflags.h"
#include "config.h"
-#include "glog/logging.h" // To pick up flag settings etc.
-#include "glog/raw_logging.h"
+#include <glog/logging.h> // To pick up flag settings etc.
+#include <glog/raw_logging.h>
+#include "base/commandlineflags.h"
#ifdef HAVE_STACKTRACE
# include "stacktrace.h"
@@ -62,8 +60,7 @@
#endif
#if (defined(HAVE_SYSCALL_H) || defined(HAVE_SYS_SYSCALL_H)) && \
- (!(defined(GLOG_OS_MACOSX)) && !(defined(GLOG_OS_OPENBSD))) && \
- !defined(GLOG_OS_EMSCRIPTEN)
+ (!(defined(GLOG_OS_MACOSX))) && !defined(GLOG_OS_EMSCRIPTEN)
#define safe_write(fd, s, len) syscall(SYS_write, fd, s, len)
#else
// Not so safe, but what can you do?
diff --git a/runtime/onnxruntime/third_party/glog/src/signalhandler.cc b/runtime/onnxruntime/third_party/glog/src/signalhandler.cc
index f53e687..657e15c 100644
--- a/runtime/onnxruntime/third_party/glog/src/signalhandler.cc
+++ b/runtime/onnxruntime/third_party/glog/src/signalhandler.cc
@@ -31,13 +31,13 @@
//
// Implementation of InstallFailureSignalHandler().
-#include <csignal>
-#include <ctime>
-
-#include "glog/logging.h"
+#include "utilities.h"
#include "stacktrace.h"
#include "symbolize.h"
-#include "utilities.h"
+#include <glog/logging.h>
+
+#include <csignal>
+#include <ctime>
#ifdef HAVE_UCONTEXT_H
# include <ucontext.h>
#endif
diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace.h b/runtime/onnxruntime/third_party/glog/src/stacktrace.h
index 3180d30..bf23e19 100644
--- a/runtime/onnxruntime/third_party/glog/src/stacktrace.h
+++ b/runtime/onnxruntime/third_party/glog/src/stacktrace.h
@@ -34,7 +34,7 @@
#define BASE_STACKTRACE_H_
#include "config.h"
-#include "glog/logging.h"
+#include <glog/logging.h>
_START_GOOGLE_NAMESPACE_
diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h b/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h
index e59c492..0b20d23 100644
--- a/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h
+++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_libunwind-inl.h
@@ -37,7 +37,7 @@
#define UNW_LOCAL_ONLY
#include <libunwind.h>
}
-#include "glog/raw_logging.h"
+#include <glog/raw_logging.h>
#include "stacktrace.h"
_START_GOOGLE_NAMESPACE_
diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h b/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h
index af95adb..30217db 100644
--- a/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h
+++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_powerpc-inl.h
@@ -121,7 +121,7 @@
// This check is in case the compiler doesn't define _CALL_SYSV.
result[n++] = *(sp+1);
#else
-#error Need to specify the PPC ABI for your architecture.
+#error Need to specify the PPC ABI for your archiecture.
#endif
}
// Use strict unwinding rules.
diff --git a/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc b/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc
index b92961c..6d3c21a 100644
--- a/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc
+++ b/runtime/onnxruntime/third_party/glog/src/stacktrace_unittest.cc
@@ -27,15 +27,14 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "stacktrace.h"
+#include "utilities.h"
#include <cstdio>
#include <cstdlib>
-
-#include "base/commandlineflags.h"
#include "config.h"
-#include "glog/logging.h"
-#include "utilities.h"
+#include "base/commandlineflags.h"
+#include <glog/logging.h>
+#include "stacktrace.h"
#ifdef HAVE_EXECINFO_BACKTRACE_SYMBOLS
# include <execinfo.h>
diff --git a/runtime/onnxruntime/third_party/glog/src/symbolize.cc b/runtime/onnxruntime/third_party/glog/src/symbolize.cc
index 8e84361..f95fccc 100644
--- a/runtime/onnxruntime/third_party/glog/src/symbolize.cc
+++ b/runtime/onnxruntime/third_party/glog/src/symbolize.cc
@@ -119,6 +119,7 @@
#include <elf.h>
#endif
#include <fcntl.h>
+#include <glog/raw_logging.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
@@ -132,7 +133,6 @@
#include <cstring>
#include "config.h"
-#include "glog/raw_logging.h"
#include "symbolize.h"
// Re-runs fn until it doesn't cause EINTR.
@@ -535,8 +535,10 @@
// Iterate over maps and look for the map containing the pc. Then
// look into the symbol tables inside.
char buf[1024]; // Big enough for line of sane /proc/self/maps
+ unsigned num_maps = 0;
LineReader reader(wrapped_maps_fd.get(), buf, sizeof(buf), 0);
while (true) {
+ num_maps++;
const char *cursor;
const char *eol;
if (!reader.ReadLine(&cursor, &eol)) { // EOF or malformed line.
diff --git a/runtime/onnxruntime/third_party/glog/src/symbolize.h b/runtime/onnxruntime/third_party/glog/src/symbolize.h
index 89a6a4f..86c22e3 100644
--- a/runtime/onnxruntime/third_party/glog/src/symbolize.h
+++ b/runtime/onnxruntime/third_party/glog/src/symbolize.h
@@ -54,9 +54,9 @@
#ifndef BASE_SYMBOLIZE_H_
#define BASE_SYMBOLIZE_H_
-#include "config.h"
-#include "glog/logging.h"
#include "utilities.h"
+#include "config.h"
+#include <glog/logging.h>
#ifdef HAVE_SYMBOLIZE
diff --git a/runtime/onnxruntime/third_party/glog/src/utilities.cc b/runtime/onnxruntime/third_party/glog/src/utilities.cc
index f825470..8b0a1ea 100644
--- a/runtime/onnxruntime/third_party/glog/src/utilities.cc
+++ b/runtime/onnxruntime/third_party/glog/src/utilities.cc
@@ -292,8 +292,6 @@
return getpid(); // Linux: getpid returns thread ID when gettid is absent
#elif defined GLOG_OS_WINDOWS && !defined GLOG_OS_CYGWIN
return static_cast<pid_t>(GetCurrentThreadId());
-#elif defined GLOG_OS_OPENBSD
- return getthrid();
#elif defined(HAVE_PTHREAD)
// If none of the techniques above worked, we use pthread_self().
return (pid_t)(uintptr_t)pthread_self();
diff --git a/runtime/onnxruntime/third_party/glog/src/utilities.h b/runtime/onnxruntime/third_party/glog/src/utilities.h
index ae34d8d..45e555b 100644
--- a/runtime/onnxruntime/third_party/glog/src/utilities.h
+++ b/runtime/onnxruntime/third_party/glog/src/utilities.h
@@ -29,7 +29,7 @@
//
// Author: Shinichiro Hamaji
//
-// Define utilities for glog internal usage.
+// Define utilties for glog internal usage.
#ifndef UTILITIES_H__
#define UTILITIES_H__
@@ -52,10 +52,11 @@
#define PRIXS __PRIS_PREFIX "X"
#define PRIoS __PRIS_PREFIX "o"
+#include "base/mutex.h" // This must go first so we get _XOPEN_SOURCE
+
#include <string>
-#include "base/mutex.h" // This must go first so we get _XOPEN_SOURCE
-#include "glog/logging.h"
+#include <glog/logging.h>
#if defined(GLOG_OS_WINDOWS)
# include "port.h"
@@ -173,7 +174,7 @@
:"=a"(ret)
// GCC may produces %sil or %dil for
// constraint "r", but some of apple's gas
- // doesn't know the 8 bit registers.
+ // dosn't know the 8 bit registers.
// We use "q" to avoid these registers.
:"q"(newval), "q"(ptr), "a"(oldval)
:"memory", "cc");
diff --git a/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc b/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc
index f78fd07..ac60d02 100644
--- a/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc
+++ b/runtime/onnxruntime/third_party/glog/src/vlog_is_on.cc
@@ -32,17 +32,17 @@
// Broken out from logging.cc by Soren Lassen
// logging_unittest.cc covers the functionality herein
+#include "utilities.h"
+
+#include <cstring>
+#include <cstdlib>
#include <cerrno>
#include <cstdio>
-#include <cstdlib>
-#include <cstring>
#include <string>
-
#include "base/commandlineflags.h"
+#include <glog/logging.h>
+#include <glog/raw_logging.h>
#include "base/googleinit.h"
-#include "glog/logging.h"
-#include "glog/raw_logging.h"
-#include "utilities.h"
// glog doesn't have annotation
#define ANNOTATE_BENIGN_RACE(address, description)
diff --git a/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt b/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt
index 9960ce9..9097bd8 100644
--- a/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt
+++ b/runtime/onnxruntime/third_party/openfst/src/lib/CMakeLists.txt
@@ -1,6 +1,20 @@
FILE(GLOB HEADER_FILES ../include/fst/*.h)
-
+if(WIN32)
+add_library(fst STATIC
+ compat.cc
+ flags.cc
+ fst-types.cc
+ fst.cc
+ mapped-file.cc
+ properties.cc
+ symbol-table.cc
+ symbol-table-ops.cc
+ util.cc
+ weight.cc
+ ${HEADER_FILES}
+)
+else()
add_library(fst
compat.cc
flags.cc
@@ -14,6 +28,8 @@
weight.cc
${HEADER_FILES}
)
+endif()
+
set_target_properties(fst PROPERTIES
SOVERSION "${SOVERSION}"
)
diff --git a/runtime/python/libtorch/README.md b/runtime/python/libtorch/README.md
index 4174656..a96846e 100644
--- a/runtime/python/libtorch/README.md
+++ b/runtime/python/libtorch/README.md
@@ -1,6 +1,7 @@
# Libtorch-python
## Export the model
+
### Install [modelscope and funasr](https://github.com/alibaba-damo-academy/FunASR#installation)
```shell
@@ -18,14 +19,16 @@
python -m funasr.export.export_model --model-name damo/speech_paraformer-large_asr_nat-zh-cn-16k-common-vocab8404-pytorch --export-dir ./export --type torch --quantize True
```
-## Install the `funasr_torch`.
-
+## Install the `funasr_torch`
+
install from pip
+
```shell
pip install -U funasr_torch
# For the users in China, you could install with the command:
# pip install -U funasr_torch -i https://mirror.sjtu.edu.cn/pypi/web/simple
```
+
or install from source code
```shell
@@ -36,11 +39,13 @@
# pip install -e ./ -i https://mirror.sjtu.edu.cn/pypi/web/simple
```
-## Run the demo.
+## Run the demo
+
- Model_dir: the model path, which contains `model.torchscripts`, `config.yaml`, `am.mvn`.
- Input: wav formt file, support formats: `str, np.ndarray, List[str]`
- Output: `List[str]`: recognition result.
- Example:
+
```python
from funasr_torch import Paraformer
@@ -55,7 +60,7 @@
## Performance benchmark
-Please ref to [benchmark](https://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/runtime/python/benchmark_libtorch.md)
+Please ref to [benchmark](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/benchmark_libtorch.md)
## Speed
@@ -70,4 +75,5 @@
| Onnx | 0.038 |
## Acknowledge
+
This project is maintained by [FunASR community](https://github.com/alibaba-damo-academy/FunASR).
diff --git a/runtime/python/onnxruntime/README.md b/runtime/python/onnxruntime/README.md
index ceeb459..8034ac2 100644
--- a/runtime/python/onnxruntime/README.md
+++ b/runtime/python/onnxruntime/README.md
@@ -180,7 +180,7 @@
## Performance benchmark
-Please ref to [benchmark](https://github.com/alibaba-damo-academy/FunASR/blob/main/funasr/runtime/docs/benchmark_onnx.md)
+Please ref to [benchmark](https://github.com/alibaba-damo-academy/FunASR/blob/main/runtime/docs/benchmark_onnx.md)
## Acknowledge
diff --git a/runtime/websocket/CMakeLists.txt b/runtime/websocket/CMakeLists.txt
index b234265..a34798e 100644
--- a/runtime/websocket/CMakeLists.txt
+++ b/runtime/websocket/CMakeLists.txt
@@ -111,7 +111,9 @@
# with some patch to fix the make errors.
add_subdirectory(${PROJECT_SOURCE_DIR}/../onnxruntime/third_party/openfst openfst)
include_directories(${openfst_SOURCE_DIR}/src/include)
-
+ if(WIN32)
+ include_directories(${openfst_SOURCE_DIR}/src/lib)
+ endif()
endif()
--
Gitblit v1.9.1