Annotation of gcc/install.texi, revision 1.1.1.2

1.1       root        1: @c Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc.
                      2: @c This is part of the GCC manual.
                      3: @c For copying conditions, see the file gcc.texi.
                      4: 
                      5: @c The text of this file appears in the file INSTALL
                      6: @c in the GCC distribution, as well as in the GCC manual.
                      7: 
                      8: @ifclear INSTALLONLY
                      9: @node Installation
                     10: @chapter Installing GNU CC
                     11: @end ifclear
                     12: @cindex installing GNU CC
                     13: 
                     14: Here is the procedure for installing GNU CC on a Unix system.
                     15: 
                     16: @menu
                     17: * Other Dir::     Compiling in a separate directory (not where the source is).
                     18: * Cross-Compiler::   Building and installing a cross-compiler.
                     19: * PA Install::    See below for installation on the HP Precision Architecture.
                     20: * Sun Install::   See below for installation on the Sun.
                     21: * 3b1 Install::   See below for installation on the 3b1.
                     22: * Unos Install::  See below for installation on Unos (from CRDS).
                     23: * VMS Install::   See below for installation on VMS.
1.1.1.2 ! root       24: * WE32K Install:: See below for installation on the 3b* aside from the 3b1.
        !            25: * MIPS Install::  See below for installation on the MIPS Architecture.
1.1       root       26: @end menu
                     27: @iftex
                     28: See below for VMS systems, and modified procedures needed on other
                     29: systems including HP, Sun, 3b1, SCO Unix and Unos.  The following section
                     30: says how to compile in a separate directory on Unix; here we assume you
                     31: compile in the same directory that contains the source files.
                     32: @end iftex
                     33: 
                     34: @enumerate
                     35: @item
                     36: If you have built GNU CC previously in the same directory for a
                     37: different target machine, do @samp{make distclean} to delete all files
1.1.1.2 ! root       38: that might be invalid.  One of the files this deletes is
        !            39: @file{Makefile}; if @samp{make distclean} complains that @file{Makefile}
        !            40: does not exist, it probably means that the directory is already suitably
        !            41: clean.
1.1       root       42: 
                     43: @item
                     44: On a System V release 4 system, make sure @file{/usr/bin} precedes
                     45: @file{/usr/ucb} in @code{PATH}.  The @code{cc} command in
                     46: @file{/usr/ucb} uses libraries which have bugs.
                     47: 
                     48: @item
                     49: Specify the host and target machine configurations.  You do this by
                     50: running the file @file{configure} with appropriate arguments.
                     51: 
                     52: If you are building a compiler to produce code for the machine it runs
                     53: on, specify just one machine type.  Use the @samp{--target} option; the
                     54: host type will default to be the same as the target.  (For information
                     55: on building a cross-compiler, see @ref{Cross-Compiler}.)  The command
                     56: looks like this:
                     57: 
                     58: @example
                     59: configure --target=sparc-sun-sunos4.1
                     60: @end example
                     61: 
                     62: A configuration name may be canonical or it may be more or less
                     63: abbreviated.
                     64: 
                     65: A canonical configuration name has three parts, separated by dashes.
                     66: It looks like this: @samp{@var{cpu}-@var{company}-@var{system}}.
                     67: (The three parts may themselves contain dashes; @file{configure}
                     68: can figure out which dashes serve which purpose.)  For example,
                     69: @samp{m68k-sun-sunos4.1} specifies a Sun 3.
                     70: 
                     71: You can also replace parts of the configuration by nicknames or aliases.
                     72: For example, @samp{sun3} stands for @samp{m68k-sun}, so
                     73: @samp{sun3-sunos4.1} is another way to specify a Sun 3.  You can also
                     74: use simply @samp{sun3-sunos}, since the version of SunOS is assumed by
                     75: default to be version 4.  @samp{sun3-bsd} also works, since
                     76: @file{configure} knows that the only BSD variant on a Sun 3 is SunOS.
                     77: 
                     78: You can specify a version number after any of the system types, and some
                     79: of the CPU types.  In most cases, the version is irrelevant, and will be
                     80: ignored.  So you might as well specify the version if you know it.
                     81: 
                     82: Here are the possible CPU types:
                     83: 
                     84: @quotation
1.1.1.2 ! root       85: @c gmicro, alliant, spur and tahoe omitted since they don't work.
        !            86: a29k, alpha, arm, c@var{n}, elxsi, hppa1.0, hppa1.1,
        !            87: i386, i860, i960, m68000, m68k, m88k, mips,
        !            88: ns32k, pyramid, romp, rs6000, sparc, vax, we32k.
1.1       root       89: @end quotation
                     90: 
                     91: Here are the recognized company names.  As you can see, customary
                     92: abbreviations are used rather than the longer official names.
                     93: 
                     94: @quotation
                     95: alliant, altos, apollo, att,
1.1.1.2 ! root       96: cbm, convergent, convex, crds, dec, dg,
1.1       root       97: encore, harris, hp, ibm, mips,
                     98: motorola, ncr, next, ns, omron,
1.1.1.2 ! root       99: sequent, sgi, sony, sun, tti, unicom.
1.1       root      100: @end quotation
                    101: 
                    102: The company name is meaningful only to disambiguate when the rest of
                    103: the information supplied is insufficient.  You can omit it, writing
                    104: just @samp{@var{cpu}-@var{system}}, if it is not needed.  For example,
                    105: @samp{vax-ultrix4.2} is equivalent to @samp{vax-dec-ultrix4.2}.
                    106: 
                    107: Here is a list of system types:
                    108: 
                    109: @quotation
1.1.1.2 ! root      110: aix, aos, bsd, ctix, dgux, dynix,
        !           111: genix, hpux, isc, linux, luna, mach,
        !           112: minix, newsos, osf, osfrose, riscos,
        !           113: sco, sunos, sysv, ultrix, unos, vms.
1.1       root      114: @end quotation
                    115: 
                    116: @noindent
                    117: You can omit the system type; then @file{configure} guesses the
                    118: operating system from the CPU and company.
                    119: 
                    120: You can add a version number to the system type; this may or may not
                    121: make a difference.  For example, you can write @samp{bsd4.3} or
                    122: @samp{bsd4.4} to distinguish versions of BSD.  In practice, the version
                    123: number is most needed for @samp{sysv3} and @samp{sysv4}, which are often
                    124: treated differently.
                    125: 
                    126: If you specify an impossible combination such as @samp{i860-dg-vms},
                    127: then you may get an error message from @file{configure}, or it may
                    128: ignore part of the information and do the best it can with the rest.
                    129: @file{configure} always prints the canonical name for the alternative
                    130: that it used.
                    131: 
                    132: Often a particular model of machine has a name.  Many machine names are
                    133: recognized as aliases for CPU/company combinations.  Thus, the machine
                    134: name @samp{sun3}, mentioned above, is an alias for @samp{m68k-sun}.
                    135: Sometimes we accept a company name as a machine name, when the name is
                    136: popularly used for a particular machine.  Here is a table of the known
                    137: machine names:
                    138: 
                    139: @quotation
                    140: 3300, 3b1, 3b@var{n}, 7300, altos3068, altos,
                    141: apollo68, att-7300, balance,
                    142: convex-c@var{n}, crds, decstation-3100,
                    143: decstation, delta, encore,
                    144: fx2800, gmicro, hp7@var{nn}, hp8@var{nn},
                    145: hp9k2@var{nn}, hp9k3@var{nn}, hp9k7@var{nn},
                    146: hp9k8@var{nn}, iris4d, iris, isi68,
                    147: m3230, magnum, merlin, miniframe,
                    148: mmax, news-3600, news800, news, next,
                    149: pbd, pc532, pmax, ps2, risc-news,
                    150: rtpc, sun2, sun386i, sun386, sun3,
                    151: sun4, symmetry, tower-32, tower.
                    152: @end quotation 
                    153: 
                    154: @noindent
                    155: Remember that a machine name specifies both the cpu type and the company
                    156: name.
                    157: 
1.1.1.2 ! root      158: There are four additional options you can specify independently to 
1.1       root      159: describe variant hardware and software configurations.  These are
1.1.1.2 ! root      160: @samp{--with-gnu-as}, @samp{--with-gnu-ld}, @samp{--with-stabs} and
        !           161: @samp{--nfp}.
