Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
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 6 '12 at 21:12
2  
add Cygwin, which can build windows (read: non-cygwin) code, with the appropriate flags and headers. –  Rich Homolka Feb 6 '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 6 '12 at 22:55

1 Answer 1

up vote 2 down vote accepted

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:

share|improve this answer
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 7 '12 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 Feb 8 '12 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. Feb 8 '12 at 4:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.