gxui UI Library - Can windows executables be cross-compiled from Linux ?

blov · · 1186 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p><a href="https://github.com/google/gxui">gxui</a> is an experimental Go cross platform UI library. <a href="http://imgur.com/a/koRfs">Imgur Album</a> to see some screenshots from some of the package samples.</p> <p>My question is : is it possible to cross-compile windows executables from Linux, for such a package with dependencies, etc .. ?</p> <hr/>**评论:**<br/><br/>slimsag: <pre><p>You would need a cross compiler (mingw) plus all the required dependencies installed on your system. It&#39;s do-able, just not easy in any way/shape/form.</p> <p>I would suggest building on a windows box directly, or spawning up a VM and building from there.</p></pre>locaml: <pre><p>ok, thanksa lot !</p></pre>mmtiller: <pre><p>I wrote up my experiences recently on this front. You can find them here. Bottom line is...yes, it is possible (including packages that use CGO):</p> <p><a href="https://groups.google.com/d/msg/golang-nuts/AlQvxD7wv30/dNNDUuSyTgoJ" rel="nofollow">https://groups.google.com/d/msg/golang-nuts/AlQvxD7wv30/dNNDUuSyTgoJ</a></p> <p>Note that I would not call this a simple or permanent solution.</p></pre>locaml: <pre><p>thanks, I&#39;ll have a look</p></pre>DongerDave: <pre><p>There&#39;s an incredibly simple way.</p> <pre><code>docker run -v my_go_path:/go -e GOOS=windows golang:cross go build -v github.com/user/package </code></pre> <p>And that&#39;s it. Really that easy. And yes, I&#39;ve done this and it works great :)</p> <p>Also, useful article if you want to live on the bleeding edge: <a href="http://dave.cheney.net/2015/03/03/cross-compilation-just-got-a-whole-lot-better-in-go-1-5" rel="nofollow">http://dave.cheney.net/2015/03/03/cross-compilation-just-got-a-whole-lot-better-in-go-1-5</a></p></pre>slimsag: <pre><p>This won&#39;t work for any CGO packages (gxui); from said article:</p> <blockquote> <p>Out of scope</p> <p>Cross compilation while linking to libraries via cgo is the holy grail for some. &gt; Sadly the changes mentioned above do not change the situation with respect to cgo. In fact you may still need to rebuild your Go installation in the traditional way to pass environment variables like CC_FOR_TARGET. Please try it out.</p> </blockquote></pre>

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

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