microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.73k stars 2.94k forks source link

Build with DNNL execution provider failing on macOS, but working on Linux #5783

Open j-paulus opened 4 years ago

j-paulus commented 4 years ago

Describe the bug Building the shared ORT library including the DNNL execution provider fails under macOS, but the same build command works properly under Linux.

It appears as if the DNNL sources do not get fetched during the macOS build and that is (partly?) causing the problem.

See below for the steps involved.

Under Ubuntu 18.04, the build runs properly through without issues. Under macOS, the output is:

2020-11-12 08:32:35,258 Build [DEBUG] - Defaulting to running update, build [and test for native builds]. 2020-11-12 08:32:35,258 Build [INFO] - Build started 2020-11-12 08:32:35,258 Build [INFO] - Running subprocess in '/Users/name/code/c/onnxruntime' ['git', 'submodule', 'sync', '--recursive'] Synchronizing submodule url for 'cmake/external/FeaturizersLibrary' Synchronizing submodule url for 'cmake/external/FeaturizersLibrary/src/3rdParty/eigen' Synchronizing submodule url for 'cmake/external/FeaturizersLibrary/src/3rdParty/re2' Synchronizing submodule url for 'cmake/external/SafeInt/safeint' Synchronizing submodule url for 'cmake/external/cub' Synchronizing submodule url for 'cmake/external/cxxopts' Synchronizing submodule url for 'cmake/external/date' Synchronizing submodule url for 'cmake/external/eigen' Synchronizing submodule url for 'cmake/external/flatbuffers' Synchronizing submodule url for 'cmake/external/gemmlowp' Synchronizing submodule url for 'cmake/external/googletest' Synchronizing submodule url for 'cmake/external/horovod' Synchronizing submodule url for 'cmake/external/horovod/third_party/HTTPRequest' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/assert' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/config' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/core' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/detail' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/iterator' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/lockfree' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/mpl' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/parameter' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/predef' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/preprocessor' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/static_assert' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/type_traits' Synchronizing submodule url for 'cmake/external/horovod/third_party/boost/utility' Synchronizing submodule url for 'cmake/external/horovod/third_party/eigen' Synchronizing submodule url for 'cmake/external/horovod/third_party/flatbuffers' Synchronizing submodule url for 'cmake/external/horovod/third_party/gloo' Synchronizing submodule url for 'cmake/external/horovod/third_party/lbfgs' Synchronizing submodule url for 'cmake/external/json' Synchronizing submodule url for 'cmake/external/libprotobuf-mutator' Synchronizing submodule url for 'cmake/external/mimalloc' Synchronizing submodule url for 'cmake/external/nsync' Synchronizing submodule url for 'cmake/external/onnx' Synchronizing submodule url for 'cmake/external/onnx/third_party/benchmark' Synchronizing submodule url for 'cmake/external/onnx/third_party/pybind11' Synchronizing submodule url for 'cmake/external/onnx/third_party/pybind11/tools/clang' Synchronizing submodule url for 'cmake/external/onnx-tensorrt' Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx' Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/benchmark' Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11' Synchronizing submodule url for 'cmake/external/onnx-tensorrt/third_party/onnx/third_party/pybind11/tools/clang' Synchronizing submodule url for 'cmake/external/optional-lite' Synchronizing submodule url for 'cmake/external/protobuf' Synchronizing submodule url for 'cmake/external/protobuf/third_party/benchmark' Synchronizing submodule url for 'cmake/external/protobuf/third_party/googletest' Synchronizing submodule url for 'cmake/external/re2' Synchronizing submodule url for 'cmake/external/tensorboard' Synchronizing submodule url for 'cmake/external/tvm' Synchronizing submodule url for 'cmake/external/tvm/3rdparty/HalideIR' Synchronizing submodule url for 'cmake/external/tvm/3rdparty/dlpack' Synchronizing submodule url for 'cmake/external/tvm/3rdparty/dmlc-core' Synchronizing submodule url for 'cmake/external/tvm/3rdparty/rang' Synchronizing submodule url for 'cmake/external/wil' Synchronizing submodule url for 'server/external/spdlog' 2020-11-12 08:32:35,933 Build [DEBUG] - Subprocess completed. Return code=0 2020-11-12 08:32:35,933 Build [INFO] - Running subprocess in '/Users/name/code/c/onnxruntime' ['git', 'submodule', 'update', '--init', '--recursive'] 2020-11-12 08:32:38,351 Build [DEBUG] - Subprocess completed. Return code=0 2020-11-12 08:32:38,351 Build [INFO] - Generating CMake build tree 2020-11-12 08:32:38,352 Build [INFO] - Running subprocess in '/Users/name/code/c/onnxruntime/build/MacOS/Release' ['/Applications/CMake.app/Contents/bin/cmake', '/Users/name/code/c/onnxruntime/cmake', '-Donnxruntime_RUN_ONNX_TESTS=OFF', '-Donnxruntime_BUILD_WINML_TESTS=ON', '-Donnxruntime_GENERATE_TEST_REPORTS=ON', '-Donnxruntime_DEV_MODE=ON', '-DPYTHON_EXECUTABLE=/Applications/Xcode.app/Contents/Developer/usr/bin/python3', '-Donnxruntime_USE_CUDA=OFF', '-Donnxruntime_CUDNN_HOME=', '-Donnxruntime_USE_FEATURIZERS=OFF', '-Donnxruntime_CUDA_HOME=', '-Donnxruntime_USE_JEMALLOC=OFF', '-Donnxruntime_USE_MIMALLOC_STL_ALLOCATOR=OFF', '-Donnxruntime_USE_MIMALLOC_ARENA_ALLOCATOR=OFF', '-Donnxruntime_ENABLE_PYTHON=OFF', '-Donnxruntime_BUILD_CSHARP=OFF', '-Donnxruntime_BUILD_JAVA=OFF', '-Donnxruntime_BUILD_NODEJS=OFF', '-Donnxruntime_BUILD_SHARED_LIB=ON', '-Donnxruntime_USE_EIGEN_FOR_BLAS=ON', '-Donnxruntime_USE_OPENBLAS=OFF', '-Donnxruntime_USE_DNNL=ON', '-Donnxruntime_USE_NGRAPH=OFF', '-Donnxruntime_USE_NNAPI_BUILTIN=OFF', '-Donnxruntime_USE_RKNPU=OFF', '-Donnxruntime_USE_OPENMP=ON', '-Donnxruntime_USE_TVM=OFF', '-Donnxruntime_USE_LLVM=OFF', '-Donnxruntime_ENABLE_MICROSOFT_INTERNAL=OFF', '-Donnxruntime_USE_VITISAI=OFF', '-Donnxruntime_USE_NUPHAR=OFF', '-Donnxruntime_USE_TENSORRT=OFF', '-Donnxruntime_TENSORRT_HOME=', '-Donnxruntime_USE_MIGRAPHX=OFF', '-Donnxruntime_MIGRAPHX_HOME=', '-Donnxruntime_CROSS_COMPILING=OFF', '-Donnxruntime_DISABLE_CONTRIB_OPS=OFF', '-Donnxruntime_DISABLE_ML_OPS=OFF', '-Donnxruntime_DISABLE_RTTI=OFF', '-Donnxruntime_DISABLE_EXCEPTIONS=OFF', '-Donnxruntime_DISABLE_ORT_FORMAT_LOAD=OFF', '-Donnxruntime_MINIMAL_BUILD=OFF', '-Donnxruntime_REDUCED_OPS_BUILD=OFF', '-Donnxruntime_MSVC_STATIC_RUNTIME=OFF', '-Donnxruntime_ENABLE_LANGUAGE_INTEROP_OPS=OFF', '-Donnxruntime_USE_DML=OFF', '-Donnxruntime_USE_WINML=OFF', '-Donnxruntime_USE_TELEMETRY=OFF', '-Donnxruntime_ENABLE_LTO=OFF', '-Donnxruntime_USE_ACL=OFF', '-Donnxruntime_USE_ACL_1902=OFF', '-Donnxruntime_USE_ACL_1905=OFF', '-Donnxruntime_USE_ACL_1908=OFF', '-Donnxruntime_USE_ACL_2002=OFF', '-Donnxruntime_USE_ARMNN=OFF', '-Donnxruntime_ARMNN_RELU_USE_CPU=ON', '-Donnxruntime_ARMNN_BN_USE_CPU=ON', '-Donnxruntime_ENABLE_NVTX_PROFILE=OFF', '-Donnxruntime_ENABLE_TRAINING=OFF', '-Donnxruntime_USE_HOROVOD=OFF', '-Donnxruntime_USE_NCCL=ON', '-Donnxruntime_BUILD_BENCHMARKS=OFF', '-Donnxruntime_USE_ROCM=OFF', '-Donnxruntime_ROCM_HOME=', '-Donnxruntime_PYBIND_EXPORT_OPSCHEMA=OFF', '-Donnxruntime_ENABLE_MEMLEAK_CHECKER=OFF', '-DCMAKE_BUILD_TYPE=Release'] -- The C compiler identification is AppleClang 12.0.0.12000032 -- The CXX compiler identification is AppleClang 12.0.0.12000032 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Applications/Xcode.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.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found OpenMP_C: -Xclang -fopenmp (found version "4.5") -- Found OpenMP_CXX: -Xclang -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5")
-- Performing Test onnxruntime_HAVE_BUILTIN_ATOMICS -- Performing Test onnxruntime_HAVE_BUILTIN_ATOMICS - Success -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
Adding flags for Mac builds Use gtest from submodule -- Found PythonInterp: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 (found version "3.8.2") -- Found PythonInterp: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 (found suitable version "3.8.2", minimum required is "3.4") Use protobuf from submodule -- 3.11.3.0 -- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libz.tbd (found version "1.2.11") -- Performing Test protobuf_HAVE_BUILTIN_ATOMICS -- Performing Test protobuf_HAVE_BUILTIN_ATOMICS - Success date: USE_SYSTEM_TZ_DB ON date: USE_TZ_DB_IN_DOT OFF date: BUILD_SHARED_LIBS OFF date: ENABLE_DATE_TESTING OFF Generated: /Users/name/code/c/onnxruntime/build/MacOS/Release/external/onnx/onnx/onnx-ml.proto Generated: /Users/name/code/c/onnxruntime/build/MacOS/Release/external/onnx/onnx/onnx-operators-ml.proto Generated: /Users/name/code/c/onnxruntime/build/MacOS/Release/external/onnx/onnx/onnx-data.proto

-- **** Summary ****

-- CMake version : 3.18.2 -- CMake command : /Applications/CMake.app/Contents/bin/cmake -- System : Darwin -- C++ compiler : /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- C++ compiler version : 12.0.0.12000032 -- CXX flags : -Xclang -fopenmp -fstack-protector-strong -Wno-deprecated -Wnon-virtual-dtor -- Build type : Release -- Compile definitions : ENABLE_ORT_FORMAT_LOAD;EIGEN_MPL2_ONLY;USE_EIGEN_FOR_BLAS -- CMAKE_PREFIX_PATH : -- CMAKE_INSTALL_PREFIX : /usr/local -- CMAKE_MODULE_PATH : /Users/name/code/c/onnxruntime/cmake/external -- ONNX version : 1.8.0 -- ONNX NAMESPACE : onnx -- ONNX_BUILD_TESTS : OFF -- ONNX_BUILD_BENCHMARKS : OFF -- ONNX_USE_LITE_PROTO : ON -- ONNXIFI_DUMMY_BACKEND : OFF -- ONNXIFI_ENABLE_EXT : OFF -- Protobuf compiler : -- Protobuf includes : -- Protobuf libraries : -- BUILD_ONNX_PYTHON : OFF -- Looking for strtof_l -- Looking for strtof_l - not found -- Looking for strtoull_l -- Looking for strtoull_l - not found -- Performing Test HAS_UNUSED_BUT_SET_VARIABLE -- Performing Test HAS_UNUSED_BUT_SET_VARIABLE - Failed -- Performing Test HAS_UNUSED_PARAMETER -- Performing Test HAS_UNUSED_PARAMETER - Success -- Performing Test HAS_UNUSED_VARIABLE -- Performing Test HAS_UNUSED_VARIABLE - Success -- Performing Test HAS_CAST_FUNCTION_TYPE -- Performing Test HAS_CAST_FUNCTION_TYPE - Failed -- 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 - Failed -- 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 -- The ASM compiler identification is Clang -- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- Performing Test HAS_AVX512F -- Performing Test HAS_AVX512F - Success -- Performing Test COMPILES_AVX512F -- Performing Test COMPILES_AVX512F - Success -- Performing Test HAS_AVX512CORE -- Performing Test HAS_AVX512CORE - Success -- Performing Test COMPILES_AVX512CORE -- Performing Test COMPILES_AVX512CORE - Success CMake Warning at flake8.cmake:19 (message): Could not find 'flake8' to check python scripts. Please install flake8 using pip. Call Stack (most recent call first): CMakeLists.txt:1474 (include)

-- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project:

onnxruntime_BUILD_WINML_TESTS
onnxruntime_CUDA_HOME
onnxruntime_MIGRAPHX_HOME
onnxruntime_PYBIND_EXPORT_OPSCHEMA
onnxruntime_ROCM_HOME
onnxruntime_TENSORRT_HOME

-- Build files have been written to: /Users/name/code/c/onnxruntime/build/MacOS/Release 2020-11-12 08:32:44,460 Build [DEBUG] - Subprocess completed. Return code=0 2020-11-12 08:32:44,460 Build [INFO] - Building targets for Release configuration 2020-11-12 08:32:44,460 Build [INFO] - Running subprocess in '/Users/name/code/c/onnxruntime' ['/Applications/CMake.app/Contents/bin/cmake', '--build', '/Users/name/code/c/onnxruntime/build/MacOS/Release', '--config', 'Release', '--', '-j12'] Scanning dependencies of target custom_op_library Scanning dependencies of target flatbuffers Scanning dependencies of target onnxruntime_generate_def [ 0%] Generating cpp/platform/posix/src/nsync_semaphore_mutex.c Scanning dependencies of target project_dnnl Scanning dependencies of target onnxruntime_mlas Scanning dependencies of target libprotobuf-lite Scanning dependencies of target re2 Scanning dependencies of target onnxruntime_providers_shared Scanning dependencies of target onnxruntime_mocked_allocator Scanning dependencies of target libprotobuf Scanning dependencies of target gtest [ 0%] Generating onnxruntime.lds, generated_source.c [ 0%] Creating directories for 'project_dnnl' [ 0%] Building CXX object CMakeFiles/onnxruntime_providers_shared.dir/Users/name/code/c/onnxruntime/onnxruntime/core/providers/shared/common.cc.o [ 0%] Building CXX object CMakeFiles/custom_op_library.dir/Users/name/code/c/onnxruntime/onnxruntime/test/testdata/custom_op_library/custom_op_library.cc.o [ 0%] Building CXX object CMakeFiles/onnxruntime_mocked_allocator.dir/Users/name/code/c/onnxruntime/onnxruntime/test/util/test_allocator.cc.o [ 0%] Generating cpp/internal/common.c [ 0%] Building CXX object external/flatbuffers/CMakeFiles/flatbuffers.dir/src/idl_parser.cpp.o [ 0%] Building CXX object external/googletest/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o [ 0%] Building CXX object external/re2/CMakeFiles/re2.dir/re2/bitstate.cc.o [ 0%] Generating cpp/internal/counter.c Generating symbol file for ['cpu', 'dnnl'] VERSION:1.5.2 [ 0%] Building CXX object external/protobuf/cmake/CMakeFiles/libprotobuf-lite.dir/__/src/google/protobuf/any_lite.cc.o [ 0%] Generating cpp/internal/cv.c [ 0%] Performing download step (git clone) for 'project_dnnl' [ 0%] Built target onnxruntime_generate_def [ 0%] Linking CXX shared library libonnxruntime_providers_shared.dylib [ 0%] Building CXX object external/flatbuffers/CMakeFiles/flatbuffers.dir/src/idl_gen_text.cpp.o [ 0%] Generating cpp/internal/debug.c Cloning into 'src'... ld: warning: directory not found for option '-L/Users/name/code/c/onnxruntime/build/MacOS/Release/dnnl/install/lib' [ 1%] Generating cpp/internal/dll.c [ 1%] Building CXX object CMakeFiles/onnxruntime_mlas.dir/Users/name/code/c/onnxruntime/onnxruntime/core/mlas/lib/platform.cpp.

