Undefined reference when build sample with CUDA 5.5 (Bug #3219)
Description
I am trying to use ubuntu 12.04 x64 with CUDA 5.5 Production Release to build OpenCV 2.4.6.1
I can build without sample correctly but when I choose to build sample it will failed with lots of undefined reference like:
CMakeFiles/example_gpu_driver_api_multi.dir/driver_api_multi.cpp.o: In function `destroyContexts()':
driver_api_multi.cpp:(.text._Z15destroyContextsv+0xc): undefined reference to `cuCtxDestroy_v2'
driver_api_multi.cpp:(.text._Z15destroyContextsv+0x1c): undefined reference to `cuCtxDestroy_v2'
CMakeFiles/example_gpu_driver_api_multi.dir/driver_api_multi.cpp.o: In function `Worker::operator()(int) const':
driver_api_multi.cpp:(.text._ZNK6WorkerclEi+0x19): undefined reference to `cuCtxPushCurrent_v2'
driver_api_multi.cpp:(.text._ZNK6WorkerclEi+0x6bf): undefined reference to `cuCtxPopCurrent_v2'
If I comment "add_subdirectory(gpu)" in "opencv-2.4.6.1/samples/CMakeLists.txt" than it can be built successfully.
And if I manually add "-L/usr/local/cuda/lib64 -lcuda" to "opencv-2.4.6.1/build/samples/gpu/CMakeFiles/example_gpu_driver_api_multi.dir/link.txt", this target can be built successfully, but other target will still failed.
I think there should be a way to modify CMakeLists.txt to add this to every target, but I have no idea about cmake.
Associated revisions
Merge pull request #3219 from mshabunin:png_iccp_strip_24
History
Updated by Changlin Hsieh over 11 years ago
Only two example will affect by this bug, "example_gpu_driver_api_multi" and "example_gpu_driver_api_stereo_multi"
Modify line 39
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_GPU_SAMPLES_REQUIRED_DEPS})
to
target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${OPENCV_GPU_SAMPLES_REQUIRED_DEPS} cuda)
in "opencv-2.4.6.1/samples/gpu/CMakeLists.txt" can easily fix this problem
Updated by Sergei Nosov over 11 years ago
- Assignee set to Vladislav Vinogradov
- Pull request set to https://github.com/Itseez/opencv/pull/1267
- Status changed from New to Open
- Target version set to 2.4.7
Updated by Sergei Nosov over 11 years ago
- Category set to gpu (cuda)
Updated by Steven Puttemans over 11 years ago
Looping over bugs, seems this one is merged and thus fixed.
Feel free to reopen if I am incorrect.
- % Done changed from 0 to 100
- Assignee deleted (
Vladislav Vinogradov) - Status changed from Open to Done