2016-05-30 90 views
8

我無法解決我遇到的一個特定問題:我無法確定罪魁禍首。使用CMake版本3.5.2的OpenCV與CMake 2.X.X

系統:杰特森TX1,arm64內核,用戶空間32B,opencv4tegra

情況:使用一直在建設項目:

find_package(OpenCV) 

而這一直很好,並編譯。

故障:我從源代碼構建並安裝了CMake 3.5.2。現在我不能再構建任何依賴於OpenCV的項目。我得到的鏈接錯誤,這一點無法找到:

opencv_dep_cudart 

我假設的問題在OpenCVCConfig.cmake造成的,解決這個問題:

# Import target "opencv_core" for configuration "Release" 
set_property(TARGET opencv_core APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) 
set_target_properties(opencv_core PROPERTIES 
    IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE "opencv_dep_cudart;opencv_dep_nppc;opencv_dep_nppi;opencv_dep_npps;dl;m;pthread;rt;tbb" 
    IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/libopencv_core.so.2.4.12" 
    IMPORTED_SONAME_RELEASE "libopencv_core.so.2.4" 
) 

出來的文件:/usr/share/OpenCV/OpenCVModules-release.cmake

然而,這文件在CMake版本之間不會改變,因爲它是一個OpenCV文件。所以這一定是如何處理的。

手動恢復我的CMake回到2.8.12.2允許我再次構建。這裏是一個使用OpenCV的make命令的例子。注意正確的cuda庫:

Linking CXX executable DuoInterfaceTest 
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/DuoInterfaceTest.dir/link.txt --verbose=1 
/usr/bin/c++ -O2 -g -DNDEBUG -std=gnu++11 CMakeFiles/DuoInterfaceTest.dir/src/mainTest.cpp.o -o DuoInterfaceTest -L/home/ubuntu/catkin_ws/duointerface/lib/linux/arm -rdynamic libDuoInterface.a /usr/lib/libopencv_vstab.so.2.4.12 /usr/lib/libopencv_tegra.so.2.4.12 /usr/lib/libopencv_imuvstab.so.2.4.12 /usr/lib/libopencv_facedetect.so.2.4.12 /usr/lib/libopencv_esm_panorama.so.2.4.12 /usr/lib/libopencv_detection_based_tracker.so.2.4.12 /usr/lib/libopencv_videostab.so.2.4.12 /usr/lib/libopencv_video.so.2.4.12 /usr/lib/libopencv_ts.a /usr/lib/libopencv_superres.so.2.4.12 /usr/lib/libopencv_stitching.so.2.4.12 /usr/lib/libopencv_photo.so.2.4.12 /usr/lib/libopencv_objdetect.so.2.4.12 /usr/lib/libopencv_ml.so.2.4.12 /usr/lib/libopencv_legacy.so.2.4.12 /usr/lib/libopencv_imgproc.so.2.4.12 /usr/lib/libopencv_highgui.so.2.4.12 /usr/lib/libopencv_gpu.so.2.4.12 /usr/lib/libopencv_flann.so.2.4.12 /usr/lib/libopencv_features2d.so.2.4.12 /usr/lib/libopencv_core.so.2.4.12 /usr/lib/libopencv_contrib.so.2.4.12 /usr/lib/libopencv_calib3d.so.2.4.12 /usr/lib/libopencv_tegra.so.2.4.12 /usr/lib/libopencv_stitching.so.2.4.12 /usr/lib/libopencv_gpu.so.2.4.12 /usr/lib/libopencv_photo.so.2.4.12 /usr/lib/libopencv_legacy.so.2.4.12 /usr/local/cuda-7.0/lib/libcufft.so /usr/lib/libopencv_video.so.2.4.12 /usr/lib/libopencv_objdetect.so.2.4.12 /usr/lib/libopencv_ml.so.2.4.12 /usr/lib/libopencv_calib3d.so.2.4.12 /usr/lib/libopencv_features2d.so.2.4.12 /usr/lib/libopencv_highgui.so.2.4.12 /usr/lib/libopencv_imgproc.so.2.4.12 /usr/lib/libopencv_flann.so.2.4.12 /usr/lib/libopencv_core.so.2.4.12 /usr/local/cuda-7.0/lib/libcudart.so /usr/local/cuda-7.0/lib/libnppc.so /usr/local/cuda-7.0/lib/libnppi.so /usr/local/cuda-7.0/lib/libnpps.so -ldl -lm -lpthread -lrt -ltbb -lDUO -Wl,-rpath,/home/ubuntu/catkin_ws/duointerface/lib/linux/arm:/usr/local/cuda-7.0/lib 

想法?我希望能夠在我的系統上保留較新的CMake,但不夠了解這個問題。如果你認爲這太系統獨特,我會撤回這個問題。

+0

對我來說,如果我建立依賴於2.4的項目存在同樣的問題。 –

+1

好的,因爲cmake'CUDA_USE_STATIC_CUDA_RUNTIME = false'中的解決方法設置確實有效 –

回答

2

正如邁克爾Mairegger注意到,你這樣做必須在構建目錄cmake的

sudo cmake .. -DCUDA_USE_STATIC_CUDA_RUNTIME=false 

但是我注意到一個額外的事情是,如果我試圖make以後也不會,除非我做的工作cmake指令兩次