Go to the previous, next section.
Warning: These installation instructions are current as of GDB version _GDB_VN__. If you're installing a more recent release of GDB, we may have improved the installation procedures since printing this manual; see the `README' file included in your release for the most recent instructions.
GDB comes with a configure
script that automates the process
of preparing GDB for installation; you can then use make
to
build the program.
The GDB distribution includes all the source code you need for GDB in a single directory, whose name is usually composed by appending the version number to `gdb'.
For example, the GDB version _GDB_VN__ distribution is in the `gdb-_GDB_VN__' directory. That directory contains:
gdb-_GDB_VN__/configure (and supporting files)
gdb-_GDB_VN__/gdb
gdb-_GDB_VN__/bfd
gdb-_GDB_VN__/include
gdb-_GDB_VN__/libiberty
gdb-_GDB_VN__/opcodes
gdb-_GDB_VN__/readline
gdb-_GDB_VN__/glob
gdb-_GDB_VN__/mmalloc
The simplest way to configure and build GDB is to run configure
from the `gdb-version-number' source directory, which in
this example is the `gdb-_GDB_VN__' directory.
First switch to the `gdb-version-number' source directory
if you are not already in it; then run configure
. Pass the
identifier for the platform on which GDB will run as an
argument.
For example:
cd gdb-_GDB_VN__ ./configure host make
where host is an identifier such as `sun4' or `decstation', that identifies the platform where GDB will run.
Running `configure host' followed by make
builds the
`bfd', `readline', `mmalloc', and `libiberty'
libraries, then gdb
itself. The configured source files, and the
binaries, are left in the corresponding source directories.
configure
is a Bourne-shell (/bin/sh
) script; if your
system does not recognize this automatically when you run a different
shell, you may need to run sh
on it explicitly:
sh configure host
If you run configure
from a directory that contains source
directories for multiple libraries or programs, such as the
`gdb-_GDB_VN__' source directory for version _GDB_VN__, configure
creates configuration files for every directory level underneath (unless
you tell it not to, with the `--norecursion' option).
You can run the configure
script from any of the
subordinate directories in the GDB distribution, if you only want to
configure that subdirectory; but be sure to specify a path to it.
For example, with version _GDB_VN__, type the following to configure only
the bfd
subdirectory:
cd gdb-_GDB_VN__/bfd ../configure host
You can install _GDBP__
anywhere; it has no hardwired paths.
However, you should make sure that the shell on your path (named by
the `SHELL' environment variable) is publicly readable. Remember
that GDB uses the shell to start your program--some systems refuse to
let GDB debug child processes whose programs are not readable.
If you want to run GDB versions for several host or target machines,
you'll need a different gdb
compiled for each combination of
host and target. configure
is designed to make this easy by
allowing you to generate each configuration in a separate subdirectory,
rather than in the source directory. If your make
program
handles the `VPATH' feature (GNU make
does), running
make
in each of these directories then builds the gdb
program specified there.
To build gdb
in a separate directory, run configure
with the `--srcdir' option to specify where to find the source.
(You'll also need to specify a path to find configure
itself from your working directory. If the path to configure
would be the same as the argument to `--srcdir', you can leave out
the `--srcdir' option; it will be assumed.)
For example, with version _GDB_VN__, you can build GDB in a separate directory for a Sun 4 like this:
cd gdb-_GDB_VN__ mkdir ../gdb-sun4 cd ../gdb-sun4 ../gdb-_GDB_VN__/configure sun4 make
When configure
builds a configuration using a remote source
directory, it creates a tree for the binaries with the same structure
(and using the same names) as the tree under the source directory. In
the example, you'd find the Sun 4 library `libiberty.a' in the
directory `gdb-sun4/libiberty', and GDB itself in
`gdb-sun4/gdb'.
One popular reason to build several GDB configurations in separate
directories is to configure GDB for cross-compiling (where GDB
runs on one machine--the host--while debugging programs that run on
another machine--the target). You specify a cross-debugging target by
giving the `--target=target' option to configure
.
When you run make
to build a program or library, you must run
it in a configured directory--whatever directory you were in when you
called configure
(or one of its subdirectories).
The Makefile
generated by configure
for each source
directory also runs recursively. If you type make
in a source
directory such as `gdb-_GDB_VN__' (or in a separate configured
directory configured with `--srcdir=path/gdb-_GDB_VN__'), you
will build all the required libraries, then build GDB.
When you have multiple hosts or targets configured in separate
directories, you can run make
on them in parallel (for example,
if they are NFS-mounted on each of the hosts); they will not interfere
with each other.
The specifications used for hosts and targets in the configure
script are based on a three-part naming scheme, but some short predefined
aliases are also supported. The full naming scheme encodes three pieces
of information in the following pattern:
architecture-vendor-os
For example, you can use the alias sun4
as a host argument
or in a --target=target
option, but the equivalent full name
is `sparc-sun-sunos4'.
The configure
script accompanying GDB does not provide
any query facility to list all supported host and target names or
aliases. configure
calls the Bourne shell script
config.sub
to map abbreviations to full names; you can read the
script, if you wish, or you can use it to test your guesses on
abbreviations--for example:
% sh config.sub sun4 sparc-sun-sunos411 % sh config.sub sun3 m68k-sun-sunos411 % sh config.sub decstation mips-dec-ultrix42 % sh config.sub hp300bsd m68k-hp-bsd % sh config.sub i386v i386-unknown-sysv % sh config.sub i786v Invalid configuration `i786v': machine `i786v' not recognized
config.sub
is also distributed in the GDB source
directory (`gdb-_GDB_VN__', for version _GDB_VN__).
configure
Options
Here is a summary of the configure
options and arguments that
are most often useful for building _GDBN__. configure
also has
several other options not listed here. @inforef{What Configure
Does,,configure.info}, for a full explanation of configure
.
configure [--help] [--prefix=dir] [--srcdir=path] [--norecursion] [--rm] [--target=target] host
You may introduce options with a single `-' rather than `--' if you prefer; but you may abbreviate option names if you use `--'.
--help
configure
.
-prefix=dir
--srcdir=path
make
, or another
make
that implements the VPATH
feature.
Use this option to make configurations in directories separate from the
GDB source directories. Among other things, you can use this to
build (or maintain) several configurations simultaneously, in separate
directories. configure
writes configuration specific files in
the current directory, but arranges for them to use the source in the
directory path. configure
will create directories under
the working directory in parallel to the source directories below
path.
--norecursion
configure
is executed; do not
propagate configuration to subdirectories.
--rm
--target=target
There is no convenient way to generate a list of all available targets.
host ...
There is no convenient way to generate a list of all available hosts.
configure
accepts other options, for compatibility with
configuring other GNU tools recursively; but these are the only
options that affect GDB or its supporting libraries.
_fi__(!_PRECONFIGURED__)
_if__(!_AGGLOMERATION__)
Go to the previous, next section.