onnxruntime
onnxruntime copied to clipboard
[Build] onnxruntime_providers_shared not provided.
Describe the issue
I tried to build onnxruntime with CUDA support. I'm using CUDA Toolkit 11.8.
But while generating CMake, got the following error.
Urgency
Urgent!!!
Target platform
Windows 10
Build script
build.bat ^ --config Release ^ --parallel 0 ^ --use_cuda ^ --cmake_generator="Visual Studio 17 2022" ^ --minimal_build ^ --enable_reduced_operator_type_support ^ --skip_tests ^ --cuda_home “C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8” ^ --cudnn_home “C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8” ^ --enable_cuda_line_info ^ --enable_pybind ^ --build_wheel ^ --build_csharp ^ --build_nuget ^ --build_nodejs ^ --build_shared_lib ^ --use_full_protobuf
Error / output
CMake Error at onnxruntime_python.cmake:890 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_python.cmake:890 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_python.cmake:890 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_python.cmake:890 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_providers.cmake:513 (add_dependencies):
The dependency target "onnxruntime_providers_shared" of target
"onnxruntime_providers_cuda_obj" does not exist.
Call Stack (most recent call first):
onnxruntime_providers.cmake:603 (config_cuda_provider_shared_module)
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_providers.cmake:513 (add_dependencies):
The dependency target "onnxruntime_providers_shared" of target
"onnxruntime_providers_cuda" does not exist.
Call Stack (most recent call first):
onnxruntime_providers.cmake:604 (config_cuda_provider_shared_module)
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_providers.cmake:513 (add_dependencies):
The dependency target "onnxruntime_providers_shared" of target
"onnxruntime_providers_cuda_ut" does not exist.
Call Stack (most recent call first):
onnxruntime_unittests.cmake:764 (config_cuda_provider_shared_module)
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_python.cmake:890 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_python.cmake:890 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_python.cmake:890 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1693 (include)
CMake Error at onnxruntime_python.cmake:890 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1693 (include)
-- Generating done (3.0s)
CMake Warning:
Manually-specified variables were not used by the project:
ONNX_USE_MSVC_STATIC_RUNTIME
Onnxruntime_GCOV_COVERAGE
Protobuf_USE_STATIC_LIBS
CMake Generate step failed. Build files cannot be regenerated correctly.
Visual Studio Version
Visual Studio 17 2022
GCC / Compiler Version
No response
It seems minimal_build and shared_lib are not supported altogether (https://github.com/microsoft/onnxruntime/blob/main/cmake/onnxruntime_providers_cpu.cmake#L220). +@skottmckay
Minimal build works fine with a shared library in general as we build that way with the CPU EP, NNAPI, CoreML and XNNPACK EPs depending on the platform/package we're building.
Minimal build however makes no sense with CUDA as the savings from doing a minimal build are tiny in comparison to the size of the CUDA kernels. Given that, we have never looked at enabling the CUDA setup (which builds a separate library for the CUDA EP) with a minimal build and it's not surprising it breaks.
Please remove --minimal_build
from your build command.
It is possible to do a reduced operators/types build, but you have to provide a config file listing what should be included. You don't seem to have that, so I'd also suggest removing --enable_reduced_operator_type_support
.
I have the same thing when I use cmake -Donnxruntime_USE_OPENVINO=ON -Donnxruntime_ENABLE_PYTHON=ON
on macOS:
-- Configuring done (2.0s)
CMake Error at onnxruntime_python.cmake:876 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1722 (include)
CMake Error at onnxruntime_providers_openvino.cmake:44 (add_dependencies):
The dependency target "onnxruntime_providers_shared" of target
"onnxruntime_providers_openvino" does not exist.
Call Stack (most recent call first):
onnxruntime_providers.cmake:144 (include)
CMakeLists.txt:1722 (include)
CMake Error at onnxruntime_python.cmake:876 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1722 (include)
CMake Error at onnxruntime_python.cmake:876 (add_custom_command):
Error evaluating generator expression:
$<TARGET_FILE:onnxruntime_providers_shared>
No target "onnxruntime_providers_shared"
Call Stack (most recent call first):
CMakeLists.txt:1722 (include)
@xadupre
Thanks for your reply.
No target "onnxruntime_providers_shared"
This error never showed again but got another problem.
So I tried to build with 1.16.3 release code but got the following error.
2024-01-22 09:46:55,115 util.run [INFO] - Running subprocess in 'D:\project\onnxruntime-1.16.3'
git submodule sync --recursive
fatal: not a git repository (or any of the parent directories): .git
Could you please provide how to resolve this issue? cc: @skottmckay
The source are provided by default when github publishes a new releases but git dependencies are not included. To build a specific version, you need to clone the reposity and switch to the branch with tag 1.6.3.
This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.