I am trying to get the Go bindings for Tensorflow going. I've followed the QuickStart instructions from the repo.
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/go
However the build command:
go get github.com/tensorflow/tensorflow/tensorflow/go
fails with the following error:
pendragon:src sjc$ go get github.com/tensorflow/tensorflow/tensorflow/go
# github.com/tensorflow/tensorflow/tensorflow/go
ld: library not found for -ltensorflow
clang: error: linker command failed with exit code 1 (use -v to see invocation)
pendragon:src sjc$
The lib has been downloaded and installed in /usr/local/lib
$ ls -l libtens*
-r-xr-xr-x 1 root wheel 107227008 1 Jan 1970 libtensorflow.so
It appears to all be setup as per instructions. Not sure how else to indicate to the Go build where to find the library. Anyone else got the Go wrapper to build?
Found the solution.
On both Linux and OSX to get it to build and test I needed to explicitly set the library paths.
On an Ubuntu VM I spun up for testing build:
~/work$ export LD_LIBRARY_PATH=/usr/local/lib
~/work$ export LIBRARY_PATH=/usr/local/lib
~/work$ go get github.com/tensorflow/tensorflow/tensorflow/go
~/work# go test github.com/tensorflow/tensorflow/tensorflow/go
ok github.com/tensorflow/tensorflow/tensorflow/go 0.210s
~/work$
On my local OSX machine:
pendragon:go sjc$ export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
pendragon:go sjc$ export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/usr/local/lib
pendragon:go sjc$ go get github.com/tensorflow/tensorflow/tensorflow/go
pendragon:go sjc$ go test github.com/tensorflow/tensorflow/tensorflow/go
ok github.com/tensorflow/tensorflow/tensorflow/go 0.237s
So it seems the instructions about setting those path environment variables seem to apply even if you have installed libtensorflow
into /usr/local/lib
.