shimat / opencvsharp

OpenCV wrapper for .NET
Apache License 2.0
5.22k stars 1.13k forks source link

Linkage errors #1670

Closed phoebus1997 closed 1 month ago

phoebus1997 commented 1 month ago

Summary of your issue

I built OpenCV 4.9.0 with CUDA and cuDNN enabled without issues (had to use CUDA 12.3.2 and cuDNN 8.9.6 for compatibility). When building OpenCVSharp I get some errors related to linkage on OpenCVSharpExtern, even if I linked the libraries (or, at least, as far as I can tell).

Environment

Windows 10 Pro machine, version 22H2. Visual Studio Enterprise 2022 edition Nvidia CUDA 12.3.2 Nvidia cuDNN 8.9.6 OpenCV 4.9.0 OpenCV_Contrib 4.9.0 OpenCVSharp 4.9.0.20240106

What did you do when you faced the problem?

Built the whole solution, with errors

Output:

4>tiff.lib(tif_warning.c.obj) : error LNK2005: _TIFFwarningHandlerExt already defined in libtiff.lib(tif_warning.obj)
4>tiff.lib(tif_error.c.obj) : error LNK2005: _TIFFerrorHandlerExt already defined in libtiff.lib(tif_error.obj)
4>   Creating library D:\OpenCV\opencvsharp-main\src\Release\x64\OpenCvSharpExtern.lib and object D:\OpenCV\opencvsharp-main\src\Release\x64\OpenCvSharpExtern.exp
4>opencv_cudacodec490.lib(video_reader.obj) : error LNK2001: unresolved external symbol cuvidMapVideoFrame64
4>opencv_cudacodec490.lib(video_reader.obj) : error LNK2001: unresolved external symbol cuvidUnmapVideoFrame64
4>opencv_cudacodec490.lib(video_reader.obj) : error LNK2001: unresolved external symbol cuvidCtxLockCreate
4>opencv_cudacodec490.lib(video_reader.obj) : error LNK2001: unresolved external symbol cuvidCtxLock
4>opencv_cudacodec490.lib(video_reader.obj) : error LNK2001: unresolved external symbol cuvidCtxUnlock
4>opencv_cudacodec490.lib(video_reader.obj) : error LNK2001: unresolved external symbol cuvidDestroyVideoParser
4>opencv_cudacodec490.lib(cuvid_video_source.obj) : error LNK2001: unresolved external symbol cuvidCreateVideoSource
4>opencv_cudacodec490.lib(cuvid_video_source.obj) : error LNK2001: unresolved external symbol cuvidDestroyVideoSource
4>opencv_cudacodec490.lib(cuvid_video_source.obj) : error LNK2001: unresolved external symbol cuvidSetVideoSourceState
4>opencv_cudacodec490.lib(cuvid_video_source.obj) : error LNK2001: unresolved external symbol cuvidGetVideoSourceState
4>opencv_cudacodec490.lib(cuvid_video_source.obj) : error LNK2001: unresolved external symbol cuvidGetSourceVideoFormat
4>opencv_cudacodec490.lib(video_decoder.obj) : error LNK2001: unresolved external symbol cuvidGetDecoderCaps
4>opencv_cudacodec490.lib(video_decoder.obj) : error LNK2001: unresolved external symbol cuvidCreateDecoder
4>opencv_cudacodec490.lib(video_decoder.obj) : error LNK2001: unresolved external symbol cuvidDestroyDecoder
4>opencv_cudacodec490.lib(video_decoder.obj) : error LNK2001: unresolved external symbol cuvidReconfigureDecoder
4>opencv_cudacodec490.lib(video_parser.obj) : error LNK2001: unresolved external symbol cuvidDecodePicture
4>opencv_cudacodec490.lib(video_parser.obj) : error LNK2001: unresolved external symbol cuvidCreateVideoParser
4>opencv_cudacodec490.lib(video_parser.obj) : error LNK2001: unresolved external symbol cuvidParseVideoData
4>libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore
4>libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertOpenStore
4>libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore
4>libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertCloseStore
4>libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertEnumCertificatesInStore
4>libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertEnumCertificatesInStore
4>libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertFindCertificateInStore
4>libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertFindCertificateInStore
4>libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertDuplicateCertificateContext
4>libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext
4>libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateContext
4>libcrypto.lib(libcrypto-lib-e_capi.obj) : error LNK2001: unresolved external symbol __imp_CertGetCertificateContextProperty
4>libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_CryptStringToBinaryW
4>libcurl.lib(schannel.c.obj) : error LNK2001: unresolved external symbol __imp_PFXImportCertStore
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CryptDecodeObjectEx
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertAddCertificateContextToStore
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertFindExtension
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertGetNameStringW
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CryptQueryObject
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertCreateCertificateChainEngine
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateChainEngine
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertGetCertificateChain
4>libcurl.lib(schannel_verify.c.obj) : error LNK2001: unresolved external symbol __imp_CertFreeCertificateChain
4>D:\OpenCV\opencvsharp-main\src\Release\x64\OpenCvSharpExtern.dll : fatal error LNK1120: 36 unresolved externals
4>Done building project "OpenCvSharpExtern.vcxproj" -- FAILED.