At this point I interrupt the build, since there is already an error occurring.

The directory build/MacOS/Release/dnnl/install does not exist, nor are the DNNL sources downloaded to build/MacOS/Release/dnnl/src. Under Linux these both are populated.

Urgency If there are particular important use cases blocked by this or strict project-related timelines, please share more information and dates. If there are no hard deadlines, please specify none.

System information

To Reproduce

The commands run on both systems are the same:

git clone --recursive https://github.com/Microsoft/onnxruntime
cd onnxruntime
./build.sh --parallel --build_shared_lib --config Release --skip_tests --use_openmp --use_dnnl

Expected behavior A succesfull build of the library.

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here. If the issue is about a particular model, please share the model details as well to facilitate debugging.

jywu-msft commented 4 years ago

can you provide full logs? don't interrupt the build. (can you not use --use_openmp option? dnnl already uses its own openmp library) and also can you build from latest master. the dnnl ep was updated very recently.

j-paulus commented 4 years ago

@jywu-msft Sure. Made a fresh clone from git and run the build, now without --use_openmp.

ort_dnnl_build.txt

j-paulus commented 3 years ago

This is still an issue with the recent v1.6.0 release.

Building with ./build.sh --use_dnnl --build_shared_lib fails to create the dynamic library libonnxruntime_providers_shared.dylib

