daquexian / onnx-simplifier

Simplify your onnx model
Apache License 2.0
3.67k stars 377 forks source link

在M1跑build_wasm.sh脚本编译onnxsims出现的问题 #300

Open Skyrim1566 opened 1 year ago

Skyrim1566 commented 1 year ago

macOS 12.2.1 cmake 3.26.3 大老师, 编译一个onnxsim_bin的C++可执行程序来实现模型的简化, 但是在编译过程中遇到了些问题, 目前没什么头绪, 您可否提供些帮助? -- The C compiler identification is AppleClang 14.0.3.14030022 -- The CXX compiler identification is AppleClang 14.0.3.14030022 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Applications/Xcode-14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Applications/Xcode-14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- -- 3.18.1.0 -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- Found ZLIB: /Applications/Xcode-14.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS -- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success -- Configuring done (2.5s) -- Generating done (0.0s) -- Build files have been written to: /Users/skyrim/Desktop/Projects/onnx-simplifier/third_party/onnxruntime/cmake/external/protobuf/cmake/build [143/171] Building CXX object CMakeFiles/libprotobuf.dir/Users/skyrim/Desktop/Proje...rd_party/onnxruntime/cmake/external/protobuf/src/google/protobuf/stubs/strutil.cc.o /Users/skyrim/Desktop/Projects/onnx-simplifier/third_party/onnxruntime/cmake/external/protobuf/src/google/protobuf/stubs/strutil.cc:506:11: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] sprintf(dest + used, (use_hex ? "\x%02x" : "\%03o"), ^ /Applications/Xcode-14.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here __deprecated_msg("This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.") ^ /Applications/Xcode-14.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'

define deprecated_msg(_msg) attribute((deprecated__(_msg)))

                                                  ^

1 warning generated. [171/171] Creating executable symlink protoc ~/Desktop/Projects/onnx-simplifier CMake Warning: Ignoring extra path from command line:

"/Users/skyrim/Desktop/Projects/onnx-simplifier/build-wasm-node-OFF/CMAKE_ARGS"

-- The CXX compiler identification is AppleClang 14.0.3.14030022 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Applications/Xcode-14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Deprecation Warning at third_party/onnxruntime/cmake/CMakeLists.txt:15 (cmake_policy): The OLD behavior for policy CMP0104 will be removed from a future version of CMake.

The cmake-policies(7) manual explains that the OLD behaviors of all policies are deprecated and that a policy should be set to OLD only under specific short-term circumstances. Projects should be ported to the NEW behavior and not rely on setting a policy to OLD.

-- The C compiler identification is AppleClang 14.0.3.14030022 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Applications/Xcode-14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Build type not set - using RelWithDebInfo Building ONNX Runtime for arm64 -- Performing Test onnxruntime_HAVE_BUILTIN_ATOMICS -- Performing Test onnxruntime_HAVE_BUILTIN_ATOMICS - Success -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- Found Patch: /usr/bin/patch
Patch found: /usr/bin/patch -- Performing Test COMPILER_SUPPORT_MF16C -- Performing Test COMPILER_SUPPORT_MF16C - Success -- Performing Test COMPILER_SUPPORT_FMA -- Performing Test COMPILER_SUPPORT_FMA - Success -- Performing Test COMPILER_SUPPORT_AVX -- Performing Test COMPILER_SUPPORT_AVX - Success Adding flags for Mac builds Use gtest from submodule -- Found Python: /opt/homebrew/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found version "3.9.13") found components: Interpreter -- Found Python: /opt/homebrew/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found suitable version "3.9.13", minimum required is "3.6") found components: Interpreter Use nsync from submodule Use protobuf from submodule -- -- 3.18.1.0 -- Found ZLIB: /Applications/Xcode-14.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Performing Test protobuf_HAVE_BUILTIN_ATOMICS -- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success Use date from submodule CMake Warning (dev) at third_party/onnxruntime/cmake/external/date/CMakeLists.txt:14 (option): Policy CMP0077 is not set: option() honors normal variables. Run "cmake --help-policy CMP0077" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

