Statically linking TensorFlow?

agolangf · 2017-09-08 21:00:07 · 657 次点击    
这是一个分享于 2017-09-08 21:00:07 的资源,其中的信息可能已经有所发展或是发生改变。

Hello!

I am trying to make a completely self contained executable for my project, but I am unable to statically link TensorFlow. No linking flags or bazel build options help.

Any advice?

Thanks!


评论:

phillydogg28:

I followed this article to learn how to do it. In the end I created a Dockerfile that used the golang base image, installed musl, then a build command with: CC=/usr/local/musl/bin/musl-gcc GOOS=linux go build --ldflags '-linkmode external -extldflags "-static"' github.com/company/project

wheey:

Could you please provide a example which you already have tried and version of Go - would be appreciated.

chocol4tebubble5:

Sorry, I am on version 1.9. I've used "CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' " as well as the same flags with cgo.


入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

657 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传