Installing GCC: Some more elementary questions.

Rupert Wood
Fri Nov 9 22:32:00 GMT 2001

Kabir Patel wrote:

*Beware* that you need an existing C compiler to build the GCC sources.
If you do not already have a C compiler on your system then you will
need a binary distribution of GCC. Follow the 'binaries' link on

> a) It states "We use srcdir to refer to the toplevel source
> directory for GCC; we use objdir to refer to the toplevel
> build/object directory."
> Is srcdir the place where I copied the uncompressed files into?

Perhaps: it's the 'gcc-3.02' directory (or similar) that was generated
by the untar operation. (I'm not sure why you'd have to copy them -
unless you're doing a binutils / toolchain merge on a system without
hard links, and I doubt you are.)

> What files initially go into objdir?

Nothing; the configure step generates files here.

> b) It also states "If you obtained the sources via CVS, srcdir must
> refer to the top gcc directory, the one where the MAINTAINERS can
> be found, and not its gcc subdirectory, otherwise the build will
> fail. "

(If you don't understand this, this probably doesn't apply.)

> What does CVS stand for?

Concurrent Versions System. See It's the source
control system used for GCC development.

> What does the MAINTAINERS mean?

Perhaps "the MAINTAINERS" is unclear. MAINTAINERS is a file that
contains a list of people with permissions to make changes to the GCC
CVS source repository. You'll find it in srcdir.

> c) Further it states "First, we highly recommend that GCC be built
> into a separate directory than the sources which does not reside
> within the source tree."
> What does the sources mean? Is this just the set of uncompressed
> files I copied over?

Yes - these are the source files for the compiler (which are compiled
into assembler files, which are assembled into binary object files,
which are linked to form a binary executable).

> What does it mean by source tree?

It means srcdir, its subdirectories, all of their subdirectories, etc.
I.e. you should not make 'objdir' a subdirectory of 'srcdir'.

> d) If I just want a simple C compiler do I need to use the "options"
> and "target" specifications mentioned below?
>    % mkdir objdir
>    % cd objdir
>    % srcdir/configure [options] [target]

You're expected to substitute those with the relevant options and target
name for your own situation.

To see a list of available compile options, you would run
'srcdir/configure --help' in the above example. Unless you're going to
install the compiler as root, you at least want to specify '--prefix' to
point to somewhere in or beneath your own home directory. You may also
want to specify '--enable-threads'. If you just want a plain C compiler,
you can specify '--enable-languages=c' or '--enable-languages=c++' to
build C and C++. If you don't specify a language set, it will probably
attempt to build compilers for C, C++, Objective C, Java and Fortran 77.

If you're building a native compiler (i.e. to be run on and to compile
for the machine you're building it on) then you don't need to specify

Hope that helps,

More information about the Gcc-help mailing list