A library I wanted to use complained about gcc.exe not being in PATH.
https://golang.org/doc/install#requirements 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.)
I installed Mingw from the official website and now the library install says
cc1.exe: sorry, unimplemented: 64-bit mode not compiled in
I thought go was supposed to be easy and to just work?
评论:
SilentWeaponQuietWar:
au_travail:Try this, I'm pretty sure I remember it working for me on windows when nothing else would
SilentWeaponQuietWar:Thank you it worked. This should be linked on https://golang.org/doc/install#requirements
au_travail: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.
au_travail:ok I am trying it
au_travail:Lol now the https://sourceforge.net/projects/mingw-w64/ installer tells me "the file has been downloaded incorrectly!" and quits.
The_Jare:I thought I found a way to install 64-bit Windows gcc, but new errors...
>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
au_travail:I recall installing MinGW-W64 GCC-6.3.0, x86_64-posix-seh from https://sourceforge.net/projects/mingw-w64/files/ and it seemed to work fine.
The_Jare:https://www.reddit.com/r/golang/comments/60xr8t/how_to_get_cgo_to_work_on_windows_64_bit/dfa4qr3/
au_travail:I meant the actual zip file for that version/options combo, not the online installer.
cube2222:Ah ok.
au_travail:This will be a pretty non-standard proposition, but why not use bash on ubuntu on windows?
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.
cube2222:How am I causing pain to myself?
au_travail:By using cgo with windows -> in my opionion.
EDIT: With bash on ubuntu on windows you have a fully compatible linux environment.
bakunin:By using cgo with windows -> in my opionion.
I had to because I have Windows and the library I have to use asks for cgo.
As /u/cube2222 says you can enable bash on ubuntu on windows (now there's a mouthful) if you're on Windows 10:
https://msdn.microsoft.com/en-us/commandline/wsl/install_guide
