dongxinxin7809 2017-02-11 04:00
浏览 111

为Tensorflow构建Go绑定时出错

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?

  • 写回答

1条回答 默认 最新

  • dthtvk3666 2017-02-11 06:36
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退
  • ¥20 win系统的PYQT程序生成的数据如何放入云服务器阿里云window版?