1.1       root      162: 
                    163: @table @samp
                    164: @item --with-gnu-as
                    165: On certain systems, you must specify whether you want GNU CC to work
                    166: with the usual compilation tools or with the GNU compilation tools
                    167: (including GAS).  Use the @samp{--with-gnu-as} argument when you run
                    168: @file{configure}, if you want to use the GNU tools.  (Specify
                    169: @samp{--with-gnu-ld} as well, since on these systems GAS works only with
1.1.1.2 ! root      170: the GNU linker.)  The systems where this makes a difference are
1.1       root      171: @samp{i386-@var{anything}-sysv}, @samp{i860-@var{anything}-bsd},
                    172: @samp{m68k-hp-hpux}, @samp{m68k-sony-bsd}, @samp{m68k-altos-sysv},
                    173: @samp{m68000-hp-hpux}, and @samp{m68000-att-sysv}.  On any other system,
                    174: @samp{--with-gnu-as} has no effect.
                    175: 
                    176: @item --with-gnu-ld
                    177: Specify the option @samp{--with-gnu-ld} if you plan to use the GNU
                    178: linker.  This inhibits the installation of @code{collect2}, a program
                    179: which otherwise serves as a front-end for the system's linker on most
                    180: configurations.
                    181: 
1.1.1.2 ! root      182: @item --with-stabs
        !           183: On MIPS based systems, you must specify whether you want GNU CC to
        !           184: create the normal ECOFF debugging format, or to use BSD-style stabs
        !           185: passed through the ECOFF symbol table.  The normal ECOFF debug format
        !           186: cannot fully handle languages other than C.  BSD stabs format can handle
        !           187: other languages, but it only works with the GNU debugger GDB.
        !           188: 
        !           189: Normally, GNU CC uses the ECOFF debugging format by default; if you
        !           190: prefer BSD stabs, specify @samp{--with-stabs} when you configure GNU
        !           191: CC.
        !           192: 
        !           193: No matter which default you choose when you configure GNU CC, the user
        !           194: can use the @samp{-gcoff} and @samp{-gstabs+} options to specify explicitly
        !           195: the debug format for a particular compilation.
        !           196: 
1.1       root      197: @item --nfp
                    198: On certain systems, you must specify whether the machine has a floating
                    199: point unit.  These systems are @samp{m68k-sun-sunos@var{n}} and
                    200: @samp{m68k-isi-bsd}.  On any other system, @samp{--nfp} currently has no
                    201: effect, though perhaps there are other systems where it could usefully
                    202: make a difference.
                    203: @end table
                    204: 
                    205: If you want to install your own homemade configuration files, you can
                    206: use @samp{local} as the company name to access them.  If you use 
                    207: configuration @samp{@var{cpu}-local}, the entire configuration name
                    208: is used to form the configuration file names.
                    209: 
                    210: Thus, if you specify @samp{m68k-local}, then the files used are
                    211: @file{m68k-local.md}, @file{m68k-local.h}, @file{m68k-local.c},
                    212: @file{xm-m68k-local.h}, @file{t-m68k-local}, and @file{x-m68k-local}.
                    213: 
                    214: Here is a list of configurations that have special treatment or special
                    215: things you must know:
                    216: 
                    217: @table @samp
1.1.1.2 ! root      218: @item alpha-*-osf1
        !           219: Systems using processors that implement the DEC Alpha architecture and
        !           220: are running the OSF/1 operating system. (VMS on the Alpha is not
        !           221: currently supported by GNU CC.)  As of this writing, the only Alpha-based
        !           222: product currently available from DEC is the 21064 (EV4) processor chip;
        !           223: no system-level products can be ordered.  This port is provided for
        !           224: those developers who might have early Alpha hardware from DEC or other
        !           225: vendors and run the OSF/1 operating system.  It has not been extensively
        !           226: tested and both the C++ and Objective-C languages may not work, except
        !           227: in a cross-compilation environment.
        !           228: 
        !           229: The @code{ASSEMBLE_FILE_START} macro writes a @code{.verstamp} directive
        !           230: containing the version of the calling sequence.  Currently, we use
        !           231: @samp{9 0}, which we believe will work until the official release by DEC
        !           232: of their system, at which point @samp{3 11} is the correct value.  If
        !           233: you get a mismatch error from the assembler on a @code{.verstamp} line,
        !           234: consult the file @file{/usr/include/stamp.h} for the present value.  GNU
        !           235: C on the Alpha does not support versions of DEC's OSF/1 earlier than
        !           236: BL9; if you are running an older version, we suggest you ask your DEC
        !           237: contact for an update.
        !           238: 
        !           239: Note that since the Alpha is a 64-bit architecture, cross-compilers
        !           240: from 32-bit machines will not generate as efficient code as that
        !           241: generated when the compiler is running on a 64-bit machine because many
        !           242: optimizations that depend on being able to represent a word on the
        !           243: target in an integral value on the host cannot be performed.
        !           244: 
        !           245: @item a29k
        !           246: AMD Am29K-family processors.  These are normally used in embedded
        !           247: applications.  There are no standard Unix configurations.
        !           248: This configuration
        !           249: corresponds to AMD's standard calling sequence and binary interface
        !           250: and is compatible with other 29K tools.  
        !           251: 
        !           252: You may need to make a variant of the file @file{a29k.h} for your
        !           253: particular configuration.
        !           254: 
        !           255: @item a29k-*-bsd
        !           256: AMD Am29050 used in a system running a variant of BSD Unix.
        !           257: 
        !           258: @item elxsi-elxsi-bsd
        !           259: The Elxsi's C compiler has known limitations that prevent it from
        !           260: compiling GNU C.  Please contact @code{mrs@@cygnus.com} for more details.
        !           261: 
1.1       root      262: @ignore
                    263: @item fx80
                    264: Alliant FX/8 computer.  Note that the standard installed C compiler in
                    265: Concentrix 5.0 has a bug which prevent it from compiling GNU CC
                    266: correctly.  You can patch the compiler bug as follows:
                    267: 
                    268: @example
                    269: cp /bin/pcc ./pcc
                    270: adb -w ./pcc - << EOF
                    271: 15f6?w 6610
                    272: EOF
                    273: @end example
                    274: 
                    275: Then you must use the @samp{-ip12} option when compiling GNU CC
                    276: with the patched compiler, as shown here:
                    277: 
                    278: @example
                    279: make CC="./pcc -ip12" CFLAGS=-w
                    280: @end example
                    281: 
                    282: Note also that Alliant's version of DBX does not manage to work with the
                    283: output from GNU CC.
                    284: @end ignore
                    285: 
                    286: @item i386-*-sco
1.1.1.2 ! root      287: Compilation with RCC is recommended.
        !           288: 
        !           289: @item i386-ibm-aix
        !           290: You need a version of GAS that you can get from @code{tranle@@intellicorp.com}.
