collect2
works; how it finds ld
.
Here is the procedure for installing GNU CC on a Unix system. See section Installing GNU CC on VMS, for VMS systems. In this section we assume you compile in the same directory that contains the source files; see section Compilation in a Separate Directory, to find out how to compile in a separate directory on Unix systems.
You cannot install GNU C by itself on MSDOS; it will not compile under any MSDOS compiler except itself. You need to get the complete compilation package DJGPP, which includes binaries as well as sources, and includes all the necessary compilation tools and libraries.
PATH
. The cc
command in
`/usr/ucb' uses libraries which have bugs.
A configuration name may be canonical or it may be more or less abbreviated.
A canonical configuration name has three parts, separated by dashes. It looks like this: `cpu-company-system'. (The three parts may themselves contain dashes; `configure' can figure out which dashes serve which purpose.) For example, `m68k-sun-sunos4.1' specifies a Sun 3.
You can also replace parts of the configuration by nicknames or aliases. For example, `sun3' stands for `m68k-sun', so `sun3-sunos4.1' is another way to specify a Sun 3. You can also use simply `sun3-sunos', since the version of SunOS is assumed by default to be version 4. `sun3-bsd' also works, since `configure' knows that the only BSD variant on a Sun 3 is SunOS.
You can specify a version number after any of the system types, and some of the CPU types. In most cases, the version is irrelevant, and will be ignored. So you might as well specify the version if you know it.
See section Configurations Supported by GNU CC, for a list of supported configuration names and notes on many of the configurations. You should check the notes in that section before proceeding any further with the installation of GNU CC.
There are four additional options you can specify independently to describe variant hardware and software configurations. These are `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
as
in various directories; if the program it finds is GAS, then
it runs GAS. If you are not sure where GNU CC finds the assembler it is
using, try specifying `-v' when you run it.
The systems where it makes a difference whether you use GAS arecollect2
, a program
which otherwise serves as a front-end for the system's linker on most
configurations.
The `configure' script searches subdirectories of the source directory for other compilers that are to be integrated into GNU CC. The GNU compiler for C++, called G++ is in a subdirectory named `cp'. `configure' inserts rules into `Makefile' to build all of those compilers.
Here we spell out what files will be set up by configure
. Normally
you need not be concerned with these files.
--local-prefix
option below.
fixincludes
script.
PATH
environment variable such that the necessary GNU tools come
before the standard system tools.
make stage1The files are moved into a subdirectory named `stage1'. Once installation is complete, you may wish to delete these files with
rm -r stage1
.
PATH
environment variable such that the necessary GNU tools come
before the standard system tools.
make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"This is called making the stage 2 compiler. The command shown above builds compilers for all the supported languages. If you don't want them all, you can specify the languages to build by typing the argument `LANGUAGES="list"'. list should contain one or more words from the list `c', `c++', `objective-c', and `proto'. Separate the words with spaces. `proto' stands for the programs
protoize
and
unprotoize
; they are not a separate language, but you use
LANGUAGES
to enable or disable their installation.
If you are going to build the stage 3 compiler, then you might want to
build only the C language in stage 2.
Once you have built the stage 2 compiler, if you are short of disk
space, you can delete the subdirectory `stage1'.
On a 68000 or 68020 system lacking floating point hardware,
unless you have selected a `tm.h' file that expects by default
that there is no such hardware, do this instead:
make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
make stage2 make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"This is called making the stage 3 compiler. Aside from the `-B' option, the compiler options should be the same as when you made the stage 2 compiler. But the
LANGUAGES
option need not be the
same. The command shown above builds compilers for all the supported
languages; if you don't want them all, you can specify the languages to
build by typing the argument `LANGUAGES="list"', as described
above.
If you do not have to install any additional GNU tools, you may use the
command
make bootstrap LANGUAGES=language-list BOOT_CFLAGS=option-listinstead of making `stage1', `stage2', and performing the two compiler builds.
make compareThis will mention any object files that differ between stage 2 and stage 3. Any difference, no matter how innocuous, indicates that the stage 2 compiler has compiled GNU CC incorrectly, and is therefore a potentially serious bug which you should investigate and report (see section Reporting Bugs). If your system does not put time stamps in the object files, then this is a faster way to compare them (using the Bourne shell):
for file in *.o; do cmp $file stage2/$file doneIf you have built the compiler with the `-mno-mips-tfile' option on MIPS machines, you will not be able to compare the files.
make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
CC
,
CFLAGS
and LANGUAGES
that you used when compiling the
files that are being installed. One reason this is necessary is that
some versions of Make have bugs and recompile files gratuitously when
you do this step. If you use the same variable values, those files will
be recompiled properly.
For example, if you have built the stage 2 compiler, you can use the
following command:
make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="list"This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1', `cpp' and `libgcc.a' in the directory `/usr/local/lib/gcc-lib/target/version', which is where the compiler driver program looks for them. Here target is the target machine type specified when you ran `configure', and version is the version number of GNU CC. This naming scheme permits various versions and/or cross-compilers to coexist. This also copies the driver program `xgcc' into `/usr/local/bin/gcc', so that it appears in typical execution search paths. On some systems, this command causes recompilation of some files. This is usually due to bugs in
make
. You should either ignore this
problem, or use GNU Make.
Warning: there is a bug in alloca
in the Sun library. To
avoid this bug, be sure to install the executables of GNU CC that were
compiled by GNU CC. (That is, the executables from stage 2 or 3, not
stage 1.) They use alloca
as a built-in function and never the
one in the library.
(It is usually better to install GNU CC executables from stage 2 or 3,
since they usually run faster than the ones compiled with some other
compiler.)
make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"