我使用OpenCV的的Makefile的OpenCV停止工作
CFLAGS = `pkg-config --cflags opencv`
LIBS = `pkg-config --libs opencv`
% : %.cpp
g++ $(CFLAGS) -o [email protected] $< $(LIBS)
這工作得很好,直到最近纔有下面的Makefile的項目。我現在得到了以下錯誤:
/usr/bin/ld: cannot find -lcufft
/usr/bin/ld: cannot find -lnpps
/usr/bin/ld: cannot find -lnppi
/usr/bin/ld: cannot find -lnppc
/usr/bin/ld: cannot find -lcudart
pkg-config --libs opencv
輸出:
/usr/local/lib/libopencv_calib3d.so
/usr/local/lib/libopencv_contrib.so
/usr/local/lib/libopencv_core.so
/usr/local/lib/libopencv_features2d.so
/usr/local/lib/libopencv_flann.so
/usr/local/lib/libopencv_gpu.so
/usr/local/lib/libopencv_highgui.so
/usr/local/lib/libopencv_imgproc.so
/usr/local/lib/libopencv_legacy.so
/usr/local/lib/libopencv_ml.so
/usr/local/lib/libopencv_nonfree.so
/usr/local/lib/libopencv_objdetect.so
/usr/local/lib/libopencv_ocl.so
/usr/local/lib/libopencv_photo.so
/usr/local/lib/libopencv_stitching.so
/usr/local/lib/libopencv_superres.so
/usr/local/lib/libopencv_ts.a
/usr/local/lib/libopencv_video.so
/usr/local/lib/libopencv_videostab.so
/usr/lib/x86_64-linux-gnu/libXext.so
/usr/lib/x86_64-linux-gnu/libX11.so
/usr/lib/x86_64-linux-gnu/libICE.so
/usr/lib/x86_64-linux-gnu/libSM.so
/usr/lib/libGL.so
/usr/lib/x86_64-linux-gnu/libGLU.so
-lcufft -lnpps -lnppi -lnppc -lcudart -ltbb -lrt -lpthread -lm -ldl
我已經出口到LD_LIBRARY_PATH
的CUDA庫路徑:
echo $LD_LIBRARY_PATH
/usr/local/cuda-5.5/lib64
此路徑確實包含了庫:
ls $LD_LIBRARY_PATH
libcublas_device.a libcudart.so.5.0 libcufftw.so libcurand.so.5.5 libnppc.so.5.5.22 libnvToolsExt.so
libcublas.so libcudart.so.5.5 libcufftw.so.5.5 libcurand.so.5.5.22 libnppi.so libnvToolsExt.so.1
libcublas.so.5.0 libcudart.so.5.5.22 libcufftw.so.5.5.22 libcusparse.so libnppi.so.5.5 libnvToolsExt.so.1.0.0
libcublas.so.5.5 libcudart_static.a libcuinj64.so libcusparse.so.5.5 libnppi.so.5.5.22
libcublas.so.5.5.22 libcufft.so libcuinj64.so.5.5 libcusparse.so.5.5.22 libnpps.so
libcudadevrt.a libcufft.so.5.5 libcuinj64.so.5.5.22 libnppc.so libnpps.so.5.5
libcudart.so libcufft.so.5.5.22 libcurand.so libnppc.so.5.5 libnpps.so.5.5.22
但我仍然得到錯誤。我運行opencv 2.4.9和cuda 5.5。我忘了什麼?
你有沒有嘗試用'-L'在Makefile中添加cuda庫的路徑?也許這裏有一個答案http://stackoverflow.com/questions/1904990/what-is-the-difference-between-ld-library-path-and-l-at-link-time –
我現在做了這個:' g ++ -L/usr/local/cuda-5.5/lib64''pkg-config --cflags opencv'' -o writeFramesMainSimple writeFramesMainSimple.cpp'' pkg-config --libs opencv'它工作正常!儘管如此,我仍然不明白爲什麼它會停止工作,因爲這正是'LD_LIBRARY_PATH'中的內容。根據你的鏈接,這應該很好...... – BdB