|
|
1.1.1.7 ! root 1: This is Info file gcc.info, produced by Makeinfo-1.55 from the input 1.1 root 2: file gcc.texi. 3: 4: This file documents the use and the internals of the GNU compiler. 5: 1.1.1.5 root 6: Published by the Free Software Foundation 675 Massachusetts Avenue 7: Cambridge, MA 02139 USA 8: 1.1.1.7 ! root 9: Copyright (C) 1988, 1989, 1992, 1993, 1994 Free Software Foundation, ! 10: Inc. 1.1 root 11: 1.1.1.3 root 12: Permission is granted to make and distribute verbatim copies of this 13: manual provided the copyright notice and this permission notice are 14: preserved on all copies. 1.1 root 15: 16: Permission is granted to copy and distribute modified versions of 17: this manual under the conditions for verbatim copying, provided also 1.1.1.7 ! root 18: that the sections entitled "GNU General Public License," "Funding for ! 19: Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are ! 20: included exactly as in the original, and provided that the entire ! 21: resulting derived work is distributed under the terms of a permission ! 22: notice identical to this one. 1.1 root 23: 24: Permission is granted to copy and distribute translations of this 25: manual into another language, under the above conditions for modified 1.1.1.3 root 26: versions, except that the sections entitled "GNU General Public 1.1.1.7 ! root 27: License," "Funding for Free Software," and "Protect Your Freedom--Fight ! 28: `Look And Feel'", and this permission notice, may be included in ! 29: translations approved by the Free Software Foundation instead of in the ! 30: original English. ! 31: ! 32: ! 33: File: gcc.info, Node: Environment Variables, Next: Running Protoize, Prev: Code Gen Options, Up: Invoking GCC ! 34: ! 35: Environment Variables Affecting GNU CC ! 36: ====================================== ! 37: ! 38: This section describes several environment variables that affect how ! 39: GNU CC operates. They work by specifying directories or prefixes to use ! 40: when searching for various kinds of files. ! 41: ! 42: Note that you can also specify places to search using options such as ! 43: `-B', `-I' and `-L' (*note Directory Options::.). These take ! 44: precedence over places specified using environment variables, which in ! 45: turn take precedence over those specified by the configuration of GNU ! 46: CC. *Note Driver::. ! 47: ! 48: `TMPDIR' ! 49: If `TMPDIR' is set, it specifies the directory to use for temporary ! 50: files. GNU CC uses temporary files to hold the output of one ! 51: stage of compilation which is to be used as input to the next ! 52: stage: for example, the output of the preprocessor, which is the ! 53: input to the compiler proper. ! 54: ! 55: `GCC_EXEC_PREFIX' ! 56: If `GCC_EXEC_PREFIX' is set, it specifies a prefix to use in the ! 57: names of the subprograms executed by the compiler. No slash is ! 58: added when this prefix is combined with the name of a subprogram, ! 59: but you can specify a prefix that ends with a slash if you wish. ! 60: ! 61: If GNU CC cannot find the subprogram using the specified prefix, it ! 62: tries looking in the usual places for the subprogram. ! 63: ! 64: The default value of `GCC_EXEC_PREFIX' is ! 65: `PREFIX/lib/gcc-lib/MACHINE/VERSION/' where PREFIX is the value of ! 66: `prefix' when you ran the `configure' script and MACHINE and ! 67: VERSION are the configuration name and version number of GNU CC, ! 68: respectively. ! 69: ! 70: Other prefixes specified with `-B' take precedence over this ! 71: prefix. ! 72: ! 73: This prefix is also used for finding files such as `crt0.o' that ! 74: are used for linking. ! 75: ! 76: In addition, the prefix is used in an unusual way in finding the ! 77: directories to search for header files. For each of the standard ! 78: directories whose name normally begins with ! 79: `/usr/local/lib/gcc-lib' (more precisely, with the value of ! 80: `GCC_INCLUDE_DIR'), GNU CC tries replacing that beginning with the ! 81: specified prefix to produce an alternate directory name. Thus, ! 82: with `-Bfoo/', GNU CC will search `foo/bar' where it would ! 83: normally search `/usr/local/lib/bar'. These alternate directories ! 84: are searched first; the standard directories come next. ! 85: ! 86: `COMPILER_PATH' ! 87: The value of `COMPILER_PATH' is a colon-separated list of ! 88: directories, much like `PATH'. GNU CC tries the directories thus ! 89: specified when searching for subprograms, if it can't find the ! 90: subprograms using `GCC_EXEC_PREFIX'. ! 91: ! 92: `LIBRARY_PATH' ! 93: The value of `LIBRARY_PATH' is a colon-separated list of ! 94: directories, much like `PATH'. GNU CC tries the directories thus ! 95: specified when searching for special linker files, if it can't ! 96: find them using `GCC_EXEC_PREFIX'. Linking using GNU CC also uses ! 97: these directories when searching for ordinary libraries for the ! 98: `-l' option (but directories specified with `-L' come first). ! 99: ! 100: `C_INCLUDE_PATH' ! 101: `CPLUS_INCLUDE_PATH' ! 102: `OBJC_INCLUDE_PATH' ! 103: These environment variables pertain to particular languages. Each ! 104: variable's value is a colon-separated list of directories, much ! 105: like `PATH'. When GNU CC searches for header files, it tries the ! 106: directories listed in the variable for the language you are using, ! 107: after the directories specified with `-I' but before the standard ! 108: header file directories. ! 109: ! 110: `DEPENDENCIES_OUTPUT' ! 111: If this variable is set, its value specifies how to output ! 112: dependencies for Make based on the header files processed by the ! 113: compiler. This output looks much like the output from the `-M' ! 114: option (*note Preprocessor Options::.), but it goes to a separate ! 115: file, and is in addition to the usual results of compilation. ! 116: ! 117: The value of `DEPENDENCIES_OUTPUT' can be just a file name, in ! 118: which case the Make rules are written to that file, guessing the ! 119: target name from the source file name. Or the value can have the ! 120: form `FILE TARGET', in which case the rules are written to file ! 121: FILE using TARGET as the target name. ! 122: ! 123: ! 124: File: gcc.info, Node: Running Protoize, Prev: Environment Variables, Up: Invoking GCC ! 125: ! 126: Running Protoize ! 127: ================ ! 128: ! 129: The program `protoize' is an optional part of GNU C. You can use it ! 130: to add prototypes to a program, thus converting the program to ANSI C ! 131: in one respect. The companion program `unprotoize' does the reverse: ! 132: it removes argument types from any prototypes that are found. ! 133: ! 134: When you run these programs, you must specify a set of source files ! 135: as command line arguments. The conversion programs start out by ! 136: compiling these files to see what functions they define. The ! 137: information gathered about a file FOO is saved in a file named `FOO.X'. ! 138: ! 139: After scanning comes actual conversion. The specified files are all ! 140: eligible to be converted; any files they include (whether sources or ! 141: just headers) are eligible as well. ! 142: ! 143: But not all the eligible files are converted. By default, ! 144: `protoize' and `unprotoize' convert only source and header files in the ! 145: current directory. You can specify additional directories whose files ! 146: should be converted with the `-d DIRECTORY' option. You can also ! 147: specify particular files to exclude with the `-x FILE' option. A file ! 148: is converted if it is eligible, its directory name matches one of the ! 149: specified directory names, and its name within the directory has not ! 150: been excluded. ! 151: ! 152: Basic conversion with `protoize' consists of rewriting most function ! 153: definitions and function declarations to specify the types of the ! 154: arguments. The only ones not rewritten are those for varargs functions. ! 155: ! 156: `protoize' optionally inserts prototype declarations at the ! 157: beginning of the source file, to make them available for any calls that ! 158: precede the function's definition. Or it can insert prototype ! 159: declarations with block scope in the blocks where undeclared functions ! 160: are called. ! 161: ! 162: Basic conversion with `unprotoize' consists of rewriting most ! 163: function declarations to remove any argument types, and rewriting ! 164: function definitions to the old-style pre-ANSI form. ! 165: ! 166: Both conversion programs print a warning for any function ! 167: declaration or definition that they can't convert. You can suppress ! 168: these warnings with `-q'. ! 169: ! 170: The output from `protoize' or `unprotoize' replaces the original ! 171: source file. The original file is renamed to a name ending with ! 172: `.save'. If the `.save' file already exists, then the source file is ! 173: simply discarded. ! 174: ! 175: `protoize' and `unprotoize' both depend on GNU CC itself to scan the ! 176: program and collect information about the functions it uses. So ! 177: neither of these programs will work until GNU CC is installed. ! 178: ! 179: Here is a table of the options you can use with `protoize' and ! 180: `unprotoize'. Each option works with both programs unless otherwise ! 181: stated. ! 182: ! 183: `-B DIRECTORY' ! 184: Look for the file `SYSCALLS.c.X' in DIRECTORY, instead of the ! 185: usual directory (normally `/usr/local/lib'). This file contains ! 186: prototype information about standard system functions. This option ! 187: applies only to `protoize'. ! 188: ! 189: `-c COMPILATION-OPTIONS' ! 190: Use COMPILATION-OPTIONS as the options when running `gcc' to ! 191: produce the `.X' files. The special option `-aux-info' is always ! 192: passed in addition, to tell `gcc' to write a `.X' file. ! 193: ! 194: Note that the compilation options must be given as a single ! 195: argument to `protoize' or `unprotoize'. If you want to specify ! 196: several `gcc' options, you must quote the entire set of ! 197: compilation options to make them a single word in the shell. ! 198: ! 199: There are certain `gcc' arguments that you cannot use, because they ! 200: would produce the wrong kind of output. These include `-g', `-O', ! 201: `-c', `-S', and `-o' If you include these in the ! 202: COMPILATION-OPTIONS, they are ignored. ! 203: ! 204: `-C' ! 205: Rename files to end in `.C' instead of `.c'. This is convenient ! 206: if you are converting a C program to C++. This option applies ! 207: only to `protoize'. ! 208: ! 209: `-g' ! 210: Add explicit global declarations. This means inserting explicit ! 211: declarations at the beginning of each source file for each function ! 212: that is called in the file and was not declared. These ! 213: declarations precede the first function definition that contains a ! 214: call to an undeclared function. This option applies only to ! 215: `protoize'. ! 216: ! 217: `-i STRING' ! 218: Indent old-style parameter declarations with the string STRING. ! 219: This option applies only to `protoize'. ! 220: ! 221: `unprotoize' converts prototyped function definitions to old-style ! 222: function definitions, where the arguments are declared between the ! 223: argument list and the initial `{'. By default, `unprotoize' uses ! 224: five spaces as the indentation. If you want to indent with just ! 225: one space instead, use `-i " "'. ! 226: ! 227: `-k' ! 228: Keep the `.X' files. Normally, they are deleted after conversion ! 229: is finished. ! 230: ! 231: `-l' ! 232: Add explicit local declarations. `protoize' with `-l' inserts a ! 233: prototype declaration for each function in each block which calls ! 234: the function without any declaration. This option applies only to ! 235: `protoize'. ! 236: ! 237: `-n' ! 238: Make no real changes. This mode just prints information about the ! 239: conversions that would have been done without `-n'. ! 240: ! 241: `-N' ! 242: Make no `.save' files. The original files are simply deleted. ! 243: Use this option with caution. ! 244: ! 245: `-p PROGRAM' ! 246: Use the program PROGRAM as the compiler. Normally, the name `gcc' ! 247: is used. ! 248: ! 249: `-q' ! 250: Work quietly. Most warnings are suppressed. ! 251: ! 252: `-v' ! 253: Print the version number, just like `-v' for `gcc'. ! 254: ! 255: If you need special compiler options to compile one of your program's ! 256: source files, then you should generate that file's `.X' file specially, ! 257: by running `gcc' on that source file with the appropriate options and ! 258: the option `-aux-info'. Then run `protoize' on the entire set of ! 259: files. `protoize' will use the existing `.X' file because it is newer ! 260: than the source file. For example: ! 261: ! 262: gcc -Dfoo=bar file1.c -aux-info ! 263: protoize *.c ! 264: ! 265: You need to include the special files along with the rest in the ! 266: `protoize' command, even though their `.X' files already exist, because ! 267: otherwise they won't get converted. ! 268: ! 269: *Note Protoize Caveats::, for more information on how to use ! 270: `protoize' successfully. 1.1 root 271: 272: 1.1.1.5 root 273: File: gcc.info, Node: Installation, Next: C Extensions, Prev: Invoking GCC, Up: Top 1.1.1.4 root 274: 1.1.1.5 root 275: Installing GNU CC 276: ***************** 1.1.1.4 root 277: 278: * Menu: 279: 1.1.1.7 ! root 280: * Configurations:: Configurations Supported by GNU CC. 1.1.1.5 root 281: * Other Dir:: Compiling in a separate directory (not where the source is). 282: * Cross-Compiler:: Building and installing a cross-compiler. 283: * Sun Install:: See below for installation on the Sun. 284: * VMS Install:: See below for installation on VMS. 285: * Collect2:: How `collect2' works; how it finds `ld'. 1.1.1.6 root 286: * Header Dirs:: Understanding the standard header file directories. 287: 1.1.1.7 ! root 288: Here is the procedure for installing GNU CC on a Unix system. See ! 289: *Note VMS Install::, for VMS systems. In this section we assume you ! 290: compile in the same directory that contains the source files; see *Note ! 291: Other Dir::, to find out how to compile in a separate directory on Unix ! 292: systems. ! 293: 1.1.1.6 root 294: You cannot install GNU C by itself on MSDOS; it will not compile 295: under any MSDOS compiler except itself. You need to get the complete 296: compilation package DJGPP, which includes binaries as well as sources, 297: and includes all the necessary compilation tools and libraries. 1.1.1.5 root 298: 299: 1. If you have built GNU CC previously in the same directory for a 300: different target machine, do `make distclean' to delete all files 301: that might be invalid. One of the files this deletes is 302: `Makefile'; if `make distclean' complains that `Makefile' does not 303: exist, it probably means that the directory is already suitably 304: clean. 305: 306: 2. On a System V release 4 system, make sure `/usr/bin' precedes 307: `/usr/ucb' in `PATH'. The `cc' command in `/usr/ucb' uses 308: libraries which have bugs. 309: 1.1.1.7 ! root 310: 3. Specify the host, build and target machine configurations. You do ! 311: this by running the file `configure'. ! 312: ! 313: The "build" machine is the system which you are using, the "host" ! 314: machine is the system where you want to run the resulting compiler ! 315: (normally the build machine), and the "target" machine is the ! 316: system for which you want the compiler to generate code. 1.1.1.5 root 317: 318: If you are building a compiler to produce code for the machine it 1.1.1.7 ! root 319: runs on (a native compiler), you normally do not need to specify ! 320: any operands to `configure'; it will try to guess the type of ! 321: machine you are on and use that as the build, host and target ! 322: machines. So you don't need to specify a configuration when ! 323: building a native compiler unless `configure' cannot figure out ! 324: what your configuration is or guesses wrong. ! 325: ! 326: In those cases, specify the build machine's "configuration name" ! 327: with the `--build' option; the host and target will default to be ! 328: the same as the build machine. (If you are building a ! 329: cross-compiler, see *Note Cross-Compiler::.) ! 330: ! 331: Here is an example: ! 332: ! 333: ./configure --build=sparc-sun-sunos4.1 1.1.1.6 root 334: 1.1.1.5 root 335: A configuration name may be canonical or it may be more or less 336: abbreviated. 337: 338: A canonical configuration name has three parts, separated by 339: dashes. It looks like this: `CPU-COMPANY-SYSTEM'. (The three 340: parts may themselves contain dashes; `configure' can figure out 341: which dashes serve which purpose.) For example, 342: `m68k-sun-sunos4.1' specifies a Sun 3. 343: 344: You can also replace parts of the configuration by nicknames or 345: aliases. For example, `sun3' stands for `m68k-sun', so 346: `sun3-sunos4.1' is another way to specify a Sun 3. You can also 347: use simply `sun3-sunos', since the version of SunOS is assumed by 348: default to be version 4. `sun3-bsd' also works, since `configure' 349: knows that the only BSD variant on a Sun 3 is SunOS. 350: 351: You can specify a version number after any of the system types, 352: and some of the CPU types. In most cases, the version is 353: irrelevant, and will be ignored. So you might as well specify the 354: version if you know it. 355: 1.1.1.7 ! root 356: See *Note Configurations::, for a list of supported configuration ! 357: names and notes on many of the configurations. You should check ! 358: the notes in that section before proceding any further with the ! 359: installation of GNU CC. 1.1.1.5 root 360: 361: There are four additional options you can specify independently to 362: describe variant hardware and software configurations. These are 363: `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'. 364: 365: `--with-gnu-as' 366: If you will use GNU CC with the GNU assembler (GAS), you 367: should declare this by using the `--with-gnu-as' option when 368: you run `configure'. 369: 370: Using this option does not install GAS. It only modifies the 371: output of GNU CC to work with GAS. Building and installing 372: GAS is up to you. 373: 1.1.1.6 root 374: Conversely, if you *do not* wish to use GAS and do not specify 375: `--with-gnu-as' when building GNU CC, it is up to you to make 376: sure that GAS is not installed. GNU CC searches for a 377: program named `as' in various directories; if the program it 378: finds is GAS, then it runs GAS. If you are not sure where 379: GNU CC finds the assembler it is using, try specifying `-v' 380: when you run it. 1.1.1.5 root 381: 1.1.1.6 root 382: The systems where it makes a difference whether you use GAS 383: are 384: `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv', 385: `i386-ANY-isc', 386: `i860-ANY-bsd', `m68k-bull-sysv', `m68k-hp-hpux', 387: `m68k-sony-bsd', 388: `m68k-altos-sysv', `m68000-hp-hpux', `m68000-att-sysv', and 389: `mips-ANY'). On any other system, `--with-gnu-as' has no 390: effect. 391: 1.1.1.7 ! root 392: On the systems listed above (except for the HP-PA, for ISC on ! 393: the 386, and for `mips-sgi-irix5.*'), if you use GAS, you ! 394: should also use the GNU linker (and specify `--with-gnu-ld'). 1.1.1.5 root 395: 396: `--with-gnu-ld' 397: Specify the option `--with-gnu-ld' if you plan to use the GNU 398: linker with GNU CC. 399: 400: This option does not cause the GNU linker to be installed; it 401: just modifies the behavior of GNU CC to work with the GNU 402: linker. Specifically, it inhibits the installation of 403: `collect2', a program which otherwise serves as a front-end 404: for the system's linker on most configurations. 405: 406: `--with-stabs' 1.1.1.6 root 407: On MIPS based systems and on Alphas, you must specify whether 408: you want GNU CC to create the normal ECOFF debugging format, 409: or to use BSD-style stabs passed through the ECOFF symbol 410: table. The normal ECOFF debug format cannot fully handle 411: languages other than C. BSD stabs format can handle other 412: languages, but it only works with the GNU debugger GDB. 1.1.1.5 root 413: 414: Normally, GNU CC uses the ECOFF debugging format by default; 415: if you prefer BSD stabs, specify `--with-stabs' when you 416: configure GNU CC. 417: 418: No matter which default you choose when you configure GNU CC, 419: the user can use the `-gcoff' and `-gstabs+' options to 420: specify explicitly the debug format for a particular 421: compilation. 422: 1.1.1.6 root 423: `--with-stabs' is meaningful on the ISC system on the 386, 424: also, if `--with-gas' is used. It selects use of stabs 425: debugging information embedded in COFF output. This kind of 426: debugging information supports C++ well; ordinary COFF 427: debugging information does not. 428: 1.1.1.7 ! root 429: `--with-stabs' is also meaningful on 386 systems running ! 430: SVR4. It selects use of stabs debugging information embedded ! 431: in ELF output. The C++ compiler currently (2.6.0) does not ! 432: support the DWARF debugging information normally used on 386 ! 433: SVR4 platforms; stabs provide a workable alternative. This ! 434: requires gas and gdb, as the normal SVR4 tools can not ! 435: generate or interpret stabs. ! 436: 1.1.1.5 root 437: `--nfp' 438: On certain systems, you must specify whether the machine has 439: a floating point unit. These systems include 440: `m68k-sun-sunosN' and `m68k-isi-bsd'. On any other system, 441: `--nfp' currently has no effect, though perhaps there are 442: other systems where it could usefully make a difference. 443: 1.1.1.7 ! root 444: The `configure' script searches subdirectories of the source ! 445: directory for other compilers that are to be integrated into GNU ! 446: CC. The GNU compiler for C++, called G++ is in a subdirectory ! 447: named `cp'. `configure' inserts rules into `Makefile' to build ! 448: all of those compilers. 1.1.1.5 root 449: 450: Here we spell out what files will be set up by `configure'. 451: Normally you need not be concerned with these files. 452: 453: * A symbolic link named `config.h' is made to the top-level 454: config file for the machine you will run the compiler on 455: (*note Config::.). This file is responsible for defining 456: information about the host machine. It includes `tm.h'. 457: 458: The top-level config file is located in the subdirectory 459: `config'. Its name is always `xm-SOMETHING.h'; usually 460: `xm-MACHINE.h', but there are some exceptions. 461: 462: If your system does not support symbolic links, you might 463: want to set up `config.h' to contain a `#include' command 464: which refers to the appropriate file. 465: 466: * A symbolic link named `tconfig.h' is made to the top-level 467: config file for your target machine. This is used for 468: compiling certain programs to run on that machine. 469: 470: * A symbolic link named `tm.h' is made to the 471: machine-description macro file for your target machine. It 472: should be in the subdirectory `config' and its name is often 473: `MACHINE.h'. 474: 475: * A symbolic link named `md' will be made to the machine 476: description pattern file. It should be in the `config' 477: subdirectory and its name should be `MACHINE.md'; but MACHINE 478: is often not the same as the name used in the `tm.h' file 479: because the `md' files are more general. 480: 481: * A symbolic link named `aux-output.c' will be made to the 482: output subroutine file for your machine. It should be in the 483: `config' subdirectory and its name should be `MACHINE.c'. 484: 485: * The command file `configure' also constructs the file 486: `Makefile' by adding some text to the template file 487: `Makefile.in'. The additional text comes from files in the 488: `config' directory, named `t-TARGET' and `x-HOST'. If these 489: files do not exist, it means nothing needs to be added for a 490: given target or host. 491: 492: 4. The standard directory for installing GNU CC is `/usr/local/lib'. 493: If you want to install its files somewhere else, specify 494: `--prefix=DIR' when you run `configure'. Here DIR is a directory 495: name to use instead of `/usr/local' for all purposes with one 496: exception: the directory `/usr/local/include' is searched for 1.1.1.7 ! root 497: header files no matter where you install the compiler. To override ! 498: this name, use the `--local-prefix' option below. 1.1.1.5 root 499: 500: 5. Specify `--local-prefix=DIR' if you want the compiler to search 1.1.1.7 ! root 501: directory `DIR/include' for locally installed header files ! 502: *instead* of `/usr/local/include'. 1.1.1.5 root 503: 1.1.1.7 ! root 504: You should specify `--local-prefix' *only* if your site has a ! 505: different convention (not `/usr/local') for where to put ! 506: site-specific files. ! 507: ! 508: *Do not* specify `/usr' as the `--local-prefix'! The directory ! 509: you use for `--local-prefix' *must not* contain any of the ! 510: system's standard header files. If it did contain them, certain ! 511: programs would be miscompiled (including GNU Emacs, on certain ! 512: targets), because this would override and nullify the header file ! 513: corrections made by the `fixincludes' script. 1.1.1.6 root 514: 1.1.1.5 root 515: 6. Make sure the Bison parser generator is installed. (This is 516: unnecessary if the Bison output files `c-parse.c' and `cexp.c' are 517: more recent than `c-parse.y' and `cexp.y' and you do not plan to 518: change the `.y' files.) 519: 520: Bison versions older than Sept 8, 1988 will produce incorrect 521: output for `c-parse.c'. 522: 1.1.1.6 root 523: 7. If you have chosen a configuration for GNU CC which requires other 524: GNU tools (such as GAS or the GNU linker) instead of the standard 525: system tools, install the required tools in the build directory 526: under the names `as', `ld' or whatever is appropriate. This will 527: enable the compiler to find the proper tools for compilation of 528: the program `enquire'. 529: 530: Alternatively, you can do subsequent compilation using a value of 531: the `PATH' environment variable such that the necessary GNU tools 532: come before the standard system tools. 533: 534: 8. Build the compiler. Just type `make LANGUAGES=c' in the compiler 1.1.1.5 root 535: directory. 536: 537: `LANGUAGES=c' specifies that only the C compiler should be 538: compiled. The makefile normally builds compilers for all the 539: supported languages; currently, C, C++ and Objective C. However, 540: C is the only language that is sure to work when you build with 541: other non-GNU C compilers. In addition, building anything but C 542: at this stage is a waste of time. 543: 544: In general, you can specify the languages to build by typing the 545: argument `LANGUAGES="LIST"', where LIST is one or more words from 1.1.1.7 ! root 546: the list `c', `c++', and `objective-c'. If you have any ! 547: additional GNU compilers as subdirectories of the GNU CC source ! 548: directory, you may also specify their names in this list. 1.1.1.5 root 549: 550: Ignore any warnings you may see about "statement not reached" in 551: `insn-emit.c'; they are normal. Also, warnings about "unknown 552: escape sequence" are normal in `genopinit.c' and perhaps some 1.1.1.7 ! root 553: other files. Likewise, you should ignore warnings about "constant ! 554: is so large that it is unsigned" in `insn-emit.c' and ! 555: `insn-recog.c'. Any other compilation errors may represent bugs in 1.1.1.5 root 556: the port to your machine or operating system, and should be 557: investigated and reported (*note Bugs::.). 558: 559: Some commercial compilers fail to compile GNU CC because they have 560: bugs or limitations. For example, the Microsoft compiler is said 561: to run out of macro space. Some Ultrix compilers run out of 562: expression space; then you need to break up the statement where 563: the problem happens. 564: 1.1.1.6 root 565: 9. If you are building a cross-compiler, stop here. *Note 1.1.1.5 root 566: Cross-Compiler::. 567: 1.1.1.6 root 568: 10. Move the first-stage object files and executables into a 1.1.1.5 root 569: subdirectory with this command: 570: 571: make stage1 572: 573: The files are moved into a subdirectory named `stage1'. Once 574: installation is complete, you may wish to delete these files with 575: `rm -r stage1'. 576: 1.1.1.6 root 577: 11. If you have chosen a configuration for GNU CC which requires other 1.1.1.5 root 578: GNU tools (such as GAS or the GNU linker) instead of the standard 579: system tools, install the required tools in the `stage1' 580: subdirectory under the names `as', `ld' or whatever is 581: appropriate. This will enable the stage 1 compiler to find the 582: proper tools in the following stage. 583: 584: Alternatively, you can do subsequent compilation using a value of 585: the `PATH' environment variable such that the necessary GNU tools 586: come before the standard system tools. 587: 1.1.1.6 root 588: 12. Recompile the compiler with itself, with this command: 1.1.1.5 root 589: 590: make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O" 591: 592: This is called making the stage 2 compiler. 593: 594: The command shown above builds compilers for all the supported 595: languages. If you don't want them all, you can specify the 596: languages to build by typing the argument `LANGUAGES="LIST"'. LIST 597: should contain one or more words from the list `c', `c++', 598: `objective-c', and `proto'. Separate the words with spaces. 599: `proto' stands for the programs `protoize' and `unprotoize'; they 600: are not a separate language, but you use `LANGUAGES' to enable or 601: disable their installation. 602: 603: If you are going to build the stage 3 compiler, then you might 604: want to build only the C language in stage 2. 605: 606: Once you have built the stage 2 compiler, if you are short of disk 607: space, you can delete the subdirectory `stage1'. 608: 609: On a 68000 or 68020 system lacking floating point hardware, unless 610: you have selected a `tm.h' file that expects by default that there 611: is no such hardware, do this instead: 612: 613: make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float" 614: 1.1.1.6 root 615: 13. If you wish to test the compiler by compiling it with itself one 1.1.1.5 root 616: more time, install any other necessary GNU tools (such as GAS or 617: the GNU linker) in the `stage2' subdirectory as you did in the 618: `stage1' subdirectory, then do this: 619: 620: make stage2 621: make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" 622: 623: This is called making the stage 3 compiler. Aside from the `-B' 624: option, the compiler options should be the same as when you made 625: the stage 2 compiler. But the `LANGUAGES' option need not be the 626: same. The command shown above builds compilers for all the 627: supported languages; if you don't want them all, you can specify 628: the languages to build by typing the argument `LANGUAGES="LIST"', 629: as described above. 630: 1.1.1.7 ! root 631: If you do not have to install any additional GNU tools, you may ! 632: use the command ! 633: ! 634: make bootstrap LANGUAGES=LANGUAGE-LIST BOOT_CFLAGS=OPTION-LIST ! 635: ! 636: instead of making `stage1', `stage2', and performing the two ! 637: compiler builds. ! 638: ! 639: 14. Then compare the latest object files with the stage 2 object 1.1.1.6 root 640: files--they ought to be identical, aside from time stamps (if any). 641: 642: On some systems, meaningful comparison of object files is 643: impossible; they always appear "different." This is currently 644: true on Solaris and probably on all systems that use ELF object 1.1.1.7 ! root 645: file format. On some versions of Irix on SGI machines and OSF/1 ! 646: on Alpha systems, you will not be able to compare the files ! 647: without specifying `-save-temps'; see the description of ! 648: individual systems above to see if you get comparison failures. ! 649: You may have similar problems on other systems. 1.1.1.6 root 650: 651: Use this command to compare the files: 1.1.1.5 root 652: 653: make compare 654: 655: This will mention any object files that differ between stage 2 and 656: stage 3. Any difference, no matter how innocuous, indicates that 657: the stage 2 compiler has compiled GNU CC incorrectly, and is 658: therefore a potentially serious bug which you should investigate 659: and report (*note Bugs::.). 660: 661: If your system does not put time stamps in the object files, then 662: this is a faster way to compare them (using the Bourne shell): 663: 664: for file in *.o; do 665: cmp $file stage2/$file 666: done 667: 668: If you have built the compiler with the `-mno-mips-tfile' option on 669: MIPS machines, you will not be able to compare the files. 670: 1.1.1.7 ! root 671: 15. Build the Objective C library (if you have built the Objective C 1.1.1.6 root 672: compiler). Here is the command to do this: 673: 674: make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" 675: 1.1.1.7 ! root 676: 16. Install the compiler driver, the compiler's passes and run-time 1.1.1.5 root 677: support with `make install'. Use the same value for `CC', 678: `CFLAGS' and `LANGUAGES' that you used when compiling the files 679: that are being installed. One reason this is necessary is that 680: some versions of Make have bugs and recompile files gratuitously 681: when you do this step. If you use the same variable values, those 682: files will be recompiled properly. 683: 684: For example, if you have built the stage 2 compiler, you can use 685: the following command: 686: 687: make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST" 688: 689: This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1', 690: `cpp' and `libgcc.a' in the directory 691: `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the 692: compiler driver program looks for them. Here TARGET is the target 693: machine type specified when you ran `configure', and VERSION is 694: the version number of GNU CC. This naming scheme permits various 695: versions and/or cross-compilers to coexist. 696: 697: This also copies the driver program `xgcc' into 698: `/usr/local/bin/gcc', so that it appears in typical execution 699: search paths. 700: 701: On some systems, this command causes recompilation of some files. 702: This is usually due to bugs in `make'. You should either ignore 703: this problem, or use GNU Make. 704: 705: *Warning: there is a bug in `alloca' in the Sun library. To avoid 706: this bug, be sure to install the executables of GNU CC that were 707: compiled by GNU CC. (That is, the executables from stage 2 or 3, 708: not stage 1.) They use `alloca' as a built-in function and never 709: the one in the library.* 710: 711: (It is usually better to install GNU CC executables from stage 2 712: or 3, since they usually run faster than the ones compiled with 713: some other compiler.) 714: 1.1.1.7 ! root 715: 17. Install the Objective C library (if you are installing the 1.1.1.6 root 716: Objective C compiler). Here is the command to do this: 1.1.1.5 root 717: 718: make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" 719: 1.1.1.7 ! root 720: 18. If you're going to use C++, it's likely that you need to also 1.1.1.5 root 721: install the libg++ distribution. It should be available from the 722: same place where you got the GNU C distribution. Just as GNU C 723: does not distribute a C runtime library, it also does not include 724: a C++ run-time library. All I/O functionality, special class 725: libraries, etc., are available in the libg++ distribution. 726:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.