FeiYull / TensorRT-Alpha

🔥🔥🔥TensorRT for YOLOv8、YOLOv8-Pose、YOLOv8-Seg、YOLOv8-Cls、YOLOv7、YOLOv6、YOLOv5、YOLONAS......🚀🚀🚀CUDA IS ALL YOU NEED.🍎🍎🍎
GNU General Public License v2.0
1.28k stars 198 forks source link

win10+vs2019 error compile yolov8 #9

Closed aiwenzhu closed 1 year ago

aiwenzhu commented 1 year ago

环境:cuda11.1 + tensorrt8.4.1.5+vs2019+opencv3.4.6 编译报错:

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2019 无法解析的外部符号 "void cdecl resizeDevice(int const &,float ,int,int,float ,int,int,float,struct utils::AffineMat)" (?resizeDevice@@YAXAEBHPEAMHH1HHMUAffineMat@utils@@@Z),函数 "public: virtual void cdecl YOLOV8::preprocess(class std::vector<class cv::Mat,class std::allocator > const &)" (?preprocess@YOLOV8@@UEAAXAEBV?$vector@VMat@cv@@V?$allocator@VMat@cv@@@std@@@std@@@Z) 中引用了该符号 tensorrt-alpha-yolov8 E:\Vs_Projects_2023\tensorrt-alpha-yolov8\tensorrt-alpha-yolov8\yolov8.obj 1

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2019 无法解析的外部符号 "void cdecl hwc2chwDevice(int const &,float ,int,int,float ,int,int)" (?hwc2chwDevice@@YAXAEBHPEAMHH1HH@Z),函数 "public: virtual void cdecl YOLOV8::preprocess(class std::vector<class cv::Mat,class std::allocator > const &)" (?preprocess@YOLOV8@@UEAAXAEBV?$vector@VMat@cv@@V?$allocator@VMat@cv@@@std@@@std@@@Z) 中引用了该符号 tensorrt-alpha-yolov8 E:\Vs_Projects_2023\tensorrt-alpha-yolov8\tensorrt-alpha-yolov8\yolov8.obj 1

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2019 无法解析的外部符号 "void cdecl nmsDeviceV1(struct utils::InitParameter,float *,int,int,int)" (?nmsDeviceV1@@YAXUInitParameter@utils@@PEAMHHH@Z),函数 "public: virtual void cdecl YOLOV8::postprocess(class std::vector<class cv::Mat,class std::allocator > const &)" (?postprocess@YOLOV8@@UEAAXAEBV?$vector@VMat@cv@@V?$allocator@VMat@cv@@@std@@@std@@@Z) 中引用了该符号 tensorrt-alpha-yolov8 E:\Vs_Projects_2023\tensorrt-alpha-yolov8\tensorrt-alpha-yolov8\yolov8.obj 1

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2001 无法解析的外部符号 "public: virtual void __cdecl yolo::YOLO::reset(void)" (?reset@YOLO@yolo@@UEAAXXZ) tensorrt-alpha-yolov8 E:\Vs_Projects_2023\tensorrt-alpha-yolov8\tensorrt-alpha-yolov8\yolov8.obj 1

严重性 代码 说明 项目 文件 行 禁止显示状态 错误 LNK2019 无法解析的外部符号 "void cdecl yolov8::transposeDevice(struct utils::InitParameter,float ,int,int,int,float ,int,int)" (?transposeDevice@yolov8@@YAXUInitParameter@utils@@PEAMHHH1HH@Z),函数 "public: virtual void cdecl YOLOV8::postprocess(class std::vector<class cv::Mat,class std::allocator > const &)" (?postprocess@YOLOV8@@UEAAXAEBV?$vector@VMat@cv@@V?$allocator@VMat@cv@@@std@@@std@@@Z) 中引用了该符号 tensorrt-alpha-yolov8 E:\Vs_Projects_2023\tensorrt-alpha-yolov8\tensorrt-alpha-yolov8\yolov8.obj 1

报了28个类似的错误

尝试直接在cmd里用cmake编译也失败: CMake Error at CMakeLists.txt:6 (PROJECT): No CMAKE_CUDA_COMPILER could be found.

FeiYull commented 1 year ago

@aiwenzhu 您好。 i) 报错可能原因:.cu文件及其头文件需要设置nvcc编译, .cpp和.h则是MSVC编译。 ii) win10环境没试过cmake,可以等待更新教程,就在近期。 iii)已经有小伙伴反馈通过修改cmakelist.txt之后,在win10环境生成vs2019工程,并成功运行。

luxuana commented 1 year ago

