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