For compatibility with older versions of CMake, option is clearing the normal variable 'BUILD_SHARED_LIBS'. This warning is for project developers. Use -Wno-dev to suppress it.

date: USE_SYSTEM_TZ_DB ON

date: USE_TZ_DB_IN_DOT OFF

date: BUILD_SHARED_LIBS OFF

date: ENABLE_DATE_TESTING OFF

Use mp11 from submodule Use json from submodule -- Using the single-header code from /Users/skyrim/Desktop/Projects/onnx-simplifier/third_party/onnxruntime/cmake/external/json/single_include/ Use re2 from submodule Use cpuinfo from submodule -- Performing Test HAS_UNUSED_BUT_SET_PARAMETER -- Performing Test HAS_UNUSED_BUT_SET_PARAMETER - Success -- Performing Test HAS_UNUSED_BUT_SET_VARIABLE -- Performing Test HAS_UNUSED_BUT_SET_VARIABLE - Success -- Performing Test HAS_UNUSED_VARIABLE -- Performing Test HAS_UNUSED_VARIABLE - Success -- Performing Test HAS_CAST_FUNCTION_TYPE -- Performing Test HAS_CAST_FUNCTION_TYPE - Success -- Performing Test HAS_PARENTHESES -- Performing Test HAS_PARENTHESES - Success -- Performing Test HAS_USELESS_CAST -- Performing Test HAS_USELESS_CAST - Failed -- Performing Test HAS_NONNULL_COMPARE -- Performing Test HAS_NONNULL_COMPARE - Failed -- Performing Test HAS_TAUTOLOGICAL_POINTER_COMPARE -- Performing Test HAS_TAUTOLOGICAL_POINTER_COMPARE - Success -- Performing Test HAS_CATCH_VALUE -- Performing Test HAS_CATCH_VALUE - Failed -- Performing Test HAS_MISSING_BRACES -- Performing Test HAS_MISSING_BRACES - Success -- Performing Test HAS_IGNORED_ATTRIBUTES -- Performing Test HAS_IGNORED_ATTRIBUTES - Success -- Performing Test HAS_DEPRECATED_COPY -- Performing Test HAS_DEPRECATED_COPY - Success -- Performing Test HAS_DEPRECATED_DECLARATIONS -- Performing Test HAS_DEPRECATED_DECLARATIONS - Success -- Performing Test HAS_CLASS_MEMACCESS -- Performing Test HAS_CLASS_MEMACCESS - Failed -- Performing Test HAS_MAYBE_UNINITIALIZED -- Performing Test HAS_MAYBE_UNINITIALIZED - Failed -- Performing Test HAS_STRICT_ALIASING -- Performing Test HAS_STRICT_ALIASING - Success NVCC_ERROR = NVCC_OUT = No such file or directory -- Performing Test HAS_AMBIGUOUS_REVERSED_OPERATOR -- Performing Test HAS_AMBIGUOUS_REVERSED_OPERATOR - Success -- Performing Test HAS_DEPRECATED_ANON_ENUM_ENUM_CONVERSION -- Performing Test HAS_DEPRECATED_ANON_ENUM_ENUM_CONVERSION - Success -- Performing Test HAS_UNDEFINED_VAR_TEMPLATE -- Performing Test HAS_UNDEFINED_VAR_TEMPLATE - Success -- Performing Test HAS_FORMAT_TRUNCATION -- Performing Test HAS_FORMAT_TRUNCATION - Failed -- Performing Test HAS_BITWISE_INSTEAD_OF_LOGICAL -- Performing Test HAS_BITWISE_INSTEAD_OF_LOGICAL - Success -- Found Python: /opt/homebrew/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found version "3.9.13") found components: Interpreter -- Found Python: /opt/homebrew/Frameworks/Python.framework/Versions/3.9/bin/python3.9 (found version "3.9.13") found components: Interpreter Development Development.Module Development.Embed Generated: /Users/skyrim/Desktop/Projects/onnx-simplifier/build-wasm-node-OFF/third_party/onnxruntime/cmake/external/onnx/onnx/onnx-ml.proto Generated: /Users/skyrim/Desktop/Projects/onnx-simplifier/build-wasm-node-OFF/third_party/onnxruntime/cmake/external/onnx/onnx/onnx-operators-ml.proto Generated: /Users/skyrim/Desktop/Projects/onnx-simplifier/build-wasm-node-OFF/third_party/onnxruntime/cmake/external/onnx/onnx/onnx-data.proto -- -- **** Summary **** -- CMake version : 3.26.3 -- CMake command : /Applications/CMake.app/Contents/bin/cmake -- System : Darwin -- C++ compiler : /Applications/Xcode-14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- C++ compiler version : 14.0.3.14030022 -- CXX flags : -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -fstack-protector-strong -DCPUINFO_SUPPORTED -Wno-deprecated -Wnon-virtual-dtor -- Build type : RelWithDebInfo -- Compile definitions : ORT_NO_RTTI;EIGEN_MPL2_ONLY;ENABLE_CPU_FP16_TRAINING_OPS;PLATFORM_POSIX;__STDC_FORMAT_MACROS -- CMAKE_PREFIX_PATH : -- CMAKE_INSTALL_PREFIX : /usr/local -- CMAKE_MODULE_PATH : /Users/skyrim/Desktop/Projects/onnx-simplifier/third_party/onnxruntime/cmake/external -- -- ONNX version : 1.12.0 -- ONNX NAMESPACE : onnx -- ONNX_USE_LITE_PROTO : OFF -- USE_PROTOBUF_SHARED_LIBS : OFF -- Protobuf_USE_STATIC_LIBS : ON -- ONNX_DISABLE_EXCEPTIONS : OFF -- ONNX_WERROR : OFF -- ONNX_BUILD_TESTS : OFF -- ONNX_BUILD_BENCHMARKS : OFF -- ONNXIFI_DUMMY_BACKEND : OFF -- ONNXIFI_ENABLE_EXT : OFF -- -- Protobuf compiler : -- Protobuf includes : -- Protobuf libraries : -- BUILD_ONNX_PYTHON : OFF Use flatbuffers from submodule -- Looking for strtof_l -- Looking for strtof_l - not found -- Looking for strtoull_l -- Looking for strtoull_l - not found CMake Warning (dev) at /Applications/CMake.app/Contents/share/cmake-3.26/Modules/FetchContent.cmake:1282 (message): The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is not set. The policy's OLD behavior will be used. When using a URL download, the timestamps of extracted files should preferably be that of the time of extraction, otherwise code that depends on the extracted contents might not be rebuilt if the URL changes. The OLD behavior preserves the timestamps from the archive instead, but this is usually not what you want. Update your project to the NEW behavior or specify the DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this robustness issue. Call Stack (most recent call first): third_party/onnxruntime/cmake/external/abseil-cpp.cmake:16 (FetchContent_Declare) third_party/onnxruntime/cmake/onnxruntime_common.cmake:112 (include) third_party/onnxruntime/cmake/CMakeLists.txt:1942 (include) This warning is for project developers. Use -Wno-dev to suppress it.

