我在MAC OS X 10.9下下载并安装了以下软件包:
ArrayFire-maci-1.9-20121120.zip
cuda-mac--5.5.28_10.9_64.pkg
在成功构建helloworld示例后,我得到以下输出:
c++ -m64 -Wall -Werror -I../../include -I/usr/local/cuda/include -O3 -DNDEBUG -L../../lib -laf -lafGFX -L/usr/local/cuda/lib -lcuda -lcudart -lcurand -lcusparse -lpthread -lstdc++ -lm -Wl,-rpath,../../lib,-rpath,/opt/arrayfire/lib,-rpath,/usr/local/cuda/lib
helloworld.cpp-o helloworld
然而,当尝试运行helloworld可执行文件时,我得到以下错误:
./helloworld dyld: Library not loaded: @rpath/libcufft.5.5.dylib Referenced from: /opt/arrayfire/lib/libaf.dylib Reason: Incompatible library version: libaf.dylib requires version 5.5.0 or later, but libcufft.5.5.dylib provides version 0.0.0 Trace/BPT trap: 5
但是根据otool输出,dylib库的版本是正确的:
otool -L /usr/local/cuda/lib/libcufft.dylib libcufft.dylib: @rpath/libcufft.5.5.dylib (compatibility version 0.0.0, current version 5.5.28) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation(兼容版本150.0.0,当前版本635.21.0(
/usr/lib/libstdc++.6.dylib(兼容版本7.0.0,当前版本52.0.0(
有人知道如何克服这个问题吗?
您还需要在.bash_profile 中设置DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$AF_PATH/lib:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$CUDA_PATH/lib:$DYLD_LIBRARY_PATH