tensorflow 1.9 ,bazel 0.15.0,源码编ERROR, Skipping, '//tensorflow/tools/pip_package:build_pip_package',error loading packageCuda Configuration Error, Cannot find libdevice.10.bc under /usr/local/cuda-8.0

最近在看tensorflow 移动端部署,需要编译源码才支持,所以又拾起来了编译这项老工作,其中遇到问题:

bazel build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"  --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
WARNING: The following configs were expanded more than once: [cuda]. For repeatable flags, repeats are counted twice and may lead to unexpected behavior.
ERROR: Skipping '//tensorflow/tools/pip_package:build_pip_package': error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
    File "/home/lyz/code/tensorflow/third_party/gpus/cuda_configure.bzl", line 1166
        _create_local_cuda_repository(repository_ctx)
    File "/home/lyz/code/tensorflow/third_party/gpus/cuda_configure.bzl", line 1001, in _create_local_cuda_repository
        _find_nvvm_libdevice_dir(repository_ctx, cuda_config)
    File "/home/lyz/code/tensorflow/third_party/gpus/cuda_configure.bzl", line 724, in _find_nvvm_libdevice_dir
        auto_configure_fail(("Cannot find libdevice.10.bc un...))
    File "/home/lyz/code/tensorflow/third_party/gpus/cuda_configure.bzl", line 210, in auto_configure_fail
        fail(("\n%sCuda Configuration Error:%...)))

Cuda Configuration Error: Cannot find libdevice.10.bc under /usr/local/cuda-8.0
WARNING: Target pattern parsing failed.
ERROR: error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
    File "/home/lyz/code/tensorflow/third_party/gpus/cuda_configure.bzl", line 1166
        _create_local_cuda_repository(repository_ctx)
    File "/home/lyz/code/tensorflow/third_party/gpus/cuda_configure.bzl", line 1001, in _create_local_cuda_repository
        _find_nvvm_libdevice_dir(repository_ctx, cuda_config)
    File "/home/lyz/code/tensorflow/third_party/gpus/cuda_configure.bzl", line 724, in _find_nvvm_libdevice_dir
        auto_configure_fail(("Cannot find libdevice.10.bc un...))
    File "/home/lyz/code/tensorflow/third_party/gpus/cuda_configure.bzl", line 210, in auto_configure_fail
        fail(("\n%sCuda Configuration Error:%...)))

Cuda Configuration Error: Cannot find libdevice.10.bc under /usr/local/cuda-8.0
INFO: Elapsed time: 0.116s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
    currently loading: tensorflow/tools/pip_package

我一直搜索:ERROR: Skipping '//tensorflow/tools/pip_package:build_pip_package': error loading package 'tensorflow/tools/pip_package': E,说是

将bazel 回滚到0.52版本就可以,但是在./config阶段,其要求bazel 版本是需要0.10.0或以上的,因此不是这个问题,然后关注第二个error:

Cuda Configuration Error: Cannot find libdevice.10.bc under /usr/local/cuda-8.0

执行下面两个命令就可以了。

sudo cp /usr/local/cuda-8.0/nvvm/libdevice/libdevice.compute_50.10.bc /usr/local/cuda-8.0/nvvm/libdevice/libdevice.10.bc

sudo cp  /usr/local/cuda-8.0/nvvm/libdevice/libdevice.10.bc    /usr/local/cuda-8.0/libdevice.10.bc

然后,就可以了。

附:

卸载tensrofiow :sudo pip uninstall tensorflow or sudo pip uninstall tensorflow-gpu

pip 问题:

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
ImportError: No module named _internal

from pip._internal import main 改为 from pip  import main

(如果是no main 则相反from pip import main 改为 from pip._internal  import main,是pip升级的问题)

上一篇:(原)error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”


下一篇:jQuery基础教程之is()方法和has() 方法