Windows bootstrapping now easier

745 views
Skip to first unread message

Andrew Gerrand

unread,
Aug 11, 2014, 1:17:56 AM8/11/14
to golang-dev
I just updated the WindowsBuild wiki page with fresh instructions for building Go on Windows from scratch.

The new suggestion is to just use winstrap, which installs everything more or less automatically.

I updated winstrap to use TDM-GCC instead of the MinGW C compiler tool chain. The notable difference between the two is that TDM-GCC supports building 32- and 64-bit binaries from the one installation (by default!), whereas MinGW requires you to kludge around renaming directories when you want to switch between architectures.

So, next time you need to spin up a Windows VM it should be a lot easier.

(Also now seeking confirmation from Windows contributors that there's nothing inherently wrong with TDM-GCC. It seems mostly a matter of packaging, to me.)

Andrew

minux

unread,
Aug 11, 2014, 1:21:42 AM8/11/14
to Andrew Gerrand, golang-dev
FYI, i use tdm-gcc on windows/amd64, normal mingw gcc on windows/386.

Andrew Gerrand

unread,
Aug 11, 2014, 1:24:54 AM8/11/14
to minux, golang-dev

On 11 August 2014 15:21, minux <mi...@golang.org> wrote:
FYI, i use tdm-gcc on windows/amd64, normal mingw gcc on windows/386.

Why not use tdm-gcc on both?

brainman

unread,
Aug 11, 2014, 3:44:05 AM8/11/14
to golan...@googlegroups.com
That is what I use on windows/386

C:\go\root\src>gcc --version
gcc (tdm-1) 4.5.2
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and on windows/amd64

c:\go\root\src>gcc --version
gcc (GCC) 4.7.0 20111220 (experimental)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Sometimes I swap and change to different version of gcc (because I investigate gcc specific issues), but it always works fine. Mind you, I don't use cgo.

Alex

minux

unread,
Aug 11, 2014, 12:47:01 PM8/11/14
to Andrew Gerrand, golang-dev


On Aug 11, 2014 1:24 AM, "Andrew Gerrand" <a...@google.com> wrote:
> On 11 August 2014 15:21, minux <mi...@golang.org> wrote:
>> FYI, i use tdm-gcc on windows/amd64, normal mingw gcc on windows/386.

i think it's because of historical reasons.
i only know about mingw at first, but i couldn't find a working 64-bit binary release, so i found and switched to tdm, and it works well.

peterGo

unread,
Aug 11, 2014, 11:50:53 PM8/11/14
to golan...@googlegroups.com
Andrew,

I frequently install the Go tip from source (all.bat). I use the current version of tdm-gcc: tdm64-gcc-4.8.1-3.exe for Windows 7 and 8 and tdm-gcc-4.8.1-3.exe for a Windows XP VM.

Peter

chai2010

unread,
Aug 12, 2014, 4:46:29 AM8/12/14
to peterGo, golang-dev
I only use DevKit-mingw64:

gcc --version
gcc (rubenvb-4.7.2-release) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

rich.a...@gmail.com

unread,
Aug 12, 2014, 10:11:23 AM8/12/14
to golan...@googlegroups.com
On Monday, August 11, 2014 12:17:56 AM UTC-5, Andrew Gerrand wrote:
(Also now seeking confirmation from Windows contributors that there's nothing inherently wrong with TDM-GCC. It seems mostly a matter of packaging, to me.)

It would be awesome if Google built the MinGW-w64 binaries and hosted it -- especially given what Ken Thompson taught us about compiler backdoors.

TDM-GCC hasn't been updated in a while. If I'm not mistaken, TDM-GCC uses MinGW-w64 which is frequently updated.  It might be better to go directly to the original. 

Here's an example binary build that is kept more up-to-date:

And here's the changelog (just for the build using gcc-4.8.2) showing how it is actively maintained.
06.05.2014, rev4. - MinGW-w64 v3 rev.6606 07.03.2014, rev3. - MinGW-w64 v3 rev.6511 - GDB 7.7 07.01.2014, rev2. - MinGW-w64 v3 rev.6432 06.12.2013, rev1. - Binutils updated to 2.24 - MinGW-w64 v3 rev.6391 - Backport MinGW-w64 runtime commits from trunk to stable version: 6303: Fixed conflicts with xmmintrin.h. 6332: Install libvfw32.a once again 6385: Update shlwapi.def for Win7 32-bit 6386: Update shlwapi.def for Win7 64-bit 6390: Update shell32.def from Win7 - Update make to latest from git. - Fix installing gcc libraries for Python - Relocate c++ headers to <target>/include/c++ 28.10.2013, rev0 repack. - fix mingw32-make. 18.10.2013, rev0. - GCC 4.8.2 languages: C/C++/Fortran/Ada/ObjC/ObjC++ bootstrapped build 32-bit GCC/LD linked with --large-address-aware - MinGW-w64 v3 rev.6346 - MinGW-w64 tools (gendef, genidl, genpeimg, widl) - binutils-2.23.2 - gdb-7.6.1 - python-2.7.5 - GNU Make 4.0 from git

There are more bleeding edge versions using newer gcc versions, etc. But the above example seems like a good balance of gcc version and latest MinGW-w64 bugfixes.



Andrew Gerrand

unread,
Aug 12, 2014, 8:48:33 PM8/12/14
to rich.a...@gmail.com, golang-dev
On 13 August 2014 00:11, <rich.a...@gmail.com> wrote:
On Monday, August 11, 2014 12:17:56 AM UTC-5, Andrew Gerrand wrote:
(Also now seeking confirmation from Windows contributors that there's nothing inherently wrong with TDM-GCC. It seems mostly a matter of packaging, to me.)

It would be awesome if Google built the MinGW-w64 binaries and hosted it -- especially given what Ken Thompson taught us about compiler backdoors.

TDM-GCC hasn't been updated in a while. If I'm not mistaken, TDM-GCC uses MinGW-w64 which is frequently updated.  It might be better to go directly to the original. 

The problem I had with MinGW and MinGW-w64 is that I need two tool chains to build 32-bit and 64-bit binaries. TDM-GCC gives you a multi-architecture tool chain by default, which is great.

TDM-GCC ships gcc 4.8.1 which should be fine for our purposes (gcc is only really used during bootstrapping). In fact, it's generally better for us to build with older tool chains for compatibility reasons. (I build the Linux binaries on Debian stable, for example.)

Andrew

xap...@gmail.com

unread,
Jan 31, 2017, 12:05:33 PM1/31/17
to golang-dev, rich.a...@gmail.com
Hi Andrew,

I stumbled into the same pitfall.

Do you mean this site http://tdm-gcc.tdragon.net/download ?
But there are also 32 and 64 bit versions.

Do you mean that installing only this version:  tdm64-gcc-5.1.0-2.exe is sufficient?

TIA,
   Arie

Op woensdag 13 augustus 2014 02:48:33 UTC+2 schreef Andrew Gerrand:
Reply all
Reply to author
Forward
0 new messages