Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win10+vs2019 error compile yolov8 #9

Closed
aiwenzhu opened this issue Jan 30, 2023 · 9 comments
Closed

win10+vs2019 error compile yolov8 #9

aiwenzhu opened this issue Jan 30, 2023 · 9 comments

Comments

@aiwenzhu
Copy link

aiwenzhu commented Jan 30, 2023

环境: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.

@aiwenzhu aiwenzhu changed the title win win10+vs2019 error compile yolov8 Jan 30, 2023
@FeiYull
Copy link
Owner

FeiYull commented Jan 31, 2023

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

@luxuana
Copy link

luxuana commented Jan 31, 2023

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

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

@FeiYull
Copy link
Owner

FeiYull commented Jan 31, 2023

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
Copy link
Author

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
Copy link
Owner

FeiYull commented Jan 31, 2023

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

@aiwenzhu
Copy link
Author

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

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

@luxuana
Copy link

luxuana commented Feb 2, 2023

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

@FeiYull
Copy link
Owner

FeiYull commented Feb 3, 2023

@aiwenzhu Win10教程更新了

@aiwenzhu
Copy link
Author

aiwenzhu commented Feb 6, 2023

@aiwenzhu Win10教程更新了

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

@FeiYull FeiYull mentioned this issue Feb 8, 2023
@FeiYull FeiYull closed this as completed Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants