Ask Your Question
0

OpenCV 2.4.6 Build/link errors with CUDA and OpenGL

asked 2013-10-10 14:28:28 -0600

interogativ gravatar image

updated 2013-10-10 14:37:08 -0600

berak gravatar image

I'm getting the following build errors for OpenCV version 2.4.6 for "Visual Studio 10 Win64" with both WITH_OPENGL and WITH_OPENCV specified. Anyone know what I'm doing wrong?

Link Errors:

5>     Creating library C:/opencv/gpubuildwithopengl/lib/Debug/opencv_highgui246d.lib and object C:/opencv/gpubuildwithopengl/lib/Debug/opencv_highgui246d.exp
5>window.obj : error LNK2019: unresolved external symbol cvSetOpenGlDrawCallback referenced in function "void __cdecl cv::setOpenGlDrawCallback(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,void (__cdecl*)(void *),void *)" (?setOpenGlDrawCallback@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@P6AXPEAX@Z1@Z)
5>window.obj : error LNK2019: unresolved external symbol cvSetOpenGlContext referenced in function "void __cdecl cv::setOpenGlContext(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?setOpenGlContext@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
5>window.obj : error LNK2019: unresolved external symbol cvUpdateWindow referenced in function "void __cdecl cv::updateWindow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?updateWindow@cv@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
5>C:\opencv\gpubuildwithopengl\bin\Debug\opencv_highgui246d.dll : fatal error LNK1120: 3 unresolved externals

The OpenCV configuration is below:

CUDA detected: 5.5
CUDA NVCC target flags: -gencode;arch=compute_11,code=sm_11;-gencode;arch=compute_12,code=sm_12;-gencode;arch=compute_13,code=sm_13;-gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_20,code=compute_20;-gencode;arch=compute_30,code=compute_30
Could NOT find JNI (missing:  JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) 

General configuration for OpenCV 2.4.6 =====================================
  Version control:               unknown

  Platform:
    Host:                        Windows 6.1 AMD64
    CMake:                       2.8.11.2
    CMake generator:             Visual Studio 10 Win64
    CMake build tool:            c:/PROGRA~2/MICROS~2.0/Common7/IDE/devenv.com
    MSVC:                        1600

  C/C++:
    Built as dynamic libs?:      YES
    C++ Compiler:                c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/x86_amd64/cl.exe  (ver 16.0.40219.1)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /MD /O2 /Ob2 /D NDEBUG  /Zi
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR /EHa  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /wd4251 /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /MD /O2 /Ob2 /D NDEBUG  /Zi
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /D_DEBUG /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64   /INCREMENTAL:NO  /debug
    Linker flags (Debug):        /machine:x64   /debug /INCREMENTAL 
    Precompiled headers:         YES

  OpenCV modules:
    To be built:                 core imgproc flann highgui features2d calib3d ml video objdetect contrib photo legacy gpu ocl nonfree stitching superres ts videostab
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 androidcamera java python

  GUI: 
    QT:                          NO
    Win32 UI:                    YES
    OpenGL support:              YES ...
(more)
edit retag flag offensive close merge delete

Comments

You have set the path for bin directory of CUDA, in environment variables?

andr3w gravatar imageandr3w ( 2013-11-05 14:42:04 -0600 )edit

2 answers

Sort by » oldest newest most voted
0

answered 2013-11-05 07:02:05 -0600

mrzl gravatar image

Hey, I've got exactly the same problem. Everything compiles perfectly except from the highgui module. I've read that enabling WITH_QT in cmake might resolve the problem, but I'm getting tons of configuration errors I haven't resolved, yet, when I'm enabling QT.

I'd love to hear from your progress if you managed to fix this somehow. Thanks!

mrzl

edit flag offensive delete link more

Comments

1

Hey Bro!I also meet the same error,do you solved that shit?

我干过豪哥 gravatar image我干过豪哥 ( 2013-11-13 01:22:28 -0600 )edit

Yeah eventually i figured it out- somehow. I decided to compile the 2.4.7. version from the github repo and compiled with the WITH_QT option DISABLED. I'm using Qt within VS12 via the Qt plugin now and it's going great. The version I sucessfully compiled is the one tagged 2.4.7. in Itseez's github repo ( not the very latest one ). I hope this helps. let me know if you need any more info.

mrzl gravatar imagemrzl ( 2013-11-16 05:26:37 -0600 )edit

Thanks!!I solve that problesm similarly and compile 2.4.7 with qt cuda and opengl!!^_^

我干过豪哥 gravatar image我干过豪哥 ( 2013-11-25 05:07:45 -0600 )edit

Hey! I had successfully compiled opencv 2.4.8 with CUDA and openGL. With QT disabled. But I needed to make some GUI, hence decided to add QT support but now I am running into a lot errors. e.g. Automoc for target opencv_highgui Generating moc_window_QT.cpp Exit code 0xc0000135 @mrzl you said that you compiled opencv with the WITH_QT option DISABLED and are still using QT how is that possible?

gauss89 gravatar imagegauss89 ( 2014-08-13 13:40:01 -0600 )edit
0

answered 2015-11-06 16:27:29 -0600

So, I know it's been a while since this was posted but I recently had the same issue and decided to share what I found.

Anyway, I just got an OpenCV 2.4.9 x64 build working with OpenGL and Cuda (v6.5) for Visual Studio 2012. Additionally, I have a NVIDIA fermi architecture in my lab, and a kepler at home, so I built both. Now, when I first started, the CMake generated VS2012 solution actually built, but with some errors. Upon trying to fix the errors I got the unresolved externals in the highgui module.

Anyway, many hours later I discovered that one of the projects (Didn't try to discover which one) reconfigures the CMake solution and disabled both the HAVE_WIN32UI and HAVE_VFW #defines in cvconfig.h. Without HAVE_WIN32UI, window_w32.cpp isn't included as a source file which explains why the implementations are missing for the functions the linker is complaining about.

So... what to do. Well, don't build the "ALL_BUILD" or "INSTALL" projects unless you want to actually figure out WHY the reconfiguring is happening. I'm perfectly open to the fact that I might have screwed something up or don't have some dependency here or there, these custom builds seem to be extremely fussy and I'm a moderate programmer at best. Instead, manually build each of the module objects. Of course, I'm only interested in the DLLs, LIBs, and INCLUDE folders, not any of the compiled examples, etc. You'll have to do more work if you need them.

Here's how I built the solution (only did release as I haven't gotten to debug yet): Under "Solution->modules" build in this order: opencv_highgui, opencv_calib3d, opencv_contrib, opencv_stitching, opencv_superres, opencv_ts, opencv_videostab.

*Note that opencv_ts actually does a CMake reconfiguration but didn't change HAVE_WIN32UI, HAVE_VFW, or any of the so-far compiled projects, so I let it be.

*Note: I bet any order would work, it seems to be one of the non module projects that is the culprit here.

Again, I got what I needed for a work project so I stopped here. I tested the GPU functionality by using an RGB video frame I grab as usual with a cv::VideoCapture object. I created a gpu::GpuMat and uploaded a grayscale converted copy of my cv::mat video frame to it. I applied an x and y gpu::Sobel operator to the image, created a couple more cv::Mats to grab the result, weighted them together and displayed using imshow. That all sounds really convoluted, I know, but I just grabbed the first image processing example I could find to figure out whether or not the hours of work I put into figuring this problem out were worth it. Apparently they were.

Hope that helps. Also, if anybody out there has some good feedback on what I found and anything I misinterpreted, etc. I would really like to hear it.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-10-10 14:28:28 -0600

Seen: 2,542 times

Last updated: Aug 13 '14