1.1       root      291: 
                    292: @item i386-sequent
                    293: Go to the Berkeley universe before compiling.  In addition, you probably
                    294: need to create a file named @file{string.h} containing just one line:
                    295: @samp{#include <strings.h>}.
                    296: 
1.1.1.2 ! root      297: @item i386-sun-sunos4
        !           298: You may find that you need another version of GNU CC to begin
        !           299: bootstrapping with, since the current version when built with the
        !           300: system's own compiler seems to get an infinite loop compiling part of
        !           301: @file{libgcc2.c}.  GNU CC version 2 compiled with GNU CC (any version)
        !           302: seems not to have this problem.
        !           303: 
1.1       root      304: @item m68000-att
                    305: AT&T 3b1, a.k.a. 7300 PC.  Special procedures are needed to compile GNU
                    306: CC with this machine's standard C compiler, due to bugs in that
                    307: compiler.  @xref{3b1 Install}.  You can bootstrap it more easily with
                    308: previous versions of GNU CC if you have them.
                    309: 
                    310: @item m68000-hp-bsd
                    311: HP 9000 series 200 running BSD.  Note that the C compiler that comes
                    312: with this system cannot compile GNU CC; contact @code{law@@cs.utah.edu}
                    313: to get binaries of GNU CC for bootstrapping.
                    314: 
                    315: @item m68k-altos
                    316: Altos 3068.  You must use the GNU assembler, linker and debugger, with
                    317: COFF-encapsulation.  Also, you must fix a kernel bug.  Details in the
                    318: file @file{README.ALTOS}.
                    319: 
                    320: @item m68k-hp-hpux
                    321: HP 9000 series 300 or 400 running HP-UX.  HP-UX version 8.0 has a bug in
                    322: the assembler that prevents compilation of GNU CC.  To fix it, get patch
                    323: PHCO_0800 from HP.
                    324: 
                    325: In addition, @samp{--gas} does not currently work with this
                    326: configuration.  Changes in HP-UX have broken the library conversion tool
                    327: and the linker.
                    328: 
                    329: @item m68k-sun
                    330: Sun 3.  We do not provide a configuration file to use the Sun FPA by
                    331: default, because programs that establish signal handlers for floating
                    332: point traps inherently cannot work with the FPA.
                    333: 
                    334: @item m88k-svr3
1.1.1.2 ! root      335: Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference port.
1.1       root      336: These systems tend to use the Green Hills C, revision 1.8.5, as the
                    337: standard C compiler.  There are apparently bugs in this compiler that
                    338: result in object files differences between stage 2 and stage 3.  If this
                    339: happens, make the stage 4 compiler and compare it to the stage 3
                    340: compiler.  If the stage 3 and stage 4 object files are identical, this
                    341: suggests a problem with the standard C compiler.  It is best, however,
                    342: to use an older version of GNU CC for bootstrapping.
                    343: 
                    344: @item m88k-dgux
                    345: Motorola m88k running DG/UX.  To build native or cross compilers on
                    346: DG/UX, you must first change to the 88open BCS software development
                    347: environment.  This is done by issuing this command:
                    348: 
                    349: @example
                    350: eval `sde-target m88kbcs`
                    351: @end example
                    352: 
                    353: @item mips-mips-bsd
                    354: MIPS machines running the MIPS operating system in BSD mode.  It's
                    355: possible that some old versions of the system lack the functions
                    356: @code{memcpy}, @code{memcmp}, and @code{memset}.  If your system lacks
                    357: these, you must remove or undo the definition of
                    358: @code{TARGET_MEM_FUNCTIONS} in @file{mips-bsd.h}.
                    359: 
                    360: @item mips-sony-sysv
                    361: Sony MIPS NEWS.  This works in NEWSOS 5.0.1, but not in 5.0.2 (which
                    362: uses ELF instead of COFF).  Support for 5.0.2 will probably be provided
                    363: soon by volunteers.
                    364: 
                    365: @item ns32k-encore
                    366: Encore ns32000 system.  Encore systems are supported only under BSD.
                    367: 
                    368: @item ns32k-*-genix
                    369: National Semiconductor ns32000 system.  Genix has bugs in @code{alloca}
                    370: and @code{malloc}; you must get the compiled versions of these from GNU
                    371: Emacs.
                    372: 
                    373: @item ns32k-sequent
                    374: Go to the Berkeley universe before compiling.  In addition, you probably
                    375: need to create a file named @file{string.h} containing just one line:
                    376: @samp{#include <strings.h>}.
                    377: 
                    378: @item ns32k-utek
                    379: UTEK ns32000 system (``merlin'').  The C compiler that comes with this
                    380: system cannot compile GNU CC; contact @samp{tektronix!reed!mason} to get
                    381: binaries of GNU CC for bootstrapping.
                    382: 
                    383: @item romp-*-aos
                    384: @itemx romp-*-mach
                    385: The only operating systems supported for the IBM RT PC are AOS and
1.1.1.2 ! root      386: MACH.  GNU CC does not support AIX running on the RT.  We recommend you
        !           387: compile GNU CC with an earlier version of itself; if you compile GNU CC
        !           388: with @code{hc}, the Metaware compiler, it will work, but you will get
        !           389: mismatches between the stage 2 and stage 3 compilers in various files.
        !           390: These errors are minor differences in some floating-point constants and
        !           391: can be safely ignored; the stage 3 compiler is correct.
1.1       root      392: 
                    393: @item rs6000-*-aix
1.1.1.2 ! root      394: @strong{Read the file @file{README.RS6000} for information on how to get
        !           395: a fix for a problem in the IBM assembler that prevents use of GNU CC.}
        !           396: You must either obtain the new assembler or avoid using the @samp{-g}
        !           397: switch.  Note that @file{Makefile.in} uses @samp{-g} by default when
        !           398: compiling @file{libgcc2.c}.
1.1       root      399: 
                    400: @item vax-dec-ultrix
                    401: Don't try compiling with Vax C (@code{vcc}).  It produces incorrect code
                    402: in some cases (for example, when @code{alloca} is used).
                    403: 
                    404: Meanwhile, compiling @file{cp-parse.c} with pcc does not work because of
                    405: an internal table size limitation in that compiler.  To avoid this
                    406: problem, compile just the GNU C compiler first, and use it to recompile 
                    407: building all the languages that you want to run.
                    408: @end table
                    409: 
                    410: Here we spell out what files will be set up by @code{configure}.  Normally
                    411: you need not be concerned with these files.
                    412: 
                    413: @itemize @bullet
                    414: @item
                    415: @ifset INTERNALS
                    416: A symbolic link named @file{config.h} is made to the top-level config
                    417: file for the machine you will run the compiler on (@pxref{Config}).
                    418: This file is responsible for defining information about the host
                    419: machine.  It includes @file{tm.h}.
                    420: @end ifset
                    421: @ifclear INTERNALS
                    422: A symbolic link named @file{config.h} is made to the top-level config
                    423: file for the machine you plan to run the compiler on (@pxref{Config,,The
                    424: Configuration File, gcc.info, Using and Porting GCC}).  This file is
                    425: responsible for defining information about the host machine.  It
                    426: includes @file{tm.h}.
                    427: @end ifclear
                    428: 
                    429: The top-level config file is located in the subdirectory @file{config}.
                    430: Its name is always @file{xm-@var{something}.h}; usually
                    431: @file{xm-@var{machine}.h}, but there are some exceptions.
                    432: 
                    433: If your system does not support symbolic links, you might want to
                    434: set up @file{config.h} to contain a @samp{#include} command which
                    435: refers to the appropriate file.
                    436: 
                    437: @item
                    438: A symbolic link named @file{tconfig.h} is made to the top-level config
                    439: file for your target machine.  This is used for compiling certain
                    440: programs to run on that machine.
                    441: 
                    442: @item
                    443: A symbolic link named @file{tm.h} is made to the machine-description
                    444: macro file for your target machine.  It should be in the subdirectory
                    445: @file{config} and its name is often @file{@var{machine}.h}.
                    446: 
                    447: @item
                    448: A symbolic link named @file{md} will be made to the machine description
                    449: pattern file.  It should be in the @file{config} subdirectory and its
                    450: name should be @file{@var{machine}.md}; but @var{machine} is often not
                    451: the same as the name used in the @file{tm.h} file because the
                    452: @file{md} files are more general.
                    453: 
                    454: @item
                    455: A symbolic link named @file{aux-output.c} will be made to the output
                    456: subroutine file for your machine.  It should be in the @file{config}
                    457: subdirectory and its name should be @file{@var{machine}.c}.
                    458: 
                    459: @item
                    460: The command file @file{configure} also constructs @file{Makefile} by
                    461: adding some text to the template file @file{Makefile.in}.  The
                    462: additional text comes from files in the @file{config} directory, named
                    463: @file{t-@var{target}} and @file{h-@var{host}}.  If these files do not
                    464: exist, it means nothing needs to be added for a given target or host.
                    465: @end itemize
                    466: 
                    467: @cindex Bison parser generator
                    468: @cindex parser generator, Bison
                    469: @item
                    470: Make sure the Bison parser generator is installed.  (This is
                    471: unnecessary if the Bison output files @file{c-parse.c} and
                    472: @file{cexp.c} are more recent than @file{c-parse.y} and @file{cexp.y}
                    473: and you do not plan to change the @samp{.y} files.)
                    474: 
                    475: Bison versions older than Sept 8, 1988 will produce incorrect output
                    476: for @file{c-parse.c}.
                    477: 
                    478: @item
                    479: Build the compiler.  Just type @samp{make LANGUAGES=c} in the compiler
                    480: directory.
                    481: 
                    482: @samp{LANGUAGES=c} specifies that only the C compiler should be
                    483: compiled.  The makefile normally builds compilers for all the supported
                    484: languages; currently, C, C++ and Objective C.  However, C is the only
                    485: language that is sure to work when you build with other non-GNU C
                    486: compilers.  In addition, building anything but C at this stage is a
                    487: waste of time.
                    488: 
                    489: In general, you can specify the languages to build by typing the
                    490: argument @samp{LANGUAGES="@var{list}"}, where @var{list} is one or more
                    491: words from the list @samp{c}, @samp{c++}, and @samp{objective-c}.
                    492: 
                    493: Ignore any warnings you may see about ``statement not reached'' in
                    494: @file{insn-emit.c}; they are normal.  Any other compilation errors may
                    495: represent bugs in the port to your machine or operating system, and
                    496: @ifclear INSTALLONLY
                    497: should be investigated and reported (@pxref{Bugs}).
                    498: @end ifclear
                    499: @ifset INSTALLONLY
                    500: should be investigated and reported.
                    501: @end ifset
                    502: 
                    503: Some commercial compilers fail to compile GNU CC because they have bugs
                    504: or limitations.  For example, the Microsoft compiler is said to run out
                    505: of macro space.  Some Ultrix compilers run out of expression space; then
                    506: you need to break up the statement where the problem happens.
                    507: 
                    508: If you are building with a previous GNU C compiler, do not
                    509: use @samp{CC=gcc} on the make command or by editing the Makefile.
                    510: Instead, use a full pathname to specify the compiler, such as
                    511: @samp{CC=/usr/local/bin/gcc}.  This is because make might execute
                    512: the @file{gcc} in the current directory before all of the
                    513: compiler components have been built.
                    514: 
                    515: @item
                    516: If you are using COFF-encapsulation, you must convert @file{libgcc.a} to
                    517: a GNU-format library at this point.  See the file @file{README.ENCAP}
                    518: in the directory containing the GNU binary file utilities, for
                    519: directions.
                    520: 
                    521: @item
                    522: If you are building a cross-compiler, stop here.  @xref{Cross-Compiler}.
                    523: 
                    524: @cindex stage1
                    525: @item
                    526: Move the first-stage object files and executables into a subdirectory
                    527: with this command:
                    528: 
                    529: @example
                    530: make stage1
                    531: @end example
                    532: 
                    533: The files are moved into a subdirectory named @file{stage1}.
                    534: Once installation is complete, you may wish to delete these files
                    535: with @code{rm -r stage1}.
                    536: 
                    537: @item
                    538: Recompile the compiler with itself, with this command:
                    539: 
                    540: @example
1.1.1.2 ! root      541: make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"
1.1       root      542: @end example
                    543: 
                    544: This is called making the stage 2 compiler.
                    545: 
                    546: The command shown above builds compilers for all the supported
                    547: languages.  If you don't want them all, you can specify the languages to
                    548: build by typing the argument @samp{LANGUAGES="@var{list}"}.  @var{list}
                    549: should contain one or more words from the list @samp{c}, @samp{c++},
                    550: @samp{objective-c}, and @samp{proto}.  Separate the words with spaces.
                    551: @samp{proto} stands for the programs @code{protoize} and
                    552: @code{unprotoize}; they are not a separate language, but you use
                    553: @code{LANGUAGES} to enable or disable their installation.
                    554: 
                    555: If you are going to build the stage 3 compiler, then you might want to
                    556: build only the C language in stage 2.
                    557: 
                    558: Once you have built the stage 2 compiler, if you are short of disk
                    559: space, you can delete the subdirectory @file{stage1}.
                    560: 
                    561: On a 68000 or 68020 system lacking floating point hardware,
                    562: unless you have selected a @file{tm.h} file that expects by default
                    563: that there is no such hardware, do this instead:
                    564: 
                    565: @example
1.1.1.2 ! root      566: make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
1.1       root      567: @end example
                    568: 
                    569: @item
                    570: If you wish to test the compiler by compiling it with itself one more
                    571: time, do this:
                    572: 
                    573: @example
                    574: make stage2
1.1.1.2 ! root      575: make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" 
1.1       root      576: @end example
                    577: 
                    578: @noindent
                    579: This is called making the stage 3 compiler.  Aside from the @samp{-B}
1.1.1.2 ! root      580: option, the compiler options should be the same as when you made the
        !           581: stage 2 compiler.  But the @code{LANGUAGES} option need not be the
        !           582: same.  The command shown above builds compilers for all the supported
        !           583: languages; if you don't want them all, you can specify the languages to
1.1       root      584: build by typing the argument @samp{LANGUAGES="@var{list}"}, as described
                    585: above.
                    586: 
                    587: Then compare the latest object files with the stage 2 object
                    588: files---they ought to be identical, unless they contain time stamps.
                    589: You can compare the files, disregarding the time stamps if any, like
                    590: this:
                    591: 
                    592: @example
                    593: make compare
                    594: @end example
                    595: 
                    596: This will mention any object files that differ between stage 2 and stage
                    597: 3.  Any difference, no matter how innocuous, indicates that the stage 2
                    598: compiler has compiled GNU CC incorrectly, and is therefore a potentially
                    599: @ifclear INSTALLONLY
                    600: serious bug which you should investigate and report (@pxref{Bugs}).
                    601: @end ifclear
                    602: @ifset INSTALLONLY
                    603: serious bug which you should investigate and report.
                    604: @end ifset
                    605: 
                    606: If your system does not put time stamps in the object files, then this
                    607: is a faster way to compare them (using the Bourne shell):
                    608: 
                    609: @example
                    610: for file in *.o; do
                    611: cmp $file stage2/$file
                    612: done
                    613: @end example
                    614: 
                    615: If you have built the compiler with the @samp{-mno-mips-tfile} option on
                    616: MIPS machines, you will not be able to compare the files.
                    617: 
                    618: @item
                    619: Install the compiler driver, the compiler's passes and run-time support.
                    620: You can use the following command:
                    621: 
                    622: @example
1.1.1.2 ! root      623: make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="@var{list}"
1.1       root      624: @end example
                    625: 
                    626: @noindent
                    627: (Use the same value for @code{CC}, @code{CFLAGS} and @code{LANGUAGES}
                    628: that you used when compiling the files that are being installed.  One
                    629: reason this is necessary is that some versions of Make have bugs and
                    630: recompile files gratuitously when you do this step.  If you use the same
                    631: variable values, those files will be recompiled properly.
                    632: 
                    633: This copies the files @file{cc1}, @file{cpp} and @file{libgcc.a} to files
                    634: @file{cc1}, @file{cpp} and @file{libgcc.a} in directory
                    635: @file{/usr/local/lib/gcc-lib/@var{target}/@var{version}}, which is where the
                    636: compiler driver program looks for them.  Here @var{target} is the target
                    637: machine type specified when you ran @file{configure}, and @var{version}
                    638: is the version number of GNU CC.  This naming scheme permits various
                    639: versions and/or cross-compilers to coexist.
                    640: 
                    641: It also copies the driver program @file{gcc} into the directory
                    642: @file{/usr/local/bin}, so that it appears in typical execution search
                    643: paths.@refill
                    644: 
                    645: On some systems, this command will cause recompilation of some files.
                    646: This is usually due to bugs in @code{make}.  You should either ignore
                    647: this problem, or use GNU Make.
                    648: 
                    649: @cindex @code{alloca} and SunOs
                    650: @strong{Warning: there is a bug in @code{alloca} in the Sun library.  To
                    651: avoid this bug, be sure to install the executables of GNU CC that were
                    652: compiled by GNU CC.  (That is, the executables from stage 2 or 3, not
                    653: stage 1.)  They use @code{alloca} as a built-in function and never the
                    654: one in the library.}
                    655: 
                    656: (It is usually better to install GNU CC executables from stage 2 or 3,
                    657: since they usually run faster than the ones compiled with some other
                    658: compiler.)
                    659: 
                    660: @item
1.1.1.2 ! root      661: Install the Objective C library (if you have built the Objective C
        !           662: compiler).  Here is the command to do this:
        !           663: 
        !           664: @example
        !           665: make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
        !           666: @end example
        !           667: 
        !           668: @item
1.1       root      669: Correct errors in the header files on your machine.
                    670: 
                    671: Various system header files often contain constructs which are
1.1.1.2 ! root      672: erroneous, incompatible with ANSI C or otherwise unsuitable, and they
        !           673: will not work when you compile programs with GNU CC.
        !           674: 
        !           675: The most common erroneous construct is found in @file{ioctl.h}, where a
        !           676: macro expects argument values to be substituted for argument names
        !           677: inside of character constants---something not done in ANSI C.  This
        !           678: particular problem can be prevented by using @samp{-traditional}.  Other
        !           679: problems are not so easy to work around.
        !           680: 
        !           681: GNU CC comes with shell scripts to fix known header file problems.  They
        !           682: install corrected copies of various header files in a special directory
        !           683: where only GNU CC will normally look for them.  The scripts adapt to
        !           684: various systems by searching all the system header files for the problem
        !           685: cases that we know about.
1.1       root      686: 
                    687: Use the following command to do this:
                    688: 
                    689: @example
                    690: make install-fixincludes
                    691: @end example
                    692: 
                    693: @noindent
                    694: If you selected a different directory for GNU CC installation when you
                    695: installed it, by specifying the Make variable @code{prefix} or
                    696: @code{libdir}, specify it the same way in this command.
                    697: 
                    698: Note that some systems are starting to come with ANSI C system header
1.1.1.2 ! root      699: files.  On these systems, don't run @code{install-fixincludes}; it may
        !           700: not work, and is certainly not necessary.  One exception: there are is a
        !           701: special script for System V release 4, which you should run.
        !           702: 
        !           703: It is not the purpose of @code{install-fixincludes} to add prototypes to
        !           704: the system header files.  We support headers with ANSI C prototypes in
        !           705: the GNU C Library, and we have no time to support adding them to other
        !           706: systems' header files.
        !           707: 
        !           708: @item
        !           709: If you're going to use C++, it's likely that you need to also install
        !           710: the @code{libg++} distribution.  It should be available from the same
        !           711: place where you got the GCC distribution.  Just as GCC does not
        !           712: distribute a C runtime library, it also does not include a C++ run-time
        !           713: library.  All I/O functionality, special class libraries, etc., are
        !           714: available in the @code{libg++} distribution.
1.1       root      715: @end enumerate
                    716: 
                    717: If you cannot install the compiler's passes and run-time support in
                    718: @file{/usr/local/lib}, you can alternatively use the @samp{-B} option to
                    719: specify a prefix by which they may be found.  The compiler concatenates
                    720: the prefix with the names  @file{cpp}, @file{cc1} and @file{libgcc.a}.
                    721: Thus, you can put the files in a directory @file{/usr/foo/gcc} and
                    722: specify @samp{-B/usr/foo/gcc/} when you run GNU CC.
                    723: 
                    724: Also, you can specify an alternative default directory for these files
                    725: by setting the Make variable @code{libdir} when you make GNU CC.
                    726: 
                    727: @node Other Dir
                    728: @section Compilation in a Separate Directory
                    729: @cindex other directory, compilation in
                    730: @cindex compilation in a separate directory
                    731: @cindex separate directory, compilation in
                    732: 
                    733: If you wish to build the object files and executables in a directory
                    734: other than the one containing the source files, here is what you must
                    735: do differently:
                    736: 
                    737: @enumerate
                    738: @item
                    739: Make sure you have a version of Make that supports the @code{VPATH}
                    740: feature.  (GNU Make supports it, as do Make versions on most BSD
                    741: systems.)
                    742: 
                    743: @item
                    744: If you have ever run @file{configure} in the source directory, you must undo
                    745: the configuration.  Do this by running:
                    746: 
                    747: @example
                    748: make distclean
                    749: @end example
                    750: 
                    751: @item
                    752: Go to the directory in which you want to build the compiler before
                    753: running @file{configure}:
                    754: 
                    755: @example
                    756: mkdir gcc-sun3
                    757: cd gcc-sun3
                    758: @end example
                    759: 
                    760: On systems that do not support symbolic links, this directory must be
                    761: on the same file system as the source code directory.
                    762: 
                    763: @item
                    764: Specify where to find @file{configure} when you run it:
                    765: 
                    766: @example
                    767: ../gcc/configure @dots{}
                    768: @end example
                    769: 
                    770: This also tells @code{configure} where to find the compiler sources;
                    771: @code{configure} takes the directory from the file name that was used to
                    772: invoke it.  But if you want to be sure, you can specify the source
                    773: directory with the @samp{--srcdir} option, like this:
                    774: 
                    775: @example
                    776: ../gcc/configure --srcdir=../gcc sun3
                    777: @end example
                    778: 
                    779: The directory you specify with @samp{--srcdir} need not be the same
                    780: as the one that @code{configure} is found in.
                    781: @end enumerate
                    782: 
                    783: Now, you can run @code{make} in that directory.  You need not repeat the
                    784: configuration steps shown above, when ordinary source files change.  You
                    785: must, however, run @code{configure} again when the configuration files
                    786: change, if your system does not support symbolic links.
                    787: 
                    788: @node Cross-Compiler
                    789: @section Building and Installing a Cross-Compiler
                    790: @cindex cross-compiler, installation
                    791: 
                    792: GNU CC can function as a cross-compiler for many machines, but not all.
                    793: 
                    794: @itemize @bullet
                    795: @item
                    796: Cross-compilers for the Mips as target do not work because the auxiliary
                    797: programs @file{mips-tdump.c} and @file{mips-tfile.c} can't be compiled
                    798: on anything but a Mips.
                    799: 
                    800: @item
                    801: Cross-compilers to or from the Vax probably don't work completely
                    802: because the Vax uses an incompatible floating point format (not IEEE
                    803: format).
                    804: @end itemize
                    805: 
                    806: Since GNU CC generates assembler code, you probably need a
                    807: cross-assembler that GNU CC can run, in order to produce object files.
                    808: If you want to link on other than the target machine, you need a
                    809: cross-linker as well.  You also need header files and libraries suitable
                    810: for the target machine that you can install on the host machine.
                    811: 
                    812: To build GNU CC as a cross-compiler, you start out by running
1.1.1.2 ! root      813: @code{configure}.  You must specify two different configurations, the
1.1       root      814: host and the target.  Use the @samp{--host=@var{host}} option for the
                    815: host and @samp{--target=@var{target}} to specify the target type.  For
                    816: example, here is how to configure for a cross-compiler that runs on a
                    817: hypothetical Intel 386 system and produces code for an HP 68030 system
                    818: running BSD:
                    819: 
                    820: @example
                    821: configure --target=m68k-hp-bsd4.3 --host=i386-bozotheclone-bsd4.3
                    822: @end example
                    823: 
                    824: Next you should install the cross-assembler and cross-linker (and
                    825: @code{ar} and @code{ranlib}).  Put them in the directory
1.1.1.2 ! root      826: @file{/usr/local/@var{target}/bin}.  The installation of GNU CC will find
1.1       root      827: them there and copy or link them to the proper place to find them when
                    828: you run the cross-compiler later.
                    829: 
                    830: If you want to install any additional libraries to use with the
                    831: cross-compiler, put them in the directory
                    832: @file{/usr/local/@var{target}/lib}; all files in that subdirectory will
                    833: be installed in the proper place when you install the cross-compiler.
                    834: Likewise, put the header files for the target machine in
                    835: @file{/usr/local/@var{target}/include}.
                    836: 
1.1.1.2 ! root      837: You must now produce a substitute for @file{libgcc1.a}.  Normally this
        !           838: file is compiled with the ``native compiler'' for the target machine;
        !           839: compiling it with GNU CC does not work.  But compiling it with the host
        !           840: machine's compiler also doesn't work---that produces a file that would
        !           841: run on the host, and you need it to run on the target.
1.1       root      842: 
                    843: We can't give you any automatic way to produce this substitute.  For
                    844: some targets, the subroutines in @file{libgcc1.c} are not actually used.
                    845: You need not provide the ones that won't be used.  The ones that most
                    846: commonly are used are the multiplication, division and remainder
                    847: routines---many RISC machines rely on the library for this.  One way to
                    848: make them work is to define the appropriate @code{perform_@dots{}}
                    849: macros for the subroutines that you need.  If these definitions do not
                    850: use the C arithmetic operators that they are meant to implement, you
1.1.1.2 ! root      851: might be able to compile them with the cross-compiler you are building.
        !           852: To do this, specify @samp{LIBGCC1=libgcc1.a OLDCC=./xgcc} when building
        !           853: the compiler.
        !           854: 
        !           855: Now you can proceed just as for compiling a single-machine compiler
        !           856: through the step of building stage 1.  If you have not provided some
        !           857: sort of @file{libgcc1.a}, then compilation will give up at the point
        !           858: where it needs that file, printing a suitable error message.  If you
        !           859: do provide @file{libgcc1.a}, then building the compiler will automatically
        !           860: compile and link a test program called @file{cross-test}; if you get
        !           861: errors in the linking, it means that not all of the necessary routines
        !           862: in @file{libgcc1.a} are available.
        !           863: 
        !           864: When you are using a cross-compiler configuration, building stage 1
        !           865: does not compile all of GNU CC.  This is because one part of building,
        !           866: the compilation of @file{libgcc2.c}, requires use of the cross-compiler.
        !           867: 
        !           868: However, when you type @samp{make install} to install the bulk of the
        !           869: cross-compiler, that will also compile @file{libgcc2.c} and install the
        !           870: resulting @file{libgcc.a}.
1.1       root      871: 
                    872: Do not try to build stage 2 for a cross-compiler.  It doesn't work to
                    873: rebuild GNU CC as a cross-compiler using the cross-compiler, because
                    874: that would produce a program that runs on the target machine, not on the
                    875: host.  For example, if you compile a 386-to-68030 cross-compiler with
                    876: itself, the result will not be right either for the 386 (because it was
                    877: compiled into 68030 code) or for the 68030 (because it was configured
                    878: for a 386 as the host).  If you want to compile GNU CC into 68030 code,
                    879: whether you compile it on a 68030 or with a cross-compiler on a 386, you
                    880: must specify a 68030 as the host when you configure it.
                    881: 
                    882: @node PA Install
                    883: @section Installing GNU CC on the HP Precision Architecture
                    884: 
                    885: There are two variants of this CPU, called 1.0 and 1.1, which have
                    886: different machine descriptions.  You must use the right one for your
                    887: machine.  All 7@var{nn} machines and 8@var{n}7 machines use 1.1, while
                    888: all other 8@var{nn} machines use 1.0.
                    889: 
                    890: The easiest way to handle this problem is to use @samp{configure
                    891: hp@var{nnn}} or @samp{configure hp@var{nnn}-hpux}, where @var{nnn} is
                    892: the model number of the machine.  Then @file{configure} will figure out
                    893: if the machine is a 1.0 or 1.1.  Use @samp{uname -a} to find out the
                    894: model number of your machine.
                    895: 
                    896: @samp{-g} does not work on HP-UX, since that system uses a peculiar
1.1.1.2 ! root      897: debugging format which GNU CC does not know about.  There are preliminary
        !           898: versions of GAS and GDB for the HP-PA which do work with GNU CC for 
        !           899: debugging.  You can get them by anonymous ftp from @code{jaguar.cs.utah.edu}
        !           900: @samp{dist} subdirectory.  You would need to install GAS in the file
1.1       root      901: 
                    902: @example
                    903: /usr/local/lib/gcc-lib/@var{configuration}/@var{gccversion}/as
                    904: @end example
                    905: 
                    906: @noindent
                    907: where @var{configuration} is the configuration name (perhaps
                    908: @samp{hp@var{nnn}-hpux}) and @var{gccversion} is the GNU CC version
1.1.1.2 ! root      909: number.  Do this @emph{before} starting the build process, otherwise you will
        !           910: get errors from the HPUX assembler while building @file{libgcc2.a}.  The
        !           911: command 
1.1       root      912: 
                    913: @example
1.1.1.2 ! root      914: make install-dir
1.1       root      915: @end example
                    916: 
                    917: @noindent
1.1.1.2 ! root      918: will create the necessary directory hierarchy so you can install GAS before
        !           919: building GCC.
        !           920: 
        !           921: If you obtained GAS before October 6, 1992 it is highly recommended you
        !           922: get a new one to avoid several bugs which have been discovered
        !           923: recently.
        !           924: 
        !           925: To enable debugging, configure GNU CC with the @samp{--gas} option before
        !           926: building.
1.1       root      927: 
                    928: @node Sun Install
                    929: @section Installing GNU CC on the Sun
                    930: @cindex Sun installation
                    931: @cindex installing GNU CC on the Sun
                    932: 
                    933: Make sure the environment variable @code{FLOAT_OPTION} is not set when
                    934: you compile @file{libgcc.a}.  If this option were set to @code{f68881}
                    935: when @file{libgcc.a} is compiled, the resulting code would demand to be
                    936: linked with a special startup file and would not link properly without
                    937: special pains.
                    938: 
                    939: @cindex @code{alloca}, for SunOs
                    940: There is a bug in @code{alloca} in certain versions of the Sun library.
                    941: To avoid this bug, install the binaries of GNU CC that were compiled by
                    942: GNU CC.  They use @code{alloca} as a built-in function and never the one
                    943: in the library.
                    944: 
                    945: Some versions of the Sun compiler crash when compiling GNU CC.  The
                    946: problem is a segmentation fault in cpp.  This problem seems to be due to
                    947: the bulk of data in the environment variables.  You may be able to avoid
                    948: it by using the following command to compile GNU CC with Sun CC:
                    949: 
                    950: @example
                    951: make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
                    952: @end example
                    953: 
                    954: @node 3b1 Install
                    955: @section Installing GNU CC on the 3b1
                    956: @cindex 3b1 installation
                    957: @cindex installing GNU CC on the 3b1
                    958: 
                    959: Installing GNU CC on the 3b1 is difficult if you do not already have
                    960: GNU CC running, due to bugs in the installed C compiler.  However,
                    961: the following procedure might work.  We are unable to test it.
                    962: 
                    963: @enumerate
                    964: @item
                    965: Comment out the @samp{#include "config.h"} line on line 37 of
                    966: @file{cccp.c} and do @samp{make cpp}.  This makes a preliminary version
                    967: of GNU cpp.
                    968: 
                    969: @item
                    970: Save the old @file{/lib/cpp} and copy the preliminary GNU cpp to that
                    971: file name.
                    972: 
                    973: @item
                    974: Undo your change in @file{cccp.c}, or reinstall the original version,
                    975: and do @samp{make cpp} again.
                    976: 
                    977: @item
                    978: Copy this final version of GNU cpp into @file{/lib/cpp}.
                    979: 
                    980: @findex obstack_free
                    981: @item
                    982: Replace every occurrence of @code{obstack_free} in the file
                    983: @file{tree.c} with @code{_obstack_free}.
                    984: 
                    985: @item
                    986: Run @code{make} to get the first-stage GNU CC.
                    987: 
                    988: @item
                    989: Reinstall the original version of @file{/lib/cpp}.
                    990: 
                    991: @item
                    992: Now you can compile GNU CC with itself and install it in the normal
                    993: fashion.
                    994: @end enumerate
                    995: 
                    996: @node Unos Install
                    997: @section Installing GNU CC on Unos
                    998: @cindex Unos installation
                    999: @cindex installing GNU CC on Unos
                   1000: 
                   1001: Use @samp{configure unos} for building on Unos.
                   1002: 
                   1003: The Unos assembler is named @code{casm} instead of @code{as}.  For some
                   1004: strange reason linking @file{/bin/as} to @file{/bin/casm} changes the
                   1005: behavior, and does not work.  So, when installing GNU CC, you should
                   1006: install the following script as @file{as} in the subdirectory where
                   1007: the passes of GCC are installed:
                   1008: 
                   1009: @example
                   1010: #!/bin/sh
                   1011: casm $*
                   1012: @end example
                   1013: 
                   1014: The default Unos library is named @file{libunos.a} instead of
                   1015: @file{libc.a}.  To allow GNU CC to function, either change all
                   1016: references to @samp{-lc} in @file{gcc.c} to @samp{-lunos} or link
                   1017: @file{/lib/libc.a} to @file{/lib/libunos.a}.
                   1018: 
                   1019: @cindex @code{alloca}, for Unos
                   1020: When compiling GNU CC with the standard compiler, to overcome bugs in
                   1021: the support of @code{alloca}, do not use @samp{-O} when making stage 2.
                   1022: Then use the stage 2 compiler with @samp{-O} to make the stage 3
                   1023: compiler.  This compiler will have the same characteristics as the usual
                   1024: stage 2 compiler on other systems.  Use it to make a stage 4 compiler
                   1025: and compare that with stage 3 to verify proper compilation.
                   1026: 
                   1027: (Perhaps simply defining @code{ALLOCA} in @file{x-crds} as described in
                   1028: the comments there will make the above paragraph superfluous.  Please
                   1029: inform us of whether this works.)
                   1030: 
                   1031: Unos uses memory segmentation instead of demand paging, so you will need
                   1032: a lot of memory.  5 Mb is barely enough if no other tasks are running.
                   1033: If linking @file{cc1} fails, try putting the object files into a library
                   1034: and linking from that library.
                   1035: 
1.1.1.2 ! root     1036: @node VMS Install
1.1       root     1037: @section Installing GNU CC on VMS
                   1038: @cindex VMS installation
                   1039: @cindex installing GNU CC on VMS
                   1040: 
                   1041: The VMS version of GNU CC is distributed in a backup saveset containing
                   1042: both source code and precompiled binaries.
                   1043: 
                   1044: To install the @file{gcc} command so you can use the compiler easily, in
                   1045: the same manner as you use the VMS C compiler, you must install the VMS CLD
                   1046: file for GNU CC as follows:
                   1047: 
                   1048: @enumerate
                   1049: @item
                   1050: Define the VMS logical names @samp{GNU_CC} and @samp{GNU_CC_INCLUDE}
                   1051: to point to the directories where the GNU CC executables
1.1.1.2 ! root     1052: (@file{gcc-cpp.exe}, @file{gcc-cc1.exe}, etc.) and the C include files are
        !          1053: kept respectively.  This should be done with the commands:@refill
1.1       root     1054: 
                   1055: @smallexample
                   1056: $ assign /system /translation=concealed -
                   1057:   disk:[gcc.] gnu_cc
                   1058: $ assign /system /translation=concealed -
                   1059:   disk:[gcc.include.] gnu_cc_include
                   1060: @end smallexample
                   1061: 
                   1062: @noindent
                   1063: with the appropriate disk and directory names.  These commands can be
                   1064: placed in your system startup file so they will be executed whenever
                   1065: the machine is rebooted.  You may, if you choose, do this via the
                   1066: @file{GCC_INSTALL.COM} script in the @file{[GCC]} directory.
                   1067: 
                   1068: @item
                   1069: Install the @file{GCC} command with the command line:
                   1070: 
                   1071: @smallexample
                   1072: $ set command /table=sys$common:[syslib]dcltables -
                   1073:   /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
                   1074: $ install replace sys$common:[syslib]dcltables
                   1075: @end smallexample
                   1076: 
                   1077: @item
                   1078: To install the help file, do the following:
                   1079: 
                   1080: @smallexample
1.1.1.2 ! root     1081: $ library/help sys$library:helplib.hlb gcc.hlp
1.1       root     1082: @end smallexample
                   1083: 
                   1084: @noindent
                   1085: Now you can invoke the compiler with a command like @samp{gcc /verbose
                   1086: file.c}, which is equivalent to the command @samp{gcc -v -c file.c} in
                   1087: Unix.
                   1088: @end enumerate
                   1089: 
                   1090: If you wish to use GNU C++ you must first install GNU CC, and then
                   1091: perform the following steps:
                   1092: 
                   1093: @enumerate
                   1094: @item
                   1095: Define the VMS logical name @samp{GNU_GXX_INCLUDE} to point to the
                   1096: directory where the preprocessor will search for the C++ header files.
                   1097: This can be done with the command:@refill
                   1098: 
                   1099: @smallexample
                   1100: $ assign /system /translation=concealed -
                   1101:   disk:[gcc.gxx_include.] gnu_gxx_include
                   1102: @end smallexample
                   1103: 
                   1104: @noindent
                   1105: with the appropriate disk and directory name.  If you are going to be
                   1106: using libg++, this is where the libg++ install procedure will install
                   1107: the libg++ header files.
                   1108: 
                   1109: @item
                   1110: Obtain the file @file{gcc-cc1plus.exe}, and place this in the same
                   1111: directory that @file{gcc-cc1.exe} is kept.
                   1112: 
                   1113: The GNU C++ compiler can be invoked with a command like @samp{gcc /plus
                   1114: /verbose file.cc}, which is equivalent to the command @samp{g++ -v -c
                   1115: file.cc} in Unix.
                   1116: @end enumerate
                   1117: 
                   1118: We try to put corresponding binaries and sources on the VMS distribution
1.1.1.2 ! root     1119: tape.  But sometimes the binaries will be from an older version than the
1.1       root     1120: sources, because we don't always have time to update them.  (Use the
                   1121: @samp{/version} option to determine the version number of the binaries and
                   1122: compare it with the source file @file{version.c} to tell whether this is
                   1123: so.)  In this case, you should use the binaries you get to recompile the
                   1124: sources.  If you must recompile, here is how:
                   1125: 
                   1126: @enumerate
                   1127: @item
1.1.1.2 ! root     1128: Execute the command procedure @file{vmsconfig.com} to copy files
        !          1129: @file{vax-vms.h}, @file{xm-vax-vms.h}, @file{vax.c} and @file{vax.md} to
        !          1130: @file{tm.h}, @file{config.h}, @file{aux-output.c}, and @file{md.}
        !          1131: respectively, and to create files @file{tconfig.h} and
        !          1132: @file{hconfig.h}.  This procedure also creates several linker option
        !          1133: files used by @file{make-cc1.com} and a data file used by
        !          1134: @file{make-l2.com}.@refill
        !          1135: 
        !          1136: @smallexample
        !          1137: $ @@vmsconfig.com
        !          1138: @end smallexample
1.1       root     1139: 
                   1140: @item
                   1141: Setup the logical names and command tables as defined above.  In
                   1142: addition, define the VMS logical name @samp{GNU_BISON} to point at the
                   1143: to the directories where the Bison executable is kept.  This should be
                   1144: done with the command:@refill
                   1145: 
                   1146: @smallexample
                   1147: $ assign /system /translation=concealed -
                   1148:   disk:[bison.] gnu_bison
                   1149: @end smallexample
                   1150: 
                   1151: You may, if you choose, use the @file{INSTALL_BISON.COM} script in the
                   1152: @file{[BISON]} directory.
                   1153: 
                   1154: @item
                   1155: Install the @samp{BISON} command with the command line:@refill
                   1156: 
                   1157: @smallexample
                   1158: $ set command /table=sys$common:[syslib]dcltables -
                   1159:   /output=sys$common:[syslib]dcltables -
                   1160:   gnu_bison:[000000]bison
                   1161: $ install replace sys$common:[syslib]dcltables
                   1162: @end smallexample
                   1163: 
                   1164: @item
                   1165: Type @samp{@@make-gcc} to recompile everything (alternatively, you may
                   1166: submit the file @file{make-gcc.com} to a batch queue).  If you wish to
                   1167: build the GNU C++ compiler as well as the GNU CC compiler, you must
                   1168: first edit @file{make-gcc.com} and follow the instructions that appear
                   1169: in the comments.@refill
                   1170: 
                   1171: @item
                   1172: In order to use GCC, you need a library of functions which GCC compiled code
                   1173: will call to perform certain tasks, and these functions are defined in the
                   1174: file @file{libgcc2.c}.  To compile this you should use the command procedure
                   1175: @file{make-l2.com}, which will generate the library @file{libgcc2.olb}.
                   1176: @file{libgcc2.olb} should be built using the compiler built from
                   1177: the same distribution that @file{libgcc2.c} came from, and
                   1178: @file{make-gcc.com} will automatically do all of this for you.
                   1179: 
                   1180: To install the library, use the following commands:@refill
                   1181: 
                   1182: @smallexample
1.1.1.2 ! root     1183: $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
        !          1184: $ library libgcc2/extract=*/output=libgcc2.obj
        !          1185: $ library gnu_cc:[000000]gcclib libgcc2.obj
1.1       root     1186: @end smallexample
                   1187: 
                   1188: The first command simply removes old modules that will be replaced with modules
                   1189: from libgcc2.  If the VMS librarian complains about those modules not being
                   1190: present, simply ignore the message and continue on with the next command.
                   1191: 
                   1192: Whenever you update the compiler on your system, you should also update the
                   1193: library with the above procedure.
                   1194: 
1.1.1.2 ! root     1195: @item
1.1       root     1196: You may wish to build GCC in such a way that no files are written to the
                   1197: directory where the source files reside.  An example would be the when
                   1198: the source files are on a read-only disk.  In these cases, execute the
                   1199: following DCL commands (substituting your actual path names):
                   1200: 
                   1201: @smallexample
1.1.1.2 ! root     1202: $ assign dua0:[gcc.build_dir.]/translation=concealed, -
        !          1203:          dua1:[gcc.source_dir.]/translation=concealed  gcc_build
1.1       root     1204: $ set default gcc_build:[000000]
                   1205: @end smallexample
                   1206: 
1.1.1.2 ! root     1207: where @file{dua1:[gcc.source_dir]}
        !          1208: contains the source code, and
        !          1209: @file{dua0:[gcc.build_dir]} is meant to contain all of the generated object
1.1       root     1210: files and executables.  Once you have done this, you can proceed building GCC
                   1211: as described above.  (Keep in mind that @file{gcc_build} is a rooted logical
                   1212: name, and thus the device names in each element of the search list must be an
                   1213: actual physical device name rather than another rooted logical name).
                   1214: 
1.1.1.2 ! root     1215: @item
1.1       root     1216: @strong{If you are building GNU CC with a previous version of GNU CC,
                   1217: you also should check to see that you have the newest version of the
                   1218: assembler}.  In particular, GNU CC version 2 treats global constant
                   1219: variables slightly differently from GNU CC version 1, and GAS version
                   1220: 1.38.1 does not have the patches required to work with GCC version 2.
                   1221: If you use GAS 1.38.1, then @code{extern const} variables will not have
                   1222: the read-only bit set, and the linker will generate warning messages
                   1223: about mismatched psect attributes for these variables.  These warning
                   1224: messages are merely a nuisance, and can safely be ignored.
                   1225: 
                   1226: If you are compiling with a version of GNU CC older than 1.33, specify
                   1227: @samp{/DEFINE=("inline=")} as an option in all the compilations.  This
                   1228: requires editing all the @code{gcc} commands in @file{make-cc1.com}.
                   1229: (The older versions had problems supporting @code{inline}.)  Once you
                   1230: have a working 1.33 or newer GNU CC, you can change this file back.
1.1.1.2 ! root     1231: 
        !          1232: @item
        !          1233: If you want to build GNU CC with the VAX C compiler, you will need to
        !          1234: make minor changes in @file{make-cccp.com} and @file{make-cc1.com}
        !          1235: to choose alternate definitions of @code{CC}, @code{CFLAGS}, and
        !          1236: @code{LIBS}.  See comments in those files.  However, you must
        !          1237: also have a working version of the GNU assembler (GNU as, aka GAS) as
        !          1238: it is used as the back-end for GNU CC to produce binary object modules
        !          1239: and is not included in the GNU CC sources.  GAS is also needed to
        !          1240: compile @file{libgcc2} in order to build @file{gcclib} (see above);
        !          1241: @file{make-l2.com} expects to be able to find it operational in
        !          1242: @file{gnu_cc:[000000]gnu-as.exe}.
        !          1243: 
        !          1244: To use GNU CC on VMS, you need the VMS driver programs
        !          1245: @file{gcc.exe}, @file{gcc.com}, and @file{gcc.cld}.  They are
        !          1246: distributed with the VMS binaries (@file{gcc-vms}) rather than the
        !          1247: GNU CC sources.  GAS is also included in @file{gcc-vms}, as is Bison.
        !          1248: 
        !          1249: Once you have successfully built GNU CC with VAX C, you should use the
        !          1250: resulting compiler to rebuild itself.  Before doing this, be sure to
        !          1251: restore the @code{CC}, @code{CFLAGS}, and @code{LIBS} definitions in
        !          1252: @file{make-cccp.com} and @file{make-cc1.com}.  The second generation
        !          1253: compiler will be able to take advantage of many optimizations that must
        !          1254: be suppressed when building with other compilers.
1.1       root     1255: @end enumerate
                   1256: 
                   1257: Under previous versions of GNU CC, the generated code would occasionally
1.1.1.2 ! root     1258: give strange results when linked with the sharable @file{VAXCRTL} library.
1.1       root     1259: Now this should work.
                   1260: 
1.1.1.2 ! root     1261: Even with this version, however, GNU CC itself should not be linked with
        !          1262: the sharable @file{VAXCRTL}.  The version of @code{qsort} in
        !          1263: @file{VAXCRTL} has a bug (known to be present in VMS versions V4.6
        !          1264: through V5.5) which causes the compiler to fail.
1.1       root     1265: 
                   1266: The executables that are generated by @file{make-cc1.com} and
1.1.1.2 ! root     1267: @file{make-cccp.com} use the object library version of @file{VAXCRTL} in
        !          1268: order to make use of the @code{qsort} routine in @file{gcclib.olb}.  If
        !          1269: you wish to link the compiler executables with the shareable image
        !          1270: version of @file{VAXCRTL}, you should edit the file @file{tm.h} (created
        !          1271: by @file{vmsconfig.com}) to define the macro @code{QSORT_WORKAROUND}.
        !          1272: 
        !          1273: @code{QSORT_WORKAROUND} is always defined when GNU CC is compiled with
        !          1274: VAX C, to avoid a problem in case @file{gcclib.olb} is not yet
        !          1275: available.
        !          1276: 
        !          1277: 
        !          1278: @node WE32K Install
        !          1279: @section Installing GNU CC on the WE32K
        !          1280: 
        !          1281: These computers are also known as the 3b2, 3b5, 3b20 and other similar
        !          1282: names.  (However, the 3b1 is actually a 68000; see @ref{3b1 Install}.)
        !          1283: 
        !          1284: Don't use @samp{-g} when compiling with the system's compiler.  The
        !          1285: system's linker seems to be unable to handle such a large program with
        !          1286: debugging information.
        !          1287: 
        !          1288: The system's compiler runs out of capacity when compiling @file{stmt.c}
        !          1289: in GNU CC.  You can work around this by building @file{cpp} in GNU CC
        !          1290: first, then use that instead of the system's preprocessor with the
        !          1291: system's C compiler to compile @file{stmt.c}.  Here is how:
        !          1292: 
        !          1293: @example
        !          1294: mv /lib/cpp /lib/cpp.att
        !          1295: cp cpp /lib/cpp.gnu
        !          1296: echo "/lib/cpp.gnu -traditional $*" > /lib/cpp
        !          1297: chmod +x /lib/cpp
        !          1298: @end example
        !          1299: 
        !          1300: The system's compiler produces bad code for some of the GNU CC
        !          1301: optimization files.  So you must build the stage 2 compiler without
        !          1302: optimization.  Then build a stage 3 compiler with optimization.
        !          1303: That executable should work.  Here are the necessary commands:
        !          1304: 
        !          1305: @example
        !          1306: make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g"
        !          1307: make stage2
        !          1308: make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O"
        !          1309: @end example
        !          1310: 
        !          1311: You may need to raise the ULIMIT setting to build a C++ compiler,
        !          1312: as the file @file{cc1plus} is larger than one megabyte.
        !          1313: 
        !          1314: 
        !          1315: @node MIPS Install
        !          1316: @section Installing GNU CC on the MIPS
        !          1317: See @ref{Installation} about whether to use @samp{--with-stabs} or
        !          1318: not.
        !          1319: 
        !          1320: The MIPS C compiler needs to be told to increase its table size
        !          1321: for switch statements with the @samp{-Wf,-XNg1500} option in
        !          1322: order to compile @file{cp-parse.c}.  If you use the @samp{-O2}
        !          1323: optimization option, you also need to use @samp{-Olimit 3000}.
        !          1324: Both of these options are automatically generated in the
        !          1325: @file{Makefile} that the shell script @file{configure} builds.
        !          1326: If you override the @code{CC} make variable and use the MIPS
        !          1327: compilers, you may need to add @samp{-Wf,-XNg1500 -Olimit 3000}.
        !          1328: 
        !          1329: MIPS computers running RISC-OS can support four different
        !          1330: personalities: default, BSD 4.3, System V.3, and System V.4
        !          1331: (older versions of RISC-OS don't support V.4).  To configure GCC
        !          1332: for these platforms use the following configurations:
        !          1333: 
        !          1334: @table @samp
        !          1335: @item mips-mips-riscos@code{rev}
        !          1336: Default configuration for RISC-OS, revision @code{rev}.
        !          1337: 
        !          1338: @item mips-mips-riscos@code{rev}bsd
        !          1339: BSD 4.3 configuration for RISC-OS, revision @code{rev}.
        !          1340: 
        !          1341: @item mips-mips-riscos@code{rev}sysv4
        !          1342: System V.4 configuration for RISC-OS, revision @code{rev}.
        !          1343: 
        !          1344: @item mips-mips-riscos@code{rev}sysv
        !          1345: System V.3 configuration for RISC-OS, revision @code{rev}.
        !          1346: @end table
        !          1347: 
        !          1348: The revision @code{rev} mentioned above is the revision of
        !          1349: RISC-OS to use.  You must reconfigure GCC when going from a
        !          1350: RISC-OS revision 4 to RISC-OS revision 5.  This has the effect of
        !          1351: avoiding a linker
        !          1352: @ifclear INSTALLONLY
        !          1353: bug (see @ref{Installation Problems} for more details).
        !          1354: @end ifclear
        !          1355: @ifset INSTALLONLY
        !          1356: bug.
        !          1357: @end ifset
        !          1358: 
        !          1359: DECstations can support three different personalities: Ultrix,
        !          1360: DEC OSF/1, and OSF/rose.  To configure GCC for these platforms
        !          1361: use the following configurations:
        !          1362: 
        !          1363: @table @samp
        !          1364: @item decstation-ultrix
        !          1365: Ultrix configuration.
        !          1366: 
        !          1367: @item decstation-osf1
        !          1368: Dec's version of OSF/1.
        !          1369: 
        !          1370: @item decstation-osfrose
        !          1371: Open Software Foundation reference port of OSF/1 which uses the
        !          1372: OSF/rose object file format instead of ECOFF.  Normally, you
        !          1373: would not select this configuration.
        !          1374: @end table

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.