[ 34%] Linking CXX shared library libonnxruntime_providers_shared.dylib
Undefined symbols for architecture x86_64:
  "Provider_GetHost", referenced from:
     -exported_symbol[s_list] command line option
     (maybe you meant: _Provider_GetHost)
  "Provider_SetHost", referenced from:
     -exported_symbol[s_list] command line option
     (maybe you meant: _Provider_SetHost)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libonnxruntime_providers_shared.dylib] Error 1
make[1]: *** [CMakeFiles/onnxruntime_providers_shared.dir/all] Error 2
make: *** [all] Error 2

Trying to build static libraries with ./build.sh --use_dnnl also fails:

[ 75%] Linking CXX executable onnx_test_runner
Undefined symbols for architecture x86_64:
  "onnx::AttributeProto_AttributeType_descriptor()", referenced from:
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& onnx::AttributeProto_AttributeType_Name<int>(int) in libonnxruntime_framework.a(op_node_proto_helper.cc.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& onnx::AttributeProto_AttributeType_Name<onnx::AttributeProto_AttributeType>(onnx::AttributeProto_AttributeType) in libonnxruntime_framework.a(op_node_proto_helper.cc.o)
  "google::protobuf::internal::NameOfEnum(google::protobuf::EnumDescriptor const*, int)", referenced from:
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& onnx::AttributeProto_AttributeType_Name<int>(int) in libonnxruntime_framework.a(op_node_proto_helper.cc.o)
      std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const& onnx::AttributeProto_AttributeType_Name<onnx::AttributeProto_AttributeType>(onnx::AttributeProto_AttributeType) in libonnxruntime_framework.a(op_node_proto_helper.cc.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [onnx_test_runner] Error 1
make[1]: *** [CMakeFiles/onnx_test_runner.dir/all] Error 2
make: *** [all] Error 2
Traceback (most recent call last):
  File "/Users/name/code/c/onnxruntime/tools/ci_build/build.py", line 2088, in <module>
    sys.exit(main())
  File "/Users/name/code/c/onnxruntime/tools/ci_build/build.py", line 2023, in main
    build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, args.target)
  File "/Users/name/code/c/onnxruntime/tools/ci_build/build.py", line 1060, in build_targets
    run_subprocess(cmd_args, env=env)
  File "/Users/name/code/c/onnxruntime/tools/ci_build/build.py", line 523, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
  File "/Users/name/code/c/onnxruntime/tools/python/util/run.py", line 39, in run
    completed_process = subprocess.run(
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/Applications/CMake.app/Contents/bin/cmake', '--build', '/Users/name/code/c/onnxruntime/build/MacOS/Debug', '--config', 'Debug']' returned non-zero exit status 2.
saudet commented 3 years ago

I'm using this patch here to work around this issue, and DNNL is working just fine for me on Mac as well: https://github.com/bytedeco/javacpp-presets/blob/master/onnxruntime/onnxruntime.patch

j-paulus commented 3 years ago

Checking the current status from the repository and it seems that the build scripts are still failing out-of-the-box. % git clone --recursive https://github.com/microsoft/onnxruntime.git

% cd onnxruntime

% ./build.sh --config Release --build_shared_lib --use_dnnl

This runs for a while until failing with the same issue:

ld: warning: directory not found for option '-L/Users/name/code/c/onnxruntime/build/MacOS/Release/dnnl/install/lib' Undefined symbols for architecture x86_64: "Provider_GetHost", referenced from: -exported_symbol[s_list] command line option (maybe you meant: _Provider_GetHost) "Provider_SetHost", referenced from: -exported_symbol[s_list] command line option (maybe you meant: _Provider_SetHost) ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [libonnxruntime_providers_shared.dylib] Error 1 make[1]: [CMakeFiles/onnxruntime_providers_shared.dir/all] Error 2 make: ** [all] Error 2 Traceback (most recent call last): File "/Users/name/code/c/onnxruntime/tools/ci_build/build.py", line 2003, in sys.exit(main()) File "/Users/name/code/c/onnxruntime/tools/ci_build/build.py", line 1938, in main build_targets(args, cmake_path, build_dir, configs, num_parallel_jobs, args.target) File "/Users/name/code/c/onnxruntime/tools/ci_build/build.py", line 1017, in build_targets run_subprocess(cmd_args, env=env) File "/Users/name/code/c/onnxruntime/tools/ci_build/build.py", line 536, in run_subprocess return run(args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env) File "/Users/name/code/c/onnxruntime/tools/python/util/run.py", line 41, in run completed_process = subprocess.run( File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 512, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/Applications/CMake.app/Contents/bin/cmake', '--build', '/Users/name/code/c/onnxruntime/build/MacOS/Release', '--config', 'Release']' returned non-zero exit status 2.

This is not a critical thing in our project, but it would be nice to be able to benchmark DNNL at some point.

ZacheryGuan commented 3 years ago

I have the same problem as shown by j-paulus above. Do I need to install some DNNL package first?

julioasotodv commented 3 years ago

Yeah, same error ocurring in version 1.7.0.

I believe that, even feasible in theory (as DNNL-CPU for mac exists), building in OSX with DNNL is not supported for now...

stale[bot] commented 2 years ago

This issue has been automatically marked as stale due to inactivity and will be closed in 7 days if no further activity occurs. If further support is needed, please provide an update and/or more details.