Closed aChang146 closed 2 years ago
According to the log failed to load library mmdeploy_ort_net
, the exe loads mmdeploy_ort_net.dll failed.
You may try to check if is it is due to misuse of onnxruntime.dll https://github.com/open-mmlab/mmdeploy/blob/master/docs/zh_cn/faq.md#onnx-runtime
According to the log
failed to load library mmdeploy_ort_net
, the exe loads mmdeploy_ort_net.dll failed.You may try to check if is it is due to misuse of onnxruntime.dll https://github.com/open-mmlab/mmdeploy/blob/master/docs/zh_cn/faq.md#onnx-runtime
I tried copying the onnxruntime.dll to the sibling directory of mmdeploy_onnxruntime_ops.dll as described above and it still failed,The error log is as follows:
cmake ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.32.31332.0
-- The CXX compiler identification is MSVC 19.32.31332.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/vs2019/1/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - 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: D:/vs2019/1/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- OpenCV ARCH: x64
-- OpenCV RUNTIME: vc15
-- OpenCV STATIC: OFF
-- Found OpenCV: D:/Opencv4.5.5/opencv/build (found version "4.5.5")
-- Found OpenCV 4.5.5 in D:/Opencv4.5.5/opencv/build/x64/vc15/lib
-- You might need to add D:\Opencv4.5.5\opencv\build\x64\vc15\bin to your PATH to be able to run your applications.
CMake Error at D:/mmdeploy/build/MMDeployConfig.cmake:12 (include):
include could not find requested file:
D:/mmdeploy/build/MMDeployTargets.cmake
Call Stack (most recent call first):
CMakeLists.txt:6 (find_package)
CMake Error at D:/mmdeploy/build/MMDeployConfig.cmake:45 (find_package):
By not providing "FindONNXRUNTIME.cmake" in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
"ONNXRUNTIME", but CMake did not find one.
Could not find a package configuration file provided by "ONNXRUNTIME" with
any of the following names:
ONNXRUNTIMEConfig.cmake
onnxruntime-config.cmake
Add the installation prefix of "ONNXRUNTIME" to CMAKE_PREFIX_PATH or set
"ONNXRUNTIME_DIR" to a directory containing one of the above files. If
"ONNXRUNTIME" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
CMakeLists.txt:6 (find_package)
-- Configuring incomplete, errors occurred!
See also "D:/mmdeploy/onnx_infer/build/CMakeFiles/CMakeOutput.log".
CMakeLists.txts is as follows:
cmake_minimum_required(VERSION 3.14)
project(mmdeploy-example)
find_package(OpenCV REQUIRED)
set(MMDEPLOY "D:\\mmdeploy\\build\\install\\bin")
set(MMDeploy_DIR "D:\\mmdeploy\\build")
find_package(MMDeploy)
# Add OpenCV headers location to your include paths
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${MMDEPLOY}/include)
add_executable(detect onnx_infer.cpp)
target_link_libraries(detect ${OpenCV_LIBS} mmdeploy)
I tried copying the onnxruntime.dll to the sibling directory of mmdeploy_onnxruntime_ops.dll as described above and it still failed,The error log is as follows:
How did you compile it successfully for the first time? As your original problem is failed to load library mmdeploy_ort_net
other than build error
You can't only copy to onnxruntime.dll
but copy all dll files in D:\onnxruntime-win-x64-1.11.0\lib folder.
If mmdeploy_core.dll located in D:\mydll
, and you add D:\mydll
to the PATH
, you also need to copy onnx dlls to D:\mydll
.
Thanks,I have solved this problem by changing the CMakeLists.txt as follows:
cmake_minimum_required(VERSION 3.14)
project(mmdeploy-example)
find_package(OpenCV REQUIRED)
set(MMDEPLOY "D:\\mmdeploy\\build\\install\\bin")
set(MMDeploy_DIR "D:\\mmdeploy\\build\\install\\lib\\cmake\\MMDeploy")
find_package(MMDeploy)
# Add OpenCV headers location to your include paths
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${MMDEPLOY}/include)
add_executable(detect onnx_infer.cpp)
target_link_libraries(detect ${OpenCV_LIBS} mmdeploy)
I tried copying the onnxruntime.dll to the sibling directory of mmdeploy_onnxruntime_ops.dll as described above and it still failed,The error log is as follows:
How did you compile it successfully for the first time? As your original problem is
failed to load library mmdeploy_ort_net
other thanbuild error
I recompiled the mmdeploy library according to the following tutorial https://github.com/open-mmlab/mmdeploy/blob/master/docs/en/02-how-to-run/prebuilt_package_windows.md
, and then copied the **onnxruntime.dll**
to the same directory of **mmdeploy.dll**
, after this operation, I can execute build/bin/Release/object_detection.exe, for the second manual compilation problem, I took a CMakeLists.txt that looks like this:
cmake_minimum_required(VERSION 3.14)
project(mmdeploy-example)
find_package(OpenCV REQUIRED)
set(MMDEPLOY "D:\\mmdeploy\\build\\install\\bin")
set(MMDeploy_DIR "D:\\mmdeploy\\build\\install\\lib\\cmake\\MMDeploy")
find_package(MMDeploy)
# Add OpenCV headers location to your include paths
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${MMDEPLOY}/include)
add_executable(detect onnx_infer.cpp)
target_link_libraries(detect ${OpenCV_LIBS} mmdeploy)
Executed the following command:
mkdir build&&cd build
cmake ..
The execution result of this command is as follows:
cmake ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
-- The C compiler identification is MSVC 19.32.31332.0
-- The CXX compiler identification is MSVC 19.32.31332.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: D:/vs2019/1/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - 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: D:/vs2019/1/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- OpenCV ARCH: x64
-- OpenCV RUNTIME: vc15
-- OpenCV STATIC: OFF
-- Found OpenCV: D:/Opencv4.5.5/opencv/build (found version "4.5.5")
-- Found OpenCV 4.5.5 in D:/Opencv4.5.5/opencv/build/x64/vc15/lib
-- You might need to add D:\Opencv4.5.5\opencv\build\x64\vc15\bin to your PATH to be able to run your applications.
-- OpenCV ARCH: x64
-- OpenCV RUNTIME: vc15
-- OpenCV STATIC: OFF
-- Found OpenCV 4.5.5 in D:/Opencv4.5.5/opencv/build/x64/vc15/lib
-- You might need to add D:\Opencv4.5.5\opencv\build\x64\vc15\bin to your PATH to be able to run your applications.
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: D:/mmdeploy/cmake_build_test/build
Then,I executed the following command:
cmake --build . --config Release
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 17.2.1+52cd2da31
版权所有(C) Microsoft Corporation。保留所有权利。
Checking Build System
Building Custom Rule D:/mmdeploy/cmake_build_test/CMakeLists.txt
onnx_infer.cpp
detect.vcxproj -> D:\mmdeploy\cmake_build_test\build\Release\detect.exe
Building Custom Rule D:/mmdeploy/cmake_build_test/CMakeLists.txt
After that, in order to ensure that detect.exe can be executed correctly, I added the directory of the dynamic link library that detect.exe may use to the PATH
, and then the program can run correctly
I have the following problem when I call the SDK of C++ on win10:
I configured the environment on win10 according to the following link:
After the environment configuration is completed, the following files are included in
mmdeploy/build/bin/release/
It seems that I have successfully compiled onnxruntime, but when calling the SDK objcet_detector.exe, the onnxruntime library cannot be found(I have added the installation directory of onnxtruntime( D:\onnxruntime-win-x64-1.11.0\lib)to the
path
of the system). How to solve this problem?My anaconda environment is as follows: