我正在尝试在MacBook Pro 15“retina上的OSX Maverics下在Python中安装一个名为PyCUDA的CUDA包,但在尝试编译文件时,我收到以下错误:
ld: warning: directory not found for option '-F /Library/Frameworks -framework CUDA'
ld: file not found: @rpath/CUDA.framework/Versions/A/CUDA for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'g++' failed with exit status 1
我认为在这个阶段PyCUDA正在尝试编译它的一些C组件。
我在线研究了错误,建议的解决方案是将-F / Library / Frameworks和-framework CUDA添加到参数列表中,但是make仍然会因上面的错误而失败。
我安装了CUDA 5.5和Xcode命令行工具。我也使用以下命令行(不是Xcode)进行安装:
python setup.py install
其中,反过来调用clang来编译一些组件。
我认为路径的@rpath部分未正确处理。
我能以任何方式解决此错误吗?
答案 0 :(得分:2)
我遇到了类似的错误,但我设法使用此安装pycuda http://wiki.tiker.net/PyCuda/Installation/Mac
特别是我使用了说明中指定的siteconf.py。
BOOST_INC_DIR = []
BOOST_LIB_DIR = []
BOOST_COMPILER = 'gcc43'
USE_SHIPPED_BOOST = True
BOOST_PYTHON_LIBNAME = ['boost_python-py27']
BOOST_THREAD_LIBNAME = ['boost_thread']
CUDA_TRACE = False
CUDA_ROOT = '/usr/local/cuda'
CUDA_ENABLE_GL = False
CUDA_ENABLE_CURAND = True
CUDADRV_LIB_DIR = ['${CUDA_ROOT}/lib']
CUDADRV_LIBNAME = ['cuda']
CUDART_LIB_DIR = ['${CUDA_ROOT}/lib']
CUDART_LIBNAME = ['cudart']
CURAND_LIB_DIR = ['${CUDA_ROOT}/lib']
CURAND_LIBNAME = ['curand']
CXXFLAGS = ["-arch", "x86_64", "-arch", "i386"]
LDFLAGS = ["-F/Library/Frameworks", "-arch", "x86_64", "-arch", "i386"]
CXXFLAGS.extend(['-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk'])
LDFLAGS.extend(['-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk'])
答案 1 :(得分:1)
只需将export LDFLAGS="-F/Library/Frameworks/"
添加到.profile
。
然后pip
可以成功安装pycuda
,至少在Yosemite的Macbook上安装preserveDrawingBuffer
。
答案 2 :(得分:0)
您可以将此过程与Python2.7
或Python3.4
首先,我安装了boost库:
$brew install boost
$brew install boost-python
其次,您创建一个包含内容的文件$HOME/.aksetup-defaults.py
:
CUDA_ROOT = '/usr/local/cuda'
CUDADRV_LIBNAME = ['cuda']
CUDADRV_LIB_DIR = ['${CUDA_ROOT}/lib']
CUDART_LIBNAME = ['cudart']
CUDART_LIB_DIR = ['${CUDA_ROOT}/lib']
CUDA_ENABLE_CURAND = True
CUDA_ENABLE_GL = True
CUDA_INC_DIR = ['${CUDA_ROOT}/include']
CUDA_TRACE = False
CURAND_LIBNAME = ['curand']
CURAND_LIB_DIR = ['${CUDA_ROOT}/lib']
USE_SHIPPED_BOOST = True
最后,使用pip安装pycuda
$python -m pip install pycuda
瞧!开始使用pycuda