<p dir="auto">Hi! Tensorflow is not properlly installed.</p>
<p dir="auto">Here's the output of: python -c "import tensorflow; print(tensorflow.<strong>version</strong>)"</p>
<p dir="auto">dyld: warning, LC_RPATH $ORIGIN/../../_solib_darwin/_U@local_Uconfig_Ucuda_S_Scuda_Ccudart___Uexternal_Slocal_Uconfig_Ucuda_Scuda_Slib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so being ignored in restricted program because it is a relative path<br>
dyld: warning, LC_RPATH ../local_config_cuda/cuda/lib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so being ignored in restricted program because it is a relative path<br>
dyld: warning, LC_RPATH ../local_config_cuda/cuda/extras/CUPTI/lib in /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so being ignored in restricted program because it is a relative path<br>
Traceback (most recent call last):<br>
File "", line 1, in <br>
File "/Library/Python/2.7/site-packages/tensorflow/<strong>init</strong>.py", line 24, in <br>
from tensorflow.python import *<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/<strong>init</strong>.py", line 60, in <br>
raise ImportError(msg)<br>
ImportError: Traceback (most recent call last):<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/<strong>init</strong>.py", line 49, in <br>
from tensorflow.python import pywrap_tensorflow<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <br>
_pywrap_tensorflow = swig_import_helper()<br>
File "/Library/Python/2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper<br>
_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)<br>
ImportError: dlopen(/Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: @rpath/libcudart.8.0.dylib<br>
Referenced from: /Library/Python/2.7/site-packages/tensorflow/python/_pywrap_tensorflow.so<br>
Reason: image not found</p>
<p dir="auto">OS: OSX 10.11.6<br>
Tensorflow pip version: tensorflow-gpu==0.12.1</p>
<p dir="auto">My "cuda" libs under /usr/local/cuda/lib/*</p>
<p dir="auto">/usr/local/cuda/lib/libcublas.8.0.dylib		/usr/local/cuda/lib/libcusparse.8.0.dylib	/usr/local/cuda/lib/libnppim.8.0.dylib<br>
/usr/local/cuda/lib/libcublas.dylib		/usr/local/cuda/lib/libcusparse.dylib		/usr/local/cuda/lib/libnppim.dylib<br>
/usr/local/cuda/lib/libcublas_device.a		/usr/local/cuda/lib/libcusparse_static.a	/usr/local/cuda/lib/libnppim_static.a<br>
/usr/local/cuda/lib/libcublas_static.a		/usr/local/cuda/lib/libnppc.8.0.dylib		/usr/local/cuda/lib/libnppist.8.0.dylib<br>
/usr/local/cuda/lib/libcuda.dylib		/usr/local/cuda/lib/libnppc.dylib		/usr/local/cuda/lib/libnppist.dylib<br>
/usr/local/cuda/lib/libcudadevrt.a		/usr/local/cuda/lib/libnppc_static.a		/usr/local/cuda/lib/libnppist_static.a<br>
/usr/local/cuda/lib/libcudart.8.0.dylib		/usr/local/cuda/lib/libnppi.8.0.dylib		/usr/local/cuda/lib/libnppisu.8.0.dylib<br>
/usr/local/cuda/lib/libcudart.dylib		/usr/local/cuda/lib/libnppi.dylib		/usr/local/cuda/lib/libnppisu.dylib<br>
/usr/local/cuda/lib/libcudart_static.a		/usr/local/cuda/lib/libnppi_static.a		/usr/local/cuda/lib/libnppisu_static.a<br>
/usr/local/cuda/lib/libcudnn.5.dylib		/usr/local/cuda/lib/libnppial.8.0.dylib		/usr/local/cuda/lib/libnppitc.8.0.dylib<br>
/usr/local/cuda/lib/libcudnn.dylib		/usr/local/cuda/lib/libnppial.dylib		/usr/local/cuda/lib/libnppitc.dylib<br>
/usr/local/cuda/lib/libcudnn_static.a		/usr/local/cuda/lib/libnppial_static.a		/usr/local/cuda/lib/libnppitc_static.a<br>
/usr/local/cuda/lib/libcufft.8.0.dylib		/usr/local/cuda/lib/libnppicc.8.0.dylib		/usr/local/cuda/lib/libnpps.8.0.dylib<br>
/usr/local/cuda/lib/libcufft.dylib		/usr/local/cuda/lib/libnppicc.dylib		/usr/local/cuda/lib/libnpps.dylib<br>
/usr/local/cuda/lib/libcufft_static.a		/usr/local/cuda/lib/libnppicc_static.a		/usr/local/cuda/lib/libnpps_static.a<br>
/usr/local/cuda/lib/libcufftw.8.0.dylib		/usr/local/cuda/lib/libnppicom.8.0.dylib	/usr/local/cuda/lib/libnvToolsExt.1.dylib<br>
/usr/local/cuda/lib/libcufftw.dylib		/usr/local/cuda/lib/libnppicom.dylib		/usr/local/cuda/lib/libnvToolsExt.dylib<br>
/usr/local/cuda/lib/libcufftw_static.a		/usr/local/cuda/lib/libnppicom_static.a		/usr/local/cuda/lib/libnvblas.8.0.dylib<br>
/usr/local/cuda/lib/libcuinj.8.0.dylib		/usr/local/cuda/lib/libnppidei.8.0.dylib	/usr/local/cuda/lib/libnvblas.dylib<br>
/usr/local/cuda/lib/libcuinj.dylib		/usr/local/cuda/lib/libnppidei.dylib		/usr/local/cuda/lib/libnvgraph.8.0.dylib<br>
/usr/local/cuda/lib/libculibos.a		/usr/local/cuda/lib/libnppidei_static.a		/usr/local/cuda/lib/libnvgraph.dylib<br>
/usr/local/cuda/lib/libcurand.8.0.dylib		/usr/local/cuda/lib/libnppif.8.0.dylib		/usr/local/cuda/lib/libnvgraph_static.a<br>
/usr/local/cuda/lib/libcurand.dylib		/usr/local/cuda/lib/libnppif.dylib		/usr/local/cuda/lib/libnvrtc-builtins.8.0.dylib<br>
/usr/local/cuda/lib/libcurand_static.a		/usr/local/cuda/lib/libnppif_static.a		/usr/local/cuda/lib/libnvrtc-builtins.dylib<br>
/usr/local/cuda/lib/libcusolver.8.0.dylib	/usr/local/cuda/lib/libnppig.8.0.dylib		/usr/local/cuda/lib/libnvrtc.8.0.dylib<br>
/usr/local/cuda/lib/libcusolver.dylib		/usr/local/cuda/lib/libnppig.dylib		/usr/local/cuda/lib/libnvrtc.dylib<br>
/usr/local/cuda/lib/libcusolver_static.a	/usr/local/cuda/lib/libnppig_static.a</p>
<p dir="auto">Something related to linking seems to cause the build to fail on Mac OS 10.12.2 when building with CUDA.</p>
<p dir="auto">Verbose build error is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ bazel build -c opt --config=cuda --verbose_failures //tensorflow/tools/pip_package:build_pip_package
INFO: Found 1 target...
ERROR: /Users/anton/tmp/tensorflow/tensorflow/contrib/ffmpeg/BUILD:66:1: Executing genrule //tensorflow/contrib/ffmpeg:decode_audio_op_py_pygenrule failed: bash failed: error executing command 
  (cd /private/var/tmp/_bazel_anton/d3361bfa15c75c42ab541f3d83e8eba4/execroot/tensorflow &amp;&amp; \
  exec env - \
    PATH=/usr/local/cuda/bin:/Users/anton/.pyenv/shims:/Users/anton/.rbenv/shims:/Users/anton/.scalaenv/shims:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/anton/unix/bin:/usr/local/cuda/bin \
    TMPDIR=/var/folders/4r/mq7ht1z11t72w5b5b6014zwm0000gn/T/ \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/tensorflow/contrib/ffmpeg/gen_decode_audio_op_py_py_wrappers_cc 1 &gt; bazel-out/local_darwin-py3-opt/genfiles/tensorflow/contrib/ffmpeg/ops/gen_decode_audio_op_py.py'): com.google.devtools.build.lib.shell.AbnormalTerminationException: Process terminated by signal 6.
dyld: Library not loaded: @rpath/libcudart.8.0.dylib
  Referenced from: /private/var/tmp/_bazel_anton/d3361bfa15c75c42ab541f3d83e8eba4/execroot/tensorflow/bazel-out/host/bin/tensorflow/contrib/ffmpeg/gen_decode_audio_op_py_py_wrappers_cc
  Reason: image not found
/bin/bash: line 1: 72493 Abort trap: 6           bazel-out/host/bin/tensorflow/contrib/ffmpeg/gen_decode_audio_op_py_py_wrappers_cc 1 &gt; bazel-out/local_darwin-py3-opt/genfiles/tensorflow/contrib/ffmpeg/ops/gen_decode_audio_op_py.py
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 2.707s, Critical Path: 0.32s"><pre class="notranslate"><code class="notranslate">$ bazel build -c opt --config=cuda --verbose_failures //tensorflow/tools/pip_package:build_pip_package
INFO: Found 1 target...
ERROR: /Users/anton/tmp/tensorflow/tensorflow/contrib/ffmpeg/BUILD:66:1: Executing genrule //tensorflow/contrib/ffmpeg:decode_audio_op_py_pygenrule failed: bash failed: error executing command 
  (cd /private/var/tmp/_bazel_anton/d3361bfa15c75c42ab541f3d83e8eba4/execroot/tensorflow &amp;&amp; \
  exec env - \
    PATH=/usr/local/cuda/bin:/Users/anton/.pyenv/shims:/Users/anton/.rbenv/shims:/Users/anton/.scalaenv/shims:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/anton/unix/bin:/usr/local/cuda/bin \
    TMPDIR=/var/folders/4r/mq7ht1z11t72w5b5b6014zwm0000gn/T/ \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/tensorflow/contrib/ffmpeg/gen_decode_audio_op_py_py_wrappers_cc 1 &gt; bazel-out/local_darwin-py3-opt/genfiles/tensorflow/contrib/ffmpeg/ops/gen_decode_audio_op_py.py'): com.google.devtools.build.lib.shell.AbnormalTerminationException: Process terminated by signal 6.
dyld: Library not loaded: @rpath/libcudart.8.0.dylib
  Referenced from: /private/var/tmp/_bazel_anton/d3361bfa15c75c42ab541f3d83e8eba4/execroot/tensorflow/bazel-out/host/bin/tensorflow/contrib/ffmpeg/gen_decode_audio_op_py_py_wrappers_cc
  Reason: image not found
/bin/bash: line 1: 72493 Abort trap: 6           bazel-out/host/bin/tensorflow/contrib/ffmpeg/gen_decode_audio_op_py_py_wrappers_cc 1 &gt; bazel-out/local_darwin-py3-opt/genfiles/tensorflow/contrib/ffmpeg/ops/gen_decode_audio_op_py.py
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 2.707s, Critical Path: 0.32s
</code></pre></div>
<h3 dir="auto">Related posts</h3>
<p dir="auto">It seems that Caffe had similar issues due to Apple dropping the <code class="notranslate">LD_LIBRARY_PATH</code> environment variable: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="112425891" data-permission-text="Title is private" data-url="https://github.com/BVLC/caffe/issues/3227" data-hovercard-type="issue" data-hovercard-url="/BVLC/caffe/issues/3227/hovercard" href="https://github.com/BVLC/caffe/issues/3227">BVLC/caffe#3227</a></p>
<h3 dir="auto">Environment info</h3>
<p dir="auto">Operating System: Mac OS 10.12.2</p>
<p dir="auto">Installed version of CUDA and cuDNN:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ls -l /usr/local/cuda/lib/libcud*
-rwxr-xr-x  1 root  wheel  13504 Nov  3 19:39 /usr/local/cuda/lib/libcuda.dylib*
lrwxr-xr-x  1 root  wheel     45 Nov  3 19:40 /usr/local/cuda/lib/libcudadevrt.a@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudadevrt.a
lrwxr-xr-x  1 root  wheel     50 Nov  3 19:40 /usr/local/cuda/lib/libcudart.8.0.dylib@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudart.8.0.dylib
lrwxr-xr-x  1 root  wheel     46 Nov  3 19:40 /usr/local/cuda/lib/libcudart.dylib@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudart.dylib
lrwxr-xr-x  1 root  wheel     49 Nov  3 19:40 /usr/local/cuda/lib/libcudart_static.a@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudart_static.a
lrwxr-xr-x  1 root  admin     47 Jan  8 16:48 /usr/local/cuda/lib/libcudnn.5.dylib@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudnn.5.dylib
lrwxr-xr-x  1 root  admin     45 Jan  8 16:48 /usr/local/cuda/lib/libcudnn.dylib@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudnn.dylib
lrwxr-xr-x  1 root  admin     48 Jan  8 16:48 /usr/local/cuda/lib/libcudnn_static.a@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudnn_static.a"><pre class="notranslate"><code class="notranslate">$ ls -l /usr/local/cuda/lib/libcud*
-rwxr-xr-x  1 root  wheel  13504 Nov  3 19:39 /usr/local/cuda/lib/libcuda.dylib*
lrwxr-xr-x  1 root  wheel     45 Nov  3 19:40 /usr/local/cuda/lib/libcudadevrt.a@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudadevrt.a
lrwxr-xr-x  1 root  wheel     50 Nov  3 19:40 /usr/local/cuda/lib/libcudart.8.0.dylib@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudart.8.0.dylib
lrwxr-xr-x  1 root  wheel     46 Nov  3 19:40 /usr/local/cuda/lib/libcudart.dylib@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudart.dylib
lrwxr-xr-x  1 root  wheel     49 Nov  3 19:40 /usr/local/cuda/lib/libcudart_static.a@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudart_static.a
lrwxr-xr-x  1 root  admin     47 Jan  8 16:48 /usr/local/cuda/lib/libcudnn.5.dylib@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudnn.5.dylib
lrwxr-xr-x  1 root  admin     45 Jan  8 16:48 /usr/local/cuda/lib/libcudnn.dylib@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudnn.dylib
lrwxr-xr-x  1 root  admin     48 Jan  8 16:48 /usr/local/cuda/lib/libcudnn_static.a@ -&gt; /Developer/NVIDIA/CUDA-8.0/lib/libcudnn_static.a
</code></pre></div>
<h5 dir="auto">Configuration command</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Please specify the location of python. [Default is /Users/anton/.pyenv/shims/python]: 
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] N
No Google Cloud Platform support will be enabled for TensorFlow
Do you wish to build TensorFlow with Hadoop File System support? [y/N] N
No Hadoop File System support will be enabled for TensorFlow
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
Found possible Python library paths:
  /Users/anton/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages
Please input the desired Python library path to use.  Default is [/Users/anton/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages]

Using python library path: /Users/anton/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages
Do you wish to build TensorFlow with OpenCL support? [y/N] 
No OpenCL support will be enabled for TensorFlow
Do you wish to build TensorFlow with CUDA support? [y/N] Y
CUDA support will be enabled for TensorFlow
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 
Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 
Please specify the location where CUDA  toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 
Please specify the Cudnn version you want to use. [Leave empty to use system default]: 
Please specify the location where cuDNN  library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 
libcudnn.dylib resolves to libcudnn.dylib
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size.
[Default is: &quot;3.5,5.2&quot;]: 3.5  	 
Extracting Bazel installation...
............
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
.........
____Loading package: tensorflow/tools/git
____Loading package: tensorflow/contrib/opt
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 40,960 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 444,518 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 743,716 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 1,170,534 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 1,597,352 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 1,998,646 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 2,251,050 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 2,675,032 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 3,144,390 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 3,579,716 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 3,788,162 bytes
INFO: All external dependencies fetched successfully.
Configuration finished"><pre class="notranslate"><code class="notranslate">Please specify the location of python. [Default is /Users/anton/.pyenv/shims/python]: 
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] N
No Google Cloud Platform support will be enabled for TensorFlow
Do you wish to build TensorFlow with Hadoop File System support? [y/N] N
No Hadoop File System support will be enabled for TensorFlow
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
Found possible Python library paths:
  /Users/anton/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages
Please input the desired Python library path to use.  Default is [/Users/anton/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages]

Using python library path: /Users/anton/.pyenv/versions/anaconda3-4.1.1/lib/python3.5/site-packages
Do you wish to build TensorFlow with OpenCL support? [y/N] 
No OpenCL support will be enabled for TensorFlow
Do you wish to build TensorFlow with CUDA support? [y/N] Y
CUDA support will be enabled for TensorFlow
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 
Please specify the CUDA SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 
Please specify the location where CUDA  toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 
Please specify the Cudnn version you want to use. [Leave empty to use system default]: 
Please specify the location where cuDNN  library is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: 
libcudnn.dylib resolves to libcudnn.dylib
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size.
[Default is: "3.5,5.2"]: 3.5  	 
Extracting Bazel installation...
............
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
.........
____Loading package: tensorflow/tools/git
____Loading package: tensorflow/contrib/opt
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 40,960 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 444,518 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 743,716 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 1,170,534 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 1,597,352 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 1,998,646 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 2,251,050 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 2,675,032 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 3,144,390 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 3,579,716 bytes
____Downloading http://bazel-mirror.storage.googleapis.com/github.com/google/protobuf/archive/008b5a228b37c054f46ba478ccafa5e855cb16db.tar.gz: 3,788,162 bytes
INFO: All external dependencies fetched successfully.
Configuration finished
</code></pre></div>
<h4 dir="auto">Git revision</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ git rev-parse HEAD
ec7929b878926c39255254e9aea992f0bc65aa68"><pre class="notranslate"><code class="notranslate">$ git rev-parse HEAD
ec7929b878926c39255254e9aea992f0bc65aa68
</code></pre></div>
<h4 dir="auto">Bazel version</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ bazel version
Build label: 0.4.3-homebrew
Build target: bazel-out/local-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 22 15:20:15 2016 (1482420015)
Build timestamp: 1482420015
Build timestamp as int: 1482420015"><pre class="notranslate"><code class="notranslate">$ bazel version
Build label: 0.4.3-homebrew
Build target: bazel-out/local-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Thu Dec 22 15:20:15 2016 (1482420015)
Build timestamp: 1482420015
Build timestamp as int: 1482420015
</code></pre></div>
<h3 dir="auto">Update</h3>
<p dir="auto">I modified <code class="notranslate">third_party/gpus/crosstool/CROSSTOOL.tpl</code>  the following lines</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  cxx_flag: &quot;-std=c++11&quot;
  linker_flag: &quot;-Wl,-no-as-needed&quot;"><pre class="notranslate"><code class="notranslate">  cxx_flag: "-std=c++11"
  linker_flag: "-Wl,-no-as-needed"
</code></pre></div>
<p dir="auto">in the toolchain section to:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="  cxx_flag: &quot;-std=c++11&quot;
  linker_flag: &quot;-Wl,-no-as-needed,-rpath,/usr/local/cuda/lib&quot;"><pre class="notranslate"><code class="notranslate">  cxx_flag: "-std=c++11"
  linker_flag: "-Wl,-no-as-needed,-rpath,/usr/local/cuda/lib"
</code></pre></div>
<p dir="auto">Now I get failures at:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ERROR: /Users/anton/tmp/tensorflow/tensorflow/python/BUILD:793:1: Executing genrule //tensorflow/python:control_flow_ops_pygenrule failed: bash failed: error executing command 
  (cd /private/var/tmp/_bazel_anton/d3361bfa15c75c42ab541f3d83e8eba4/execroot/tensorflow &amp;&amp; \
  exec env - \
    PATH=/usr/local/cuda/bin:/Users/anton/.pyenv/shims:/Users/anton/.rbenv/shims:/Users/anton/.scalaenv/shims:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/anton/unix/bin:/usr/local/cuda/bin \
    TMPDIR=/var/folders/4r/mq7ht1z11t72w5b5b6014zwm0000gn/T/ \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/tensorflow/python/gen_control_flow_ops_py_wrappers_cc @tensorflow/python/ops/hidden_ops.txt 1 &gt; bazel-out/local_darwin-py3-opt/genfiles/tensorflow/python/ops/gen_control_flow_ops.py'): com.google.devtools.build.lib.shell.AbnormalTerminationException: Process terminated by signal 6.
dyld: Library not loaded: @rpath/libcudart.8.0.dylib
  Referenced from: /private/var/tmp/_bazel_anton/d3361bfa15c75c42ab541f3d83e8eba4/execroot/tensorflow/bazel-out/host/bin/tensorflow/python/gen_control_flow_ops_py_wrappers_cc
  Reason: image not found
/bin/bash: line 1: 45635 Abort trap: 6           bazel-out/host/bin/tensorflow/python/gen_control_flow_ops_py_wrappers_cc @tensorflow/python/ops/hidden_ops.txt 1 &gt; bazel-out/local_darwin-py3-opt/genfiles/tensorflow/python/ops/gen_control_flow_ops.py
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 1683.463s, Critical Path: 1587.37s"><pre class="notranslate"><code class="notranslate">ERROR: /Users/anton/tmp/tensorflow/tensorflow/python/BUILD:793:1: Executing genrule //tensorflow/python:control_flow_ops_pygenrule failed: bash failed: error executing command 
  (cd /private/var/tmp/_bazel_anton/d3361bfa15c75c42ab541f3d83e8eba4/execroot/tensorflow &amp;&amp; \
  exec env - \
    PATH=/usr/local/cuda/bin:/Users/anton/.pyenv/shims:/Users/anton/.rbenv/shims:/Users/anton/.scalaenv/shims:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/anton/unix/bin:/usr/local/cuda/bin \
    TMPDIR=/var/folders/4r/mq7ht1z11t72w5b5b6014zwm0000gn/T/ \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/tensorflow/python/gen_control_flow_ops_py_wrappers_cc @tensorflow/python/ops/hidden_ops.txt 1 &gt; bazel-out/local_darwin-py3-opt/genfiles/tensorflow/python/ops/gen_control_flow_ops.py'): com.google.devtools.build.lib.shell.AbnormalTerminationException: Process terminated by signal 6.
dyld: Library not loaded: @rpath/libcudart.8.0.dylib
  Referenced from: /private/var/tmp/_bazel_anton/d3361bfa15c75c42ab541f3d83e8eba4/execroot/tensorflow/bazel-out/host/bin/tensorflow/python/gen_control_flow_ops_py_wrappers_cc
  Reason: image not found
/bin/bash: line 1: 45635 Abort trap: 6           bazel-out/host/bin/tensorflow/python/gen_control_flow_ops_py_wrappers_cc @tensorflow/python/ops/hidden_ops.txt 1 &gt; bazel-out/local_darwin-py3-opt/genfiles/tensorflow/python/ops/gen_control_flow_ops.py
Target //tensorflow/tools/pip_package:build_pip_package failed to build
INFO: Elapsed time: 1683.463s, Critical Path: 1587.37s
</code></pre></div>
<p dir="auto">I got a bit further but it seems that I need to modify the link options in more files.</p>