-- The ASM compiler identification is Clang with GNU-like command-line -- Found assembler: /Applications/Xcode-14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- Configuring done (18.5s) -- Generating done (0.2s) -- Build files have been written to: /Users/skyrim/Desktop/Projects/onnx-simplifier/build-wasm-node-OFF [0/2] Re-checking globbed directories... [55/884] Linking CXX shared library third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/libabsl_base.dylib FAILED: third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/libabsl_base.dylib : && /Applications/Xcode-14.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -fstack-protector-strong -DCPUINFO_SUPPORTED -Wno-deprecated -O2 -g -DNDEBUG -DGSL_UNENFORCED_ON_CONTRACT_VIOLATION -arch arm64 -isysroot /Applications/Xcode-14.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -mmacosx-version-min=10.15 -dynamiclib -Wl,-headerpad_max_install_names -o third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/libabsl_base.dylib -install_name @rpath/libabsl_base.dylib third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/CMakeFiles/absl_base.dir/internal/cycleclock.cc.o third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/CMakeFiles/absl_base.dir/internal/spinlock.cc.o third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/CMakeFiles/absl_base.dir/internal/sysinfo.cc.o third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/CMakeFiles/absl_base.dir/internal/thread_identity.cc.o third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/CMakeFiles/absl_base.dir/internal/unscaledcycleclock.cc.o -Wl,-rpath,/Users/skyrim/Desktop/Projects/onnx-simplifier/build-wasm-node-OFF/third_party/onnxruntime/cmake/external/abseil-cpp/absl/base third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/libabsl_raw_logging_internal.dylib third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/libabsl_spinlock_wait.dylib third_party/onnxruntime/cmake/external/abseil-cpp/absl/base/libabsl_log_severity.dylib && : Undefined symbols for architecture arm64: "_AbslInternalSpinLockDelay_lts_20211102", referenced from: absl::lts_20211102::base_internal::SpinLock::SlowLock() in spinlock.cc.o "_AbslInternalSpinLockWake_lts_20211102", referenced from: absl::lts_20211102::base_internal::SpinLock::SlowUnlock(unsigned int) in spinlock.cc.o void absl::lts_20211102::base_internal::CallOnceImpl<absl::lts_20211102::base_internal::SpinLock::SpinLoop()::$_0>(std::1::atomic*, absl::lts_20211102::base_internal::SchedulingMode, absl::lts_20211102::base_internal::SpinLock::SpinLoop()::$_0&&) in spinlock.cc.o void absl::lts_20211102::base_internal::CallOnceImpl<absl::lts_20211102::base_internal::NumCPUs()::$_0>(std::1::atomic, absl::lts_20211102::base_internal::SchedulingMode, absl::lts_20211102::base_internal::NumCPUs()::$_0&&) in sysinfo.cc.o void absl::lts_20211102::base_internal::CallOnceImpl<absl::lts_20211102::base_internal::NominalCPUFrequency()::$_1>(std::__1::atomic, absl::lts_20211102::base_internal::SchedulingMode, absl::lts_20211102::base_internal::NominalCPUFrequency()::$_1&&) in sysinfo.cc.o void absl::lts_20211102::base_internal::CallOnceImpl<void (&)()>(std::1::atomic*, absl::lts_20211102::base_internal::SchedulingMode, void (&)()) in sysinfo.cc.o "absl::lts_20211102::base_internal::SpinLockWait(std::1::atomic, int, absl::lts_20211102::base_internal::SpinLockWaitTransition const, absl::lts_20211102::base_internal::SchedulingMode)", referenced from: void absl::lts_20211102::base_internal::CallOnceImpl<absl::lts_20211102::base_internal::SpinLock::SpinLoop()::$_0>(std::1::atomic*, absl::lts_20211102::base_internal::SchedulingMode, absl::lts_20211102::base_internal::SpinLock::SpinLoop()::$_0&&) in spinlock.cc.o void absl::lts_20211102::base_internal::CallOnceImpl<absl::lts_20211102::base_internal::NumCPUs()::$_0>(std::1::atomic, absl::lts_20211102::base_internal::SchedulingMode, absl::lts_20211102::base_internal::NumCPUs()::$_0&&) in sysinfo.cc.o void absl::lts_20211102::base_internal::CallOnceImpl<absl::lts_20211102::base_internal::NominalCPUFrequency()::$_1>(std::__1::atomic, absl::lts_20211102::base_internal::SchedulingMode, absl::lts_20211102::base_internal::NominalCPUFrequency()::$_1&&) in sysinfo.cc.o void absl::lts_20211102::base_internal::CallOnceImpl<void (&)()>(std::__1::atomic*, absl::lts_20211102::base_internal::SchedulingMode, void (&)()) in sysinfo.cc.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) [66/884] Building CXX object third_party/onnxruntime/cmake/external/flatbuffers/CMakeFiles/flatc.dir/src/idl_parser.cpp.o ninja: build stopped: subcommand failed.