<p>A library I wanted to use complained about gcc.exe not being in PATH.</p>
<p><a href="https://golang.org/doc/install#requirements">https://golang.org/doc/install#requirements</a> told me to install MinGW gcc. (By the way "A C compiler is required only if you plan to use cgo." is wrong. You don't need to plan to use it to end up having to use it.)</p>
<p>I installed Mingw from <a href="http://www.mingw.org/wiki/Getting_Started">the official website</a> and now the library install says</p>
<pre><code>cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
</code></pre>
<p>I thought go was supposed to be easy and to just work?</p>
<hr/>**评论:**<br/><br/>SilentWeaponQuietWar: <pre><p>Try this, I'm pretty sure I remember it working for me on windows when nothing else would</p>
<p><a href="http://tdm-gcc.tdragon.net/">http://tdm-gcc.tdragon.net/</a></p></pre>au_travail: <pre><p>Thank you it worked. This should be linked on <a href="https://golang.org/doc/install#requirements" rel="nofollow">https://golang.org/doc/install#requirements</a></p></pre>SilentWeaponQuietWar: <pre><p>glad it helped. I can't tell you how many hours of frustration I went through before finding it mentioned in some obscure forum. I agree it should be at least cited somewhere. Everyone always links to mingw and I've never gotten it to work.</p></pre>au_travail: <pre><p>ok I am trying it</p></pre>au_travail: <pre><p>Lol now the <a href="https://sourceforge.net/projects/mingw-w64/" rel="nofollow">https://sourceforge.net/projects/mingw-w64/</a> installer tells me "the file has been downloaded incorrectly!" and quits.</p></pre>au_travail: <pre><p>I thought I found a way to install 64-bit Windows gcc, but new errors...</p>
<pre><code>>go get github.com/mattn/go-sqlite3
# github.com/mattn/go-sqlite3
/usr/lib/gcc/x86_64-pc-msys/6.3.0/../../../../x86_64-pc-msys/bin/ld: cannot find
-lmingwex
/usr/lib/gcc/x86_64-pc-msys/6.3.0/../../../../x86_64-pc-msys/bin/ld: cannot find
-lmingw32
collect2: error: ld returned 1 exit status
</code></pre></pre>The_Jare: <pre><p>I recall installing MinGW-W64 GCC-6.3.0, x86_64-posix-seh from <a href="https://sourceforge.net/projects/mingw-w64/files/" rel="nofollow">https://sourceforge.net/projects/mingw-w64/files/</a> and it seemed to work fine.</p></pre>au_travail: <pre><p><a href="https://www.reddit.com/r/golang/comments/60xr8t/how_to_get_cgo_to_work_on_windows_64_bit/dfa4qr3/" rel="nofollow">https://www.reddit.com/r/golang/comments/60xr8t/how_to_get_cgo_to_work_on_windows_64_bit/dfa4qr3/</a></p></pre>The_Jare: <pre><p>I meant the actual zip file for that version/options combo, not the online installer.</p></pre>au_travail: <pre><p>Ah ok.</p></pre>cube2222: <pre><p>This will be a pretty non-standard proposition, but why not use bash on ubuntu on windows? </p>
<p>The cgo stuff is much less cross-platform than the standard Go stuff and you're just going to be causing a lot of pain to yourself.</p></pre>au_travail: <pre><p>How am I causing pain to myself?</p></pre>cube2222: <pre><p>By using cgo with windows -> in my opionion.</p>
<p>EDIT: With bash on ubuntu on windows you have a fully compatible linux environment.</p></pre>au_travail: <pre><blockquote>
<p>By using cgo with windows -> in my opionion.</p>
</blockquote>
<p>I had to because I have Windows and the library I have to use asks for cgo.</p></pre>bakunin: <pre><p>As <a href="/u/cube2222" rel="nofollow">/u/cube2222</a> says you can enable <em>bash on ubuntu on windows</em> (now there's a mouthful) if you're on Windows 10:</p>
<p><a href="https://msdn.microsoft.com/en-us/commandline/wsl/install_guide" rel="nofollow">https://msdn.microsoft.com/en-us/commandline/wsl/install_guide</a></p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传