1

Mac OS 10.9、OpenCV 2.4.11、CUDA 7.0、所有环境标志设置为 libc++

$sudo make runtest    
.build_release/tools/caffe
dyld: Library not loaded: @rpath/libcudart.7.0.dylib
  Referenced from: /Users/deepsamal/Desktop/Research/caffe/.build_release/tools/caffe
  Reason: image not found
make: *** [runtest] Trace/BPT trap: 5

因为这可能与库环境变量有关。这是我所有的环境变量- $DYLD_LIBRARY_PATH = /usr/local/cuda/lib

$LD_LIBRARY_PATH = /usr/local/cuda/lib:/opt/intel/composer_xe_2015.2.132/mkl/lib/

$DYLD_FALLBACK_LIBRARY_PATH = /usr/local/cuda/lib:/Developer/NVIDIA/CUDA-7.0/lib:/Users/deepsamal/anaconda/lib:/usr/local/lib:/usr/lib:/opt/intel/composer_xe_2015 .2.132/mkl/lib/:

既-

make all
make test

运行没有错误,这意味着库已链接但未动态加载。

无法弄清楚可能是什么原因?

任何帮助表示赞赏。

编辑:试图查看 libcudart 库的运行时链接。

$ otool -L /usr/local/cuda/lib/libcudart.7.0.dylib
/usr/local/cuda/lib/libcudart.7.0.dylib:
    @rpath/libcudart.7.0.dylib (compatibility version 0.0.0, current version 7.0.29)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.17.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)

编辑:我试图找到所有到 libcaffe.so 的软链接,似乎 cuda libs 和 cudnn 的路径没有解决,这似乎是问题所在。

otool -L ~/Desktop/Research/caffe/build/lib/libcaffe.so 
/Users/deepsamal/Desktop/Research/caffe/build/lib/libcaffe.so:
@rpath/libcaffe.so (compatibility version 0.0.0, current version 0.0.0)
@rpath/libcudart.7.0.dylib (compatibility version 0.0.0, current version 7.0.29)
@rpath/libcublas.7.0.dylib (compatibility version 0.0.0, current version 7.0.29)
@rpath/libcurand.7.0.dylib (compatibility version 0.0.0, current version 7.0.29)
/usr/local/lib/libglog.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/lib/libprotobuf.9.dylib (compatibility version 10.0.0, current version 10.1.0)
/usr/local/lib/libleveldb.1.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libsnappy.1.dylib (compatibility version 4.0.0, current version 4.0.0)
/usr/local/lib/liblmdb.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
libhdf5_hl.9.dylib (compatibility version 10.0.0, current version 10.0.0)
libhdf5.9.dylib (compatibility version 10.0.0, current version 10.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/usr/local/opt/opencv/lib/libopencv_core.2.4.dylib (compatibility version 2.4.0, current version 2.4.11)
/usr/local/opt/opencv/lib/libopencv_highgui.2.4.dylib (compatibility version 2.4.0, current version 2.4.11)
/usr/local/opt/opencv/lib/libopencv_imgproc.2.4.dylib (compatibility version 2.4.0, current version 2.4.11)
/usr/local/lib/libboost_thread-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libcudnn.6.5.dylib (compatibility version 0.0.0, current version 6.5.48)
/usr/local/lib/libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
libpython2.7.dylib (compatibility version 2.7.0, current version 2.7.0)
libmkl_rt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
4

2 回答 2

2

设置DYLD_FALLBACK_LIBRARY_PATH变量至少为我解决了这个问题。我只需要添加/usr/local/cuda/lib作为第一条路径(正如你所做的那样)

export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/cuda/lib:/usr/local/lib:/usr/lib:/Developer/NVIDIA/CUDA-7.0/lib:

或如此处所述

于 2015-06-02T12:29:29.320 回答
0

由于 DYLD_LIBRARY_PATH,OSX 工具在执行时出现了可怕的混乱,我认为这种 hack 应该可以工作:

DYLD_LIBRARY_PATH=''; make runtest
于 2015-04-16T09:51:16.960 回答