Skip to content

Instantly share code, notes, and snippets.

@peterbraden
Last active May 6, 2016 13:10
Show Gist options
  • Save peterbraden/1f6e52045c27cfcb8a5c13b1ef82c94f to your computer and use it in GitHub Desktop.
Save peterbraden/1f6e52045c27cfcb8a5c13b1ef82c94f to your computer and use it in GitHub Desktop.
Tensorflow -> NodeJS Issues

Problem: Need to link to library ../../../bazel-out/tensorflow/libtensorflow.so

  • bazel-out is a symlink within a relative path -> need abspath. Current workaround:
'libraries': [
      #HACK
      "<!(python -c 'import os,sys; print os.path.realpath(sys.argv[1])' ../../../../tensorflow/bazel-bin/tensorflow/libtensorflow.so)"
    ],

DYLib Linking problem.

Need to link in a way that dlopen can resolve, but dyld_library_path is removed with SIP on El Capitan, so no way to have "sub open's" know about the path to the library.

Traceback:

Error: dlopen(/Users/peterbraden/repos/tensorflow/tensorflow/contrib/nodejs/build/Release/tensorflow.node, 1): Library not loaded: bazel-out/local_darwin-fastbuild/bin/tensorflow/libtensorflow.so
  Referenced from: /Users/peterbraden/repos/tensorflow/tensorflow/contrib/nodejs/build/Release/tensorflow.node
  Reason: image not found

Reference:

Problem: libtensorflow has relative path.

> otool -L ../../../bazel-bin/tensorflow/libtensorflow.so
../../../bazel-bin/tensorflow/libtensorflow.so:
        bazel-out/local_darwin-fastbuild/bin/tensorflow/libtensorflow.so (compatibility version 0.0.0, current version 0.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
        /usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)

SOLVED: Need to use bazel to build, which expects BUILD filename, but node-gyp already squats on build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment