OSX Sierra Tensorflow构建错误:ld:找不到文件:@ rpath/CUDA.framework/Versions/A/CUDA [英] OSX Sierra Tensorflow build error: ld: file not found: @rpath/CUDA.framework/Versions/A/CUDA
问题描述
我已按照以下说明进行操作: https://gist.github.com/notilas/a30e29ce514970e821a34153c1e78b3f
I have followed the instruction in: https://gist.github.com/notilas/a30e29ce514970e821a34153c1e78b3f
但是无法完成.
- OSX:Sierra
- Tensorflow版本1.1.0(Google说v1.2不支持OSX CUDA)
- CUDA工具套件:8.0
- CUDNN:6.0
- Xcode:7.2.1
- Anaconda:4.2(Python版本3.5)
错误日志:
错误:/Users/so041e/ml/tensorflow/tensorflow/python/BUILD:2534:1: 链接规则'//tensorflow/python:_pywrap_tensorflow_internal.so' 失败:link_dynamic_library.sh失败:执行命令出错 external/bazel_tools/tools/cpp/link_dynamic_library.sh不忽略 忽略忽略 外部/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -shared -o ...(跳过剩余的455个参数):com.google.devtools.build.lib.shell.BadExitStatusException:进程 以状态1退出. 铛:警告:编译期间未使用的参数:'-pthread' ld:找不到文件:@ rpath/CUDA.framework/Versions/A/CUDA用于架构x86_64 铛:错误:链接器命令失败,退出代码为1(使用-v查看调用) 目标//tensorflow/tools/pip_package:build_pip_package生成失败 使用--verbose_failures可以查看失败的构建步骤的命令行.
ERROR: /Users/so041e/ml/tensorflow/tensorflow/python/BUILD:2534:1: Linking of rule '//tensorflow/python:_pywrap_tensorflow_internal.so' failed: link_dynamic_library.sh failed: error executing command external/bazel_tools/tools/cpp/link_dynamic_library.sh no ignored ignored ignored external/local_config_cuda/crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc -shared -o ... (remaining 455 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1. clang: warning: argument unused during compilation: '-pthread' 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) Target //tensorflow/tools/pip_package:build_pip_package failed to build Use --verbose_failures to see the command lines of failed build steps.
[.bash_profile]
[.bash_profile]
export PATH="/Users/so041e/anaconda/bin:$PATH"
export CUDA_HOME=/usr/local/cuda
export HOME=/Users/so041e
export PATH="$CUDA_HOME/bin:$PATH"
export DYLD_LIBRARY_PATH="/usr/local/cuda/lib:/Developer/NVIDIA/CUDA8.0/lib":$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
export PATH=$DYLD_LIBRARY_PATH:$PATH
export PATH="//anaconda/bin:$PATH"
移动了CUDNN库,并将其包含到/user/local/cuda
Moved CUDNN lib and include to /user/local/cuda
sudo mv -v cuda/lib/libcudnn* /usr/local/cuda/lib
sudo mv -v cuda/include/cudnn.h /usr/local/cuda/include
不使用"vent"此时仅使用了单个python 3.5. 两者都尝试过,但没有区别.
Didn't use "vent" Just used single python 3.5 at this moment. Tried both, but no difference.
bazel build --config=cuda --config=opt --action_env PATH --action_env LD_LIBRARY_PATH --action_env DYLD_LIBRARY_PATH //tensorflow/tools/pip_package:build_pip_package
bazel build --config=cuda //tensorflow/tools/pip_package:build_pip_package
推荐答案
这可能会有点晚,但是我遇到了完全相同的问题,并且设法解决了这个问题.
This might be a bit late, but I had this exact same problem and I managed to fix it.
首先,@ rpath/CUDA.framework/Versions/A/CUDA是libcuda.dylib的动态库安装名称,可在/usr/local/cuda/lib中找到该名称.
First, @rpath/CUDA.framework/Versions/A/CUDA is a dynamic library install name for libcuda.dylib, which is found in /usr/local/cuda/lib. So do
otool -l /usr/local/cuda/lib/libcuda.dylib
检查在哪里看到@ rpath/CUDA.framework/Versions/A/CUDA;在我的系统上,它位于命令LC_REEXPORT_DYLIB中.从此处看来,dyld无法解决LC_REEXPORT_DYLIB命令的@rpath,仅LC_LOAD * _DYLIB命令.意思是,它查找文字路径"@ rpath/CUDA.framework/Versions/A/CUDA".因此,您将不得不通过更改
Check where you see @rpath/CUDA.framework/Versions/A/CUDA; on my system it was in the command LC_REEXPORT_DYLIB. From here, it seems dyld doesn't resolve the @rpath for the LC_REEXPORT_DYLIB command, only LC_LOAD*_DYLIB commands. Meaning, it looks for the literal path "@rpath/CUDA.framework/Versions/A/CUDA". So you're going to have to change that by doing
sudo install_name_tool -change @rpath/CUDA.framework/Versions/A/CUDA \
/Library/Frameworks/CUDA.framework/Versions/A/CUDA \
/usr/local/cuda/lib/libcuda.dylib
这应该可以解决您的问题.
This should resolve your problem.
现在,为什么您的系统(和我的系统)具有libcuda.dylib的此安装名称?我完全不知道.
Now why your system (and mine) has this install name for libcuda.dylib? I have absolutely no clue.
这篇关于OSX Sierra Tensorflow构建错误:ld:找不到文件:@ rpath/CUDA.framework/Versions/A/CUDA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!