mmdeploy
mmdeploy copied to clipboard
Fail to build C++ SDK when use the cmake command
Hi developers of mmdeploy. My environment is Win10, Cuda11.3, VS2017, cudnn8.2.0, Python3.7, Pytorch1.11.0, mmcv-full1.4.8, mmdet2.23.0. I can convert my model to tensorrt successfully in Win 10. But I encountered errors when I try to use the cmake command to build the SDK. The following is the command.
mkdir build
cd build
cmake ..\cpp -A x64 -T v141
-DMMDEPLOY_BUILD_SDK=ON
-DMMDEPLOY_BUILD_SDK_CXX_API=ON
-DMMDEPLOY_BUILD_TEST=ON
-DMMDEPLOY_TARGET_DEVICES="cuda"
-DMMDEPLOY_TARGET_BACKENDS="trt"
-DMMDEPLOY_CODEBASES="all"
-DONNXRUNTIME_DIR="D:\...\onnxruntime"
-DOpenCV_DIR="D:\opencv2\opencv\build\x64\vc15\lib"
-DMMDeploy_DIR="C:\Users\Administrator\source\repos\C++_And_Python\mmdeploy-0.7.0-windows-amd64-onnxruntime1.8.1\sdk\lib\cmake\MMDeploy"
-DTENSORRT_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\tensorrt\TensorRT-8.4.3.1"
-DCUDNN_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3"
The following is the error message.
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.16.27048.0
-- The CXX compiler identification is MSVC 19.16.27048.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/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: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: D:/opencv2/opencv/build (found version "3.4.14")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
CMake Error at CMakeLists.txt:6 (target_link_libraries):
Cannot specify link libraries for target "PRIVATE" which is not built by
this project.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Administrator/source/repos/C++_And_Python/mmdeploy-0.7.0-windows-amd64-onnxruntime1.8.1/sdk/example/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Administrator/source/repos/C++_And_Python/mmdeploy-0.7.0-windows-amd64-onnxruntime1.8.1/sdk/example/build/CMakeFiles/CMakeError.log".
In order to convert model successfully, I strictly follow the instructions to set up the mmdeploy environment and it works. Is something wrong with my execuation? Please help me with the error. Thank you very much.
Please use mmdeploy-0.7.0-windows-amd64-cuda11.1-tensorrt8.2.3.0.zip instead of mmdeploy-0.7.0-windows-amd64-onnxruntime1.8.1
It seems like that you are building examples. Your cmake command is not right. To build examples, there is no need to pass DMMDEPLOY_BUILD_SDK, DMMDEPLOY_BUILD_SDK_CXX_API, DMMDEPLOY_BUILD_TEST, etc.
For how to build examples, you can refer to this doc
@irexyc I am trying to build C++ SDK environment so that I can call my model by C++. Is that what you mean examples?
@yeungkong Your cmake command not only pass the MMDeploy_DIR option,but also pass MMDEPLOY_BUILD_SDK option. It seems that there is no document tells that. Which document do you follow?
If you want to build mmdeploy and use the built mmdeploy to build mmdeploy-examples,please follow this doc
If you want to use the prebuilt package to build exampels, please follow this doc
According to your cmake log, your working dir is C:/Users/Administrator/source/repos/C++_And_Python/mmdeploy-0.7.0-windows-amd64-onnxruntime1.8.1/sdk/example. It seems that you are using the prebuilt package, is that right? If so, you use the wrong cmake command and you should use mmdeploy-0.7.0-windows-amd64-cuda11.1-tensorrt8.2.3.0 instead.
你是不是在用预编译包,然后想编译预编译包中的example?如果是的话,你用错预编译包了,如果要支持trt,你应该用mmdeploy-0.7.0-windows-amd64-cuda11.1-tensorrt8.2.3.0这个包,然后编译命令也不对,似乎没有文档是你那种用法,具体的可以参考上面列出来的两个文档。
Hi, @yeungkong it is still an issue for you?