microsoft / onnxruntime

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

[Build] Multiple commands produce "..." #22245

Open cyanic-selkie opened 1 day ago

cyanic-selkie commented 1 day ago

Describe the issue

I am simply trying to build the onnxruntime for iOS/simulator on my MacOS. The build works perfectly fine when building for the host, however, when cross compiling for the iOS/simulator, I get the error below.

Urgency

Relatively urgent as we are soon due to release our app. However, I would image not being able to build for a major platform makes it urgent regardless.

Target platform

iphoneos/iphonesimulator

Build script

./build.sh --config Release --parallel --compile_no_warning_as_error --skip_submodule_sync --use_xcode --ios --apple_sysroot <iphoneos|iphonesimulator> --osx_arch arm64 --apple_deploy_target 17 --update --build

Error / output

...

error: Multiple commands produce '/path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_customopregistration_test.app/PlugIns' note: CreateBuildDirectory /path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_customopregistration_test.app/PlugIns note: Target 'onnxruntime_customopregistration_test' (project 'onnxruntime') has create directory command with output '/path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_customopregistration_test.app/PlugIns' error: Multiple commands produce '/path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_logging_apis_test.app/PlugIns' note: CreateBuildDirectory /path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_logging_apis_test.app/PlugIns note: Target 'onnxruntime_logging_apis_test' (project 'onnxruntime') has create directory command with output '/path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_logging_apis_test.app/PlugIns' error: Multiple commands produce '/path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_shared_lib_test.app/PlugIns' note: CreateBuildDirectory /path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_shared_lib_test.app/PlugIns note: Target 'onnxruntime_shared_lib_test' (project 'onnxruntime') has create directory command with output '/path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_shared_lib_test.app/PlugIns' error: Multiple commands produce '/path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_test_all.app/PlugIns' note: CreateBuildDirectory /path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_test_all.app/PlugIns note: Target 'onnxruntime_test_all' (project 'onnxruntime') has create directory command with output '/path/to/onnxruntime/build/iOS/Release/Release-iphoneos/onnxruntime_test_all.app/PlugIns'

...

Visual Studio Version

No response

GCC / Compiler Version

No response

skottmckay commented 1 day ago

Do you have a requirement to build it, or can you use the cocoapod packages?

https://onnxruntime.ai/docs/install/#install-on-ios

cyanic-selkie commented 1 day ago

@skottmckay We do have a requirement to build it because we are linking it to a common rust library that we then use in both the iOS and the Android versions (and eventually web/wasm).

In addition, we would also like to build a minimal version given .ort config.

cyanic-selkie commented 19 hours ago

As a quick workaround, I simply disabled the tests in cmake:

diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 5555fa692e..ffdc66cd88 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -1736,9 +1736,9 @@ if (onnxruntime_BUILD_OBJC)
   list(APPEND ONNXRUNTIME_CMAKE_FILES onnxruntime_objectivec)
 endif()

-if (onnxruntime_BUILD_UNIT_TESTS)
-  list(APPEND ONNXRUNTIME_CMAKE_FILES onnxruntime_unittests)
-endif()
+# if (onnxruntime_BUILD_UNIT_TESTS)
+#   list(APPEND ONNXRUNTIME_CMAKE_FILES onnxruntime_unittests)
+# endif()

 if (onnxruntime_BUILD_WINML_TESTS)
   list(APPEND ONNXRUNTIME_CMAKE_FILES winml_unittests)
skottmckay commented 8 hours ago

We build with unit tests enabled in the CIs and don't see any issues and I can't repro this. Does it happen with a clean build output directory (can set a new one with something like --build_dir build/iOS.new)?

You can disable all the tests with --cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF. This greatly speeds up build time as well.

cyanic-selkie commented 52 minutes ago

Hm, that's interesting.

I literally did this:

  1. git clone --recursive git@github.com:microsoft/onnxruntime.git && cd onnxruntime
  2. ./build.sh --config Release --parallel --compile_no_warning_as_error --skip_submodule_sync --use_xcode --ios --apple_sysroot iphoneos --osx_arch arm64 --apple_deploy_target 17 --update --build

And the error was there. Originally, I built the v1.19.2 tag, but it happens on the main branch as well.

I tried specifying a different build dir, but nothing different happened.

I'm not sure if relevant, but the system cmake version is 3.30.3.

sw_vers output:

ProductName:        macOS
ProductVersion:     14.6.1
BuildVersion:       23G93

xcodebuild --version output:

Xcode 16.0
Build version 16A242d

Disabling the tests with --cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF works, so thanks. We'll just use that for the time being.