您好我正在尝试使用静态链接在Win7 Visual Studio上编译OpenCV(2.6.4)CUDA程序,以便允许程序在未安装CUDA / OpenCV的另一台计算机上运行。我认为我非常接近,但我遇到了这些错误:
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8s_C2R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8s_C3R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8s_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C2R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C2R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32s_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32f_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32f_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8u_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_8u_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16u_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_16s_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32s_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32s_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32f_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiSet_32f_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_8u_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_8u_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_8u_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16u_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16u_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16u_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16s_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16s_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_16s_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32s_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32s_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32s_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32f_C1MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32f_C3MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiCopy_32f_C4MR
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u16u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u16u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u16s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u16s_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_8u32f_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16u32s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16u32f_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16s32s_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16s32f_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16u8u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16u8u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16s8u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_16s8u_C4R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_32f8u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_32f16u_C1R
1>opencv_core246.lib(gpumat.obj) : error LNK2001: unresolved external symbol _nppiConvert_32f16s_C1R
这是我到目前为止所做的。编译OpenCV:
WITH_CUDA = ON,BUILD_SHARED_LIBS = OFF
我运行opencv_test_gpu并确认我的OpenCV是使用CUDA支持构建的。我还确保构建静态库而不是动态库,从* .lib文件大小和简单的编译测试来判断。在VS 2012方面:
包含目录= C:\ opencv_built \ install \ include,运行时库= / MT,库目录= C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v5.5 \ lib \ Win32; C:\ opencv_built \安装\共享\的OpenCV \的3rdParty \ lib中; C:\ opencv_built \安装\ lib中;其他依赖项:cudart_static.lib; opencv_calib3d246.lib; opencv_contrib246.lib; opencv_core246.lib; opencv_features2d246.lib; opencv_flann246.lib; libtiff.lib; libpng.lib; libjpeg.lib; libjasper.lib; IlmImf.lib; zlib.lib ; opencv_highgui246.lib; opencv_imgproc246.lib; opencv_legacy246.lib; opencv_ml246.lib; opencv_nonfree246.lib; opencv_objdetect246.lib; opencv_photo246.lib; opencv_stitching246.lib; opencv_ts246.lib; opencv_video246.lib; opencv_videostab246.lib; Vfw32.Lib; COMCTL32的.lib;%(AdditionalDependencies)。
任何人都可以分享一下它出错的地方吗?
答案 0 :(得分:4)
我不相信(使用CUDA 5.5)使用npp库构建完全静态链接的应用程序是不可能的。这是因为库的一部分是通过dll组件传递的。阅读第15.4节here
事实上,直到最近(CUDA 5.5)a fully statically linkable CUDA runtime library was delivered时,CUDA根本无法做到这一点。因此可以创建普通的CUDA应用程序,这些应用程序不需要运行额外的CUDA dll。但是,AFAIK,库(例如CUBLAS,CUFFT,CUSPARSE,NPP)都有dll组件,并且不提供要链接的库的完全静态版本。
编辑:随着较新的CUDA版本的发布,一些CUDA库已经包含了静态库/链接选项。从CUDA 9.1开始,基本的CUDA运行时库(libcudart)有一个静态选项(libcudart_static
,现在是nvcc
编译的默认选项),CUFFT(libcufft_static
)也是如此, CUBLAS(libcublas_static
),CUSPARSE,CUSOLVER和NVGRAPH。从CUDA 9.0 / 9.1开始,NPP库已被拆分为variety of sub-libraries,但这些库也都是静态版本。