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 用hfss做微带贴片阵列天线的时候分析设置有问题
  • ¥50 我撰写的python爬虫爬不了 要爬的网址有反爬机制
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥120 计算机网络的新校区组网设计
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等