MIPS Cross-Compiler on Go 1.5?

polaris · · 2660 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi all,</p> <p>I&#39;m having trouble finding up-to-date information on how to cross compile go for MIPS; there appears to be little material to begin with, and furthermore the search results available are swamped with gccgo information and pre-1.5 toolchain setup.</p> <p>I&#39;d like to develop tools for OpenWRT based embedded systems such as <a href="http://www.black-swift.com">Black Swift</a>. When I run <code>file</code> on busybox to get build info, I got:</p> <pre><code>$ file `which busybox` /bin/busybox: ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), corrupted section header size </code></pre> <p>What&#39;s the suggested way to set up a cross-compiler for mips these days that would help me compile to the above?</p> <p>Thanks!</p> <h3>Update on incomplete progress so far</h3> <p>Here&#39;s what I have so far:</p> <ol> <li>Go doesn&#39;t natively support MIPS, which makes me sad.</li> <li>GCCGO <em>might</em> support MIPS. I am lead to understand that building GCCGO involves building GCC with the configure directive <code>--enable-languages=go</code></li> <li>For MIPS, the cleanest option to make a toolchain appears to be <a href="http://buildroot.uclibc.org/">Buildroot</a></li> <li>Instructions <a href="http://docwiki.gumstix.org/index.php?title=Buildroot_on_Ubuntu">here</a> on setting up for Ubuntu, and <a href="http://www.uclibc.org/toolchains.html">here</a> on customising. <ul> <li>In this case, customisation means going to <code>buildroot-2015.08.1/package/gcc/gcc-final</code> and editing line 45 to read: <code>GCC_FINAL_CROSS_LANGUAGES-y = c go</code></li> </ul></li> <li>Then, running <code>make menuconfig</code> in the buildroot base directory and setting the target architecture and toolchain options. I set wchar support and a few other features that are likely nonessential.</li> <li>Save menuconfig and exit.</li> <li><code>make</code></li> </ol> <p>This is as far as I&#39;ve gotten; the build is underway. Let&#39;s see can I get a gccgo crosscompiler for mips?</p> <hr/>**评论:**<br/><br/>lapingvino: <pre><p>MIPS support is in the works for 1.6 afaik, you are right that it&#39;s only out there for GCCGO at the moment, and that seems to be a royal pain...</p></pre>cathalgarvey: <pre><p>A pain is right. The build failed, when I removed &#39;go&#39; from the makefile and retried it worked. Now I have to debug a build failure in GCC. FML.</p> <p><em>edit</em>: As <a href="http://www.sajalkayan.com/post/golang-openwrt-mips.html" rel="nofollow">others with more patience than I</a> have tried to get this working with bare success, I think I might hold out for real MIPS support in 1.6. The Black Swift supports Python (2.7, ugh) and for now that&#39;ll do, because life&#39;s too short for this crap.</p></pre>lapingvino: <pre><p>Maybe the best option would be to compile a GCC cross-compiler for MIPS on a non-MIPS system and compile your go programs for the MIPS target? Not as easy as the Go cross-compiler, true, but should be still possible...</p> <p><a href="https://www.google.nl/webhp?sourceid=chrome-instant&amp;ion=1&amp;espv=2&amp;es_th=1&amp;ie=UTF-8#q=gcc%20cross%20compile%20mips&amp;es_th=1" rel="nofollow">https://www.google.nl/webhp?sourceid=chrome-instant&amp;ion=1&amp;espv=2&amp;es_th=1&amp;ie=UTF-8#q=gcc%20cross%20compile%20mips&amp;es_th=1</a> seems to have some good entries :)</p></pre>

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

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