microsoft / onnxruntime

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

Failed to build onnxruntime on Apple Sillion #11805

Open Lyken17 opened 2 years ago

Lyken17 commented 2 years ago

Describe the bug Latest ONNXRuntime failed to build on Macbook M1 Air.

Urgency This is general situation that most Apple Sillion users will meet when trying to use onnxruntime. I would rate this issue as important since more and more mac users are switching to M1 chips.

System information

To Reproduce

git clone https://github.com/microsoft/onnxruntime --recursive
cd onnxruntime
./build.sh --config RelWithDebInfo --build_shared_lib --parallel --use_xcode --osx_arch arm64 --build_wheel

Expected behavior

6: Test command: /Users/ligeng/Workspace/onnxruntime/build/MacOS/RelWithDebInfo/RelWithDebInfo/onnxruntime_api_tests_without_env "--gtest_output=xml:/Users/ligeng/Workspace/onnxruntime/build/MacOS/RelWithDebInfo/RelWithDebInfo/onnxruntime_api_tests_without_env.RelWithDebInfo.results.xml"
6: Test timeout computed to be: 7200
6: [==========] Running 1 test from 1 test suite.
6: [----------] Global test environment set-up.
6: [----------] 1 test from TestSessionOptions
6: [ RUN      ] TestSessionOptions.SetIntraOpNumThreadsWithoutEnv
6: [       OK ] TestSessionOptions.SetIntraOpNumThreadsWithoutEnv (0 ms)
6: [----------] 1 test from TestSessionOptions (0 ms total)
6:
6: [----------] Global test environment tear-down
6: [==========] 1 test from 1 test suite ran. (0 ms total)
6: [  PASSED  ] 1 test.
6/6 Test #6: onnxruntime_api_tests_without_env ......   Passed    0.06 sec

100% tests passed, 0 tests failed out of 6

Total Test time (real) =  14.83 sec
2022-06-10 03:46:21,862 util.run [DEBUG] - Subprocess completed. Return code: 0
2022-06-10 03:46:21,863 util.run [INFO] - Running subprocess in '/Users/ligeng/Workspace/onnxruntime/build/MacOS/RelWithDebInfo'
  /Users/ligeng/miniforge3/bin/python3 onnxruntime_test_python.py
/Users/ligeng/miniforge3/bin/python3: can't open file '/Users/ligeng/Workspace/onnxruntime/build/MacOS/RelWithDebInfo/onnxruntime_test_python.py': [Errno 2] No such file or directory
Traceback (most recent call last):
  File "/Users/ligeng/Workspace/onnxruntime/tools/ci_build/build.py", line 2725, in <module>
    sys.exit(main())
  File "/Users/ligeng/Workspace/onnxruntime/tools/ci_build/build.py", line 2647, in main
    run_onnxruntime_tests(args, source_dir, ctest_path, build_dir, configs)
  File "/Users/ligeng/Workspace/onnxruntime/tools/ci_build/build.py", line 1813, in run_onnxruntime_tests
    run_subprocess(
  File "/Users/ligeng/Workspace/onnxruntime/tools/ci_build/build.py", line 707, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
  File "/Users/ligeng/Workspace/onnxruntime/tools/python/util/run.py", line 49, in run
    completed_process = subprocess.run(
  File "/Users/ligeng/miniforge3/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/Users/ligeng/miniforge3/bin/python3', 'onnxruntime_test_python.py']' returned non-zero exit status 2.

It seems the onnxruntime_test_python.py is missing. Did I miss any instructions? Or is this file deleted in previous commits?

Lyken17 commented 2 years ago
image

It seems the file is not under repository.

Lyken17 commented 2 years ago

After temporarliy disabling the test tools/ci_build/build.py#L1718, it raises the following errors


2022-06-10 04:20:46,038 util.run [DEBUG] - Subprocess completed. Return code: 0
2022-06-10 04:20:46,039 util.run [INFO] - Running subprocess in '/Users/ligeng/Workspace/onnxruntime/build/MacOS/RelWithDebInfo'
  /Users/ligeng/miniforge3/bin/python3 /Users/ligeng/Workspace/onnxruntime/setup.py bdist_wheel
running bdist_wheel
running build
running build_py
package init file 'onnxruntime/__init__.py' not found (or not a regular file)
error: package directory 'onnxruntime/backend' does not exist
Traceback (most recent call last):
  File "/Users/ligeng/Workspace/onnxruntime/tools/ci_build/build.py", line 2726, in <module>
    sys.exit(main())
  File "/Users/ligeng/Workspace/onnxruntime/tools/ci_build/build.py", line 2669, in main
    build_python_wheel(
  File "/Users/ligeng/Workspace/onnxruntime/tools/ci_build/build.py", line 2032, in build_python_wheel
    run_subprocess(args, cwd=cwd)
  File "/Users/ligeng/Workspace/onnxruntime/tools/ci_build/build.py", line 707, in run_subprocess
    return run(*args, cwd=cwd, capture_stdout=capture_stdout, shell=shell, env=my_env)
  File "/Users/ligeng/Workspace/onnxruntime/tools/python/util/run.py", line 49, in run
    completed_process = subprocess.run(
  File "/Users/ligeng/miniforge3/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/Users/ligeng/miniforge3/bin/python3', '/Users/ligeng/Workspace/onnxruntime/setup.py', 'bdist_wheel']' returned non-zero exit status 1.

Weird thing is that I cannot find backend folder under this repo.