This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Pathetic Newbie Problem


Hi Ben,

I am a bit of a newbie myself but hopefully I can help a bit. My following
comments are my interpretation of the instructions and I can't guarante
their accuracy...

> Like most GNU software, GCC must be configured before it can be built.
This
> document describes the recommended configuration procedure for both native
> and cross targets.
> >>What is the difference between *native* and *cross targets*?

native targets are when the target (resulting object code) is for the same
archicture as it is compiled on e.g compiling on Linux on a PC to run under
Linux on a PC. Cross targets are when the object code is for a different
target, e.g compiling on linux on a PC to run under Cygwin.


> We use srcdir to refer to the toplevel source directory for GCC; we use
> objdir to refer to the toplevel build/object directory.
> >>What is the *top level source directory*? What is the *top level
> build/object directory*? Can someone give me an example? Shall I build on
> /usr/bin/ ?
> First, we highly recommend that GCC be built into a separate directory
than
> the sources which does not reside within the source tree. This is how we
> generally build GCC; building where srcdir == objdir should still work,
but
> doesn't get extensive testing; building where objdir is a subdirectory of
> srcdir is unsupported.
> >>What are we calling the *source tree*? Is this like the doc root? Or the
> folder from which everything is built, like /usr/bin/gcc-2.95whateveritis.

GCC sources come as a directory tree - called the source tree. The top level
source directory is the topmost directory in that tree, usually something
like gcc-2.95.2. When you run the configure script it generates a similar
tree, specifically set up to your specifications. This contains the source
that you will actually build. You have to specify somewhere to put this
tree. This is the build/source directory. I normally use 'build-gcc' but it
can be anything.

This is the way I normally do this sort of thing:

in my home directory (/home/les) I untar my copy of gcc-2.95.2 (for
example). I will now have a directory called gcc-2.95.2 containing the
source tree.

mkdir build-gcc
cd build-gcc

../gcc-2.95.2/configure [options]
If you want a simple native compiler then you probably don't need to specify
any options.

wait a while as loads of obscure message fly up the screen

make all install

Wait even longer as it all compiles....

Unless you have specified --prefix=xxxx for configure then the compiler will
be installed in /usr/local (binaries will go in /usr/local/bin, libraries
into /usr/local/lib etc)

> Second, when configuring a native system, either "cc" or "gcc" must be in
> your path or you must set CC in your environment before running configure.
> Otherwise the configuration scripts may fail.
> >>I’m lost. What does that mean?

All this means is that you must have a working compiler on your path to
compile the source. If it is not on your path or is not called "cc" or "gcc"
then you need to set the environment variable CC to point to it. In most
cases you dont have to worry about this unless you are trying something
clever as this should already be set up.

> I’m really not as dumb as this must make me sound. I know enough UNIX to
be
> dangerous (especially to myself), but I code in high level languages.
> TIA,
> BenO
>

I know the feeling - I had it slightly worse, being a DOS type trying to
build a cross compiler for a h8300hms target.

BTW You should already have gcc with Red Hat 6.2. If not you should be able
to find it as a binary RPM on your installation CD. I am not sure exactly
what version you will have but it should be fairly up to date. Do you
actually need to go through this process?

Les




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]