2

Hi I am trying to compile a OpenCV (2.6.4) CUDA program on my Win7 Visual Studio, using static link in order to allow the program to run on another computer without CUDA/OpenCV installed. I think i got pretty close but I get stuck in these errors:

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

Here's what I did so far. Compiled OpenCV with:

WITH_CUDA = ON, BUILD_SHARED_LIBS = OFF

I ran opencv_test_gpu and confirmed my OpenCV was built with CUDA support. I also ensure static libs are built instead of dynamic libs, judging from the *.lib file size and simple compilation test. On the VS 2012 side:

Include Directory = C:\opencv_built\install\include, Runtime Library = /MT, Library directory = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\lib\Win32;C:\opencv_built\install\share\OpenCV\3rdparty\lib;C:\opencv_built\install\lib; Additional Dependencies: 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).

Can anyone please share some insight where did it went wrong?

6
  • Try adding npp.lib to your libraries in additional dependencies, like this: cudart_static.lib;npp.lib;opencv_calib3d246.lib;... Feb 22, 2014 at 3:30
  • Hi I just tried that minutes ago, but I tried it with nppc.lib, nppi.lib, npps.lib because I don't have npp.lib in the folder. The solution compiles now, but are those libraries static ones? As I don't have a machine to test now, I am unsure whether will the executable run on another machine without OpenCV/CUDA. Feb 22, 2014 at 3:53
  • Typically in windows shared libraries are using the filename extension .dll whereas static libraries are using the filename extension .lib So, yes, those libraries ending in .lib are static. And yes, those libraries (nppc.lib, nppi.lib, npps.lib) are the correct ones to link in. I was looking at an older version of CUDA toolit when I mentioned npp.lib Feb 22, 2014 at 4:13
  • Hi I just moved the exe to another computer but unfortunately I got an error launching the exe. About nppi32_55.dll is missing Feb 22, 2014 at 4:16
  • 1
    @RobertCrovella, typically, .dlls are also used via .libs. The .libs are then called import libraries and contain stubs for the functions in the corresponding .dll.
    – Roger Dahl
    Feb 23, 2014 at 23:11

1 Answer 1

4

I don't believe it's possible (currently, with CUDA 5.5) to build a fully statically-linked application using the npp library. That is because a portion of the library is delivered via a dll component. Read section 15.4 here

In fact, this was not possible at all with CUDA until recently (CUDA 5.5) when a fully statically linkable CUDA runtime library was delivered. So ordinary CUDA applications can be created which don't require additional CUDA dll's to run. However, AFAIK, the libraries (e.g. CUBLAS, CUFFT, CUSPARSE, NPP) all have dll components, and don't offer a fully static version of the library to link against.

EDIT: As newer CUDA versions have been released, some CUDA libraries have incorporated static library/link options. As of CUDA 9.1, the basic CUDA runtime library (libcudart) has a static option (libcudart_static, which is now the default option for nvcc compilation), as do CUFFT (libcufft_static), CUBLAS (libcublas_static), CUSPARSE, CUSOLVER, and NVGRAPH. As of CUDA 9.0/9.1, the NPP libraries have been split into a variety of sub-libraries, but these are all available in static versions as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.