tensorflow: Library not loaded: @rpath/libcudart.7.5.dylib

+@trevorwelch

From the discussion in #4105 and #4145, this is the tracking bug for the following error:

ERROR: /Users/production204/Github/tensorflow/tensorflow/cc/BUILD:179:1: Executing genrule //tensorflow/cc:training_ops_genrule failed: bash failed: error executing command 
  (cd /private/var/tmp/_bazel_production204/ed2bbf43bcd665c40f1e3ebaa04f68f6/execroot/tensorflow && \
  exec env - \
    PATH=/usr/local/cuda/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:usr/local/sbin:/usr/local/mysql/bin:/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin \
    TMPDIR=/var/folders/h3/pn9k79xn6qd9jgksqbkpn3l80000gn/T/ \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/tensorflow/cc/ops/training_ops_gen_cc bazel-out/local_darwin-opt/genfiles/tensorflow/cc/ops/training_ops.h bazel-out/local_darwin-opt/genfiles/tensorflow/cc/ops/training_ops.cc 0'): com.google.devtools.build.lib.shell.AbnormalTerminationException: Process terminated by signal 5.
dyld: Library not loaded: @rpath/libcudart.7.5.dylib
  Referenced from: /private/var/tmp/_bazel_production204/ed2bbf43bcd665c40f1e3ebaa04f68f6/execroot/tensorflow/bazel-out/host/bin/tensorflow/cc/ops/training_ops_gen_cc
  Reason: image not found
/bin/bash: line 1: 74845 Trace/BPT trap: 5       bazel-out/host/bin/tensorflow/cc/ops/training_ops_gen_cc bazel-out/local_darwin-opt/genfiles/tensorflow/cc/ops/training_ops.h bazel-out/local_darwin-opt/genfiles/tensorflow/cc/ops/training_ops.cc 0
Target //tensorflow/cc:tutorials_example_trainer failed to build
INFO: Elapsed time: 3111.405s, Critical Path: 3097.65s

production204@Trevors-MacBook-Pro tensorflow $ 

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 28 (8 by maintainers)

Most upvoted comments

@davidzchen

your error exactly like mine, i have fix this problem. My compute: 2012 early iMac CPU:i5 Display Card: GT640M

Xcode 7.3 CUDA 7.5.27 CUDNN 4

here my solution: https://github.com/JimmyKon/tensorflow_build_issue_fix/tree/master

I found the genrule-setup.sh file will execute before error.

...execroot/tensorflow/external/bazel_tools/tools/genrule/genrule-setup.sh

ok, print file timestamp first.

stat genrule-setup.sh

output like this:

16777217 56288053 -rwxr-xr-x 1 ****** wheel 0 242 "Sep  4 23:26:23 2016" "Sep  2 22:34:23 2026" "Sep  4 22:34:24 2016" "Sep  4 22:34:21 2016" 4096 8 0 genrule-setup.sh

“Sep 2 22:34:23 2026”? yes, record this timestamp.

open this file, add the environment configuration to the end of the file

export DYLD_LIBRARY_PATH=/usr/local/cuda/lib

and then, recover genrule-setup.sh timestamp

touch -t YYYYMMDDhhmm.SS genrule-setup.sh

YYYYMMDDhhmm.SS is your recorded timestamp,my situation is 202609022234.23

compile again, done.

bazel build -c opt --config=cuda //tensorflow/tools/pip_package:build_pip_package

@gunan 's comment helped me!

I’ve been reading about this issue and possible fixes for it for a bit now.

People have success with

sudo ln -s /usr/local/cuda/lib/libcuda.dylib /usr/local/cuda/lib/libcuda.1.dylib

and with setting

export DYLD_LIBRARY_PATH="/Developer/NVIDIA/CUDA-8.0/lib:/usr/local/cuda/lib"

However. In my case, these two did not help solve the issue fully. I also had to do:

export LD_LIBRARY_PATH=/usr/local/cuda/lib

Now, it works!

As a data point, configuring TF 0.11.0 source from git (282823b877f173e6a33bbc9d4b9ad7dd8413ada6) for GPU usage specifying ‘8.0’ in the configure script, and using Xcode Command Line Tools 7.3.1 results in the same error

Executing genrule //tensorflow/contrib/layers:bucketization_op_pygenrule failed: bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped): com.google.devtools.build.lib.shell.AbnormalTerminationException: Process terminated by signal 6. dyld: Library not loaded: @rpath/libcudart.8.0.dylib I in fact do have a libcudart.8.0.dylib in the default cuda install location.