cuda 没装好 cudnn 确定了吗? public: virtual void __cdecl YOLOV8::postprocess(class std::vector<class cv::Mat,class std::allocator >

opencv 自己编译一下 不然 cmake 找不到

FeiYull commented 1 year ago

cuda 没装好 cudnn 确定了吗?

public: virtual void __cdecl YOLOV8::postprocess(class std::vector<class cv::Mat,class std::allocator >

opencv 自己编译一下 不然 cmake 找不到

@aiwenzhu 他在Win10自己修改cmake成功运行了 @luxuana 666

aiwenzhu commented 1 year ago

cuda 没装好 cudnn 确定了吗? public: virtual void __cdecl YOLOV8::postprocess(class std::vector<class cv::Mat,class std::allocator >

opencv 自己编译一下 不然 cmake 找不到

hi 你好,感谢回复,我测试了cuda11.1和cuda11.6,有cudnn,和带cuda一起编译的opencv,我在vs里把cu文件设置了nvcc编译还是报同样的问题; 有以下几个问题想请教:

1.是否cuda和tensorrt环境必须是cuda11.3,cudnn8.2.0,tensorrt8.4.2.4 2.这是我在vs的环境配置是否有错误: 包含目录:E:\AIProjects\yolov8-tensorrt-master\utils; D:\software_location\TensorRT-8.4.2.4\samples\common; C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.6\common\inc; D:\software_location\TensorRT8.4.2.4\include; D:\software_location\opencv452_cuda110\include; D:\software_location\opencv452_cuda110\include\opencv2; C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include;$(IncludePath)

      库目录:D:\software_location\TensorRT-8.4.2.4\lib;
                  C:\ProgramData\NVIDIA Corporation\CUDA Samples\v11.6\common\lib\x64;
                  C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\lib\x64;
                  D:\software_location\opencv452_cuda110\x64\vc16\lib;$(LibraryPath)
      链接器:

opencv_world452.lib;cuda.lib;cudart.lib;nvinfer.lib;nvinfer_plugin.lib;nvonnxparser.lib;nvparsers.lib;cublas.lib;cublasLt.lib;cudadevrt.lib;cudart_static.lib;cudnn.lib;cudnn64_8.lib;cudnn_adv_infer.lib;cudnn_adv_infer64_8.lib;cudnn_adv_train.lib;cudnn_adv_train64_8.lib;cudnn_cnn_infer.lib;cudnn_cnn_infer64_8.lib;cudnn_cnn_train.lib;cudnn_cnn_train64_8.lib;cudnn_ops_infer.lib;cudnn_ops_infer64_8.lib;cudnn_ops_train.lib;cudnn_ops_train64_8.lib;cufft.lib;cufftw.lib;curand.lib;cusolver.lib;cusolverMg.lib;cusparse.lib;nppc.lib;nppial.lib;nppicc.lib;nppidei.lib;nppif.lib;nppig.lib;nppim.lib;nppist.lib;nppisu.lib;nppitc.lib;npps.lib;nvblas.lib;nvjpeg.lib;nvml.lib;nvrtc.lib;OpenCL.lib;

3.我把所有的sample::gLogError << 这种输出的代码注释掉,无法解析的外部符号 "class sample::LogStreamConsumer sample::gLogError"这个错误就没了,难道是缺lib吗,我又找不到更多相关的lib了

4.如果我通过修改cmakeLists.txt的方式,也是报了20几个无法解析的外部符号,common.cmake我的修改如下: set(TensorRT_ROOT D:/software_location/TensorRT-8.4.2.4)这里改了win下的tensorrt位置 这一行注释掉了因为我发现找不到这个lib #find_library(TRT_NVCAFFE_PARSER NAMES nvcaffe_parser HINTS ${TensorRT_ROOT} PATH_SUFFIXES lib lib64 lib/x64)

cmakeLists.txt修改如下: set(CMAKE_BUILD_TYPE "Release")这里用了release,因为我的opencv编译的额release set(OpenCV_DIR D:/software_location/opencv452_cuda110)加了opencv具体路径,因为cmake报错找不到opencv

FeiYull commented 1 year ago

@aiwenzhu @luxuana 这周末出Win10教程,不用cmake,几个步骤。tensorrt最好使用8.4.2.4版本。

aiwenzhu commented 1 year ago

@aiwenzhu 这周末出Win10教程,不用cmake,几个步骤。tensorrt最好使用8.4.2.4版本。

好的,我先学习相关内容,哈哈,等大佬更新

luxuana commented 1 year ago

沃德发 ? 我还在村里种地,等我播完种先哈! @FeiYull @aiwenzhu 我 750 显卡 10.2CUDA TRT 8.4.1.5 OpenCV 4.7

FeiYull commented 1 year ago

@aiwenzhu Win10教程更新了

aiwenzhu commented 1 year ago

@aiwenzhu Win10教程更新了

已按照教程运行成功,谢谢