Adventures Building GCC 4.6.0 for Cygwin

I decided I wanted to try out GCC using Cygwin rather than my usual Ubuntu virtual machine. In the course of this adventure I learned how to build GCC 4.6.0 for Cygwin, got my feet wet over on StackOverflow, and made some substantial updates on the Cygwin Wikia for this subject.

Are YOU a Cygwin user who is not satisfied with GCC 3.4.4 (the latest one they offer)? Want to build a far more modern release of GCC for Cygwin? Read more on the Wikia – it works: I just spent a few hours (im)proving it!

(This also inspired my subsequent post about process logging… nothing makes good logging worthwhile like rebuilding a compiler!)

5 Comments


  1. You’re incorrect: Cygwin provides a gcc4 package which includes GCC 4.5, not he latest, but still very recent stuff.

    Reply

    1. Point taken, though I based that comment on info from the Cygwin Wikia page I ended up updating. Even now, 3.4.4-999 is what people normally get as part of the devel pacakages (and not all users are aware that the gcc4 package is out there, which itself is 3 releases behind for 4.3, or one behind for 4.5 if you choose the experimental version). That all said, I’m not sure what versions of Cygwin’s gcc4 were around back when I posted this in May, 2011, though they may have been the samme.

      I updated the Cygwin Wikia page to reflect this new information, including mention of gcc4.

      Reply

  2. u can install gcc4 version 4.5.3 from cygwin Devel package.
    Unfortunately, not all C++11 features were supported. At least it won’t work for range-based foor loop. You will need to upgrade to gcc 4.6.1

    Reply

  3. I need the Cygwin gcc-3.4.6 executable of for that matter the most recent gcc that still implements -mno-cygwin. I tried building using your formula but in the final step, encountered an error:

    /usr/local/contrib/build
    $ make install
    .
    .
    .
    make[1]: Leaving directory `/usr/local/contrib/build/intl’
    make[1]: Entering directory `/usr/local/contrib/build/libiberty’
    make[1]: *** No rule to make target `install’. Stop.
    make[1]: Leaving directory `/usr/local/contrib/build/libiberty’
    Makefile:19896: recipe for target `install-libiberty’ failed
    make: *** [install-libiberty] Error 2

    Question: Any advise or perhaps just build me a gcc-3.4.6 executable, anyone?

    Reply

    1. Well, my article was about 4.6.x, not 3.4, so I can’t guarantee this process would work (and I’m not building custom ones for distribution).

      However, a quick search for “gcc-3.4.6 cygwin mirror” results in several mirror sites you can retrieve that specific version from. That’s the best way to go.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*