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've downloaded GCC 4.5.1 and do not now what to do next. I've found inside the Install directory instructions how to configure, build and install but still cannot do much with this. May someone step by step write down how am I suppose to go through this process?
For example, they saying something like this:

        % mkdir objdir
        % cd objdir
        % srcdir/configure [options] [target]  

and I do understand that first line asks to create an directory and second asks to go into this but what about third one and how am I suppose to execute this? Am I suppose to go to source directory and type configure + options + target?

share|improve this question
What OS are you attempting to do this on? –  Clifford Oct 3 '10 at 8:06
@Clifford Windows7 –  There is nothing we can do Oct 3 '10 at 8:34
@AllWhoVoteToClose what's wrong with this question? Is it that difficult to explain? And if so it means that the official instructions are just not up to scratch. –  There is nothing we can do Oct 3 '10 at 8:54
Should this be on Serverfault.com? This is related to installation of GCC - administrators would know this better. –  Jayan Oct 3 '10 at 8:55
Based on your obvious lack of experience compiling programs, I think it would be much more sensible to download a binary verion of GCC. –  PiedPiper Oct 3 '10 at 9:21
add comment

migrated from stackoverflow.com Oct 3 '10 at 20:48

This question came from our site for professional and enthusiast programmers.

2 Answers

Seriously, if you don't even understand what srcdir/configure [options] [target] is supposed to do, you shouldn't compile GCC yourself. But as you asked for it...

srcdir/configure is the Linux command for starting the file srcdir/configure from the current directory (not from "srcdir"!). As of the installation guide, the current directory is "objdir", i.e. the directory in which you want to build GCC. From the installation guide:

We use srcdir to refer to the toplevel source directory for GCC; we use objdir to refer to the toplevel build/object directory. [...] we highly recommend that GCC be built into a separate directory from the sources which does not reside within the source tree.

So, "srcdir" must be the path where you have extracted the GCC source code, e.g. "/home/username/Desktop/gcc-4.5.1", and "objdir" must be a path where you want to build GCC, e.g. "/tmp/gccbuild". When you created the latter, you can go on with the build configuration, so in a terminal, change to the build directory and type "srcdir/configure" (replace "srcdir" with the source code path!!). This should configure the build with standard settings and your current architecture (most probably x86 or x64).

For extended configuration, you must replace the [options] placeholder with the configuration options for gcc, for example --with-gmp=/usr/local and other settings that are listed in the autoconf scripts. They can also be found in the installation guide under the heading "Distributor options". The [target] placeholder is not necessary as the configure script automatically detects your architecture (that's what the documentation says).

As I said before, don't build GCC yourself except if you really have to. It seems like Ubuntu Maverick will have GCC 4.5 in the near future, so you can grab the Ubuntu package then.

share|improve this answer
@AndiDog so how am I suppose to execute srcdir/configure ... am I suppose to cd there or what? –  There is nothing we can do Oct 3 '10 at 8:35
@AndiDog as you said yourself I do not understand what srcdir/configure means and yet you do not care to explain it in your answer. Why? –  There is nothing we can do Oct 3 '10 at 8:42
@There is nothing we can do: Sorry, I extended my answer to explain what it does. –  AndiDog Oct 3 '10 at 8:58
@AndiDog Thanks for your answer. I expected that I'm suppose to type configure while in srcdir (relax I know what it means;)) but console gives me an error that configure isn't recognizable command. Any help with that? I run console with administrator rights from Accessories/Console. –  There is nothing we can do Oct 3 '10 at 9:03
@There is nothing we can do: I don't think you need root rights to compile GCC (only for the installation). There is a file called "configure" in the source tree. So if you extracted the source as "/home/username/Desktop/gcc-4.5.1", the command would be /home/username/Desktop/gcc-4.5.1/configure. –  AndiDog Oct 3 '10 at 9:32
show 5 more comments

On Windows 7 you would have trouble executing Linux configure scripts, or even executing the commands you have listed. Building GCC on Windows is not for the faint-hearted; (in fact building GCC at all is not for the faint hearted).

You have two practical choices:

  1. Install Cygwin and perform the build in its bash shell. Cygwin is a Linux emulation layer for Windows. The problem with this is that applications you build (including the compiler) will normally require Cygwin installed in order to run. Cygwin already included teh GCC compiler, so unless you need a specific version, you may not need to build it at all.

  2. Use MinGW. You could probably build GCC under MinGW/MSYS, but there is probably no need since again MinGW already included the compiler. MinGW/GCC allows GCC built applications to run as native Win32 applications. They use Microsoft's VC++ C runtime library rather than GNU libc. This makes Win32 development simple, but restricts what Linux code will build out of the box.

share|improve this answer
add comment

Your Answer


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.