2

I'd like to make a native build for the gcc compiler on my Windows 7 X64 laptop. After reading the installation instructions and realizing they were for a Unix system, I decided that it was time to seek help from someone with some more experience. I don't want to do anything fancy, just pretty much build the compiler in a fairly efficient form for my system.

I've already downloaded the source files and have a basic idea of where I want to install it but don't know how to proceed from there. I know there are pre-built binaries out there but I'd kinda like to make some optimizations specifically for my system.

Tamara Wijsman
  • 57,083
  • 27
  • 185
  • 256
Cole
  • 142
  • 2
  • 7
  • 3
    Building `gcc` for Windows is not a simple task, primarily because it makes so many assumptions about being built and installed into a unix-like environment that Windows doesn't even come close to providing. It's why projects like MinGW & MSYS exist -- to provide those foundations and patches just to get the compiler built. In fact, you'd do well to get very familiar with MinGW & friends first, because the results of your effort are going to end up similar to theirs, and there's no reason to redo their work unless you like reinventing wheels. – afrazier Feb 06 '12 at 21:12
  • 2
    add Cygwin, which can build windows (read: non-cygwin) code, with the appropriate flags and headers. – Rich Homolka Feb 06 '12 at 21:41
  • @afrazier, so what your saying is I might as well just grab their build since they have already done what I'm attempting to do? If that's the case, do you have a particular project you'd recommend I get my build from? – Cole Feb 06 '12 at 22:55

1 Answers1

3

As @afrazier and @Rich Homolka have said in comments to your question, you need Cygwin or MinGW & MSYS to build gcc on windows.

There is at least two projects on sourceforge that provide a build of gcc for developing 64 bit windows applications:

TDM-GCC version 4.6.1 (GCC / MinGW / MinGW-w64 compiler suite for 32- and 64-bit Windows) was built on Windows 7 64-bit using MinGW & MSYS. See the build notes. A single file installer is also available in the "Bundle Installer" section of the download page.

MinGW-w64 (GCC for both x64 & x86 Windows) has in their SVN repository a howto that describes how to build Mingw-w64 GCC on Cygwin, MinGW & MSYS, and *nix shells.

You can also have a look at the answers of these questions:

David L.
  • 260
  • 1
  • 7
  • 2
    I would opt for MinGW. It is specialized to create native Windows executables that don't need the cygwin1.dll library to work – sinni800 Feb 07 '12 at 08:27
  • Thank you both for the advice, I will start exploring your various suggestions. Setting up a C compiler on windows seems to be a lot more involved then I anticipated. – Cole Feb 08 '12 at 02:33
  • @Cole, installing gcc is much easier than building it from source. For example, TDM-GCC bundle installer provide a C compiler and associated tools in a few mouse clicks. – David L. Feb 08 '12 at 04:00