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.

3
  • 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
    Commented Feb 6, 2012 at 21:12
  • 2
    add Cygwin, which can build windows (read: non-cygwin) code, with the appropriate flags and headers. Commented Feb 6, 2012 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
    Commented Feb 6, 2012 at 22:55

1 Answer 1

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:

3
  • 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
    Commented Feb 7, 2012 at 8: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
    Commented Feb 8, 2012 at 2: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.
    Commented Feb 8, 2012 at 4:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .