install
来自「GCC编译器源代码」· 代码 · 共 1,454 行 · 第 1/5 页
TXT
1,454 行
`insn-recog.c' and a warning about a comparison always being zero in `enquire.o'. Any other compilation errors may represent bugs in the port to your machine or operating system, and should be investigated and reported. Some commercial compilers fail to compile GNU CC because they have bugs or limitations. For example, the Microsoft compiler is said to run out of macro space. Some Ultrix compilers run out of expression space; then you need to break up the statement where the problem happens. 9. If you are building a cross-compiler, stop here. *Note Cross-Compiler::. 10. Move the first-stage object files and executables into a subdirectory with this command: make stage1 The files are moved into a subdirectory named `stage1'. Once installation is complete, you may wish to delete these files with `rm -r stage1'. 11. If you have chosen a configuration for GNU CC which requires other GNU tools (such as GAS or the GNU linker) instead of the standard system tools, install the required tools in the `stage1' subdirectory under the names `as', `ld' or whatever is appropriate. This will enable the stage 1 compiler to find the proper tools in the following stage. Alternatively, you can do subsequent compilation using a value of the `PATH' environment variable such that the necessary GNU tools come before the standard system tools. 12. Recompile the compiler with itself, with this command: make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2" This is called making the stage 2 compiler. The command shown above builds compilers for all the supported languages. If you don't want them all, you can specify the languages to build by typing the argument `LANGUAGES="LIST"'. LIST should contain one or more words from the list `c', `c++', `objective-c', and `proto'. Separate the words with spaces. `proto' stands for the programs `protoize' and `unprotoize'; they are not a separate language, but you use `LANGUAGES' to enable or disable their installation. If you are going to build the stage 3 compiler, then you might want to build only the C language in stage 2. Once you have built the stage 2 compiler, if you are short of disk space, you can delete the subdirectory `stage1'. On a 68000 or 68020 system lacking floating point hardware, unless you have selected a `tm.h' file that expects by default that there is no such hardware, do this instead: make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2 -msoft-float" 13. If you wish to test the compiler by compiling it with itself one more time, install any other necessary GNU tools (such as GAS or the GNU linker) in the `stage2' subdirectory as you did in the `stage1' subdirectory, then do this: make stage2 make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2" This is called making the stage 3 compiler. Aside from the `-B' option, the compiler options should be the same as when you made the stage 2 compiler. But the `LANGUAGES' option need not be the same. The command shown above builds compilers for all the supported languages; if you don't want them all, you can specify the languages to build by typing the argument `LANGUAGES="LIST"', as described above. If you do not have to install any additional GNU tools, you may use the command make bootstrap LANGUAGES=LANGUAGE-LIST BOOT_CFLAGS=OPTION-LIST instead of making `stage1', `stage2', and performing the two compiler builds. 14. Then compare the latest object files with the stage 2 object files--they ought to be identical, aside from time stamps (if any). On some systems, meaningful comparison of object files is impossible; they always appear "different." This is currently true on Solaris and some systems that use ELF object file format. On some versions of Irix on SGI machines and DEC Unix (OSF/1) on Alpha systems, you will not be able to compare the files without specifying `-save-temps'; see the description of individual systems above to see if you get comparison failures. You may have similar problems on other systems. Use this command to compare the files: make compare This will mention any object files that differ between stage 2 and stage 3. Any difference, no matter how innocuous, indicates that the stage 2 compiler has compiled GNU CC incorrectly, and is therefore a potentially serious bug which you should investigate and report. If your system does not put time stamps in the object files, then this is a faster way to compare them (using the Bourne shell): for file in *.o; do cmp $file stage2/$file done If you have built the compiler with the `-mno-mips-tfile' option on MIPS machines, you will not be able to compare the files. 15. Install the compiler driver, the compiler's passes and run-time support with `make install'. Use the same value for `CC', `CFLAGS' and `LANGUAGES' that you used when compiling the files that are being installed. One reason this is necessary is that some versions of Make have bugs and recompile files gratuitously when you do this step. If you use the same variable values, those files will be recompiled properly. For example, if you have built the stage 2 compiler, you can use the following command: make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST" This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1', `cpp' and `libgcc.a' in the directory `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the compiler driver program looks for them. Here TARGET is the target machine type specified when you ran `configure', and VERSION is the version number of GNU CC. This naming scheme permits various versions and/or cross-compilers to coexist. It also copies the executables for compilers for other languages (e.g., `cc1plus' for C++) to the same directory. This also copies the driver program `xgcc' into `/usr/local/bin/gcc', so that it appears in typical execution search paths. It also copies `gcc.1' into `/usr/local/man/man1' and info pages into `/usr/local/info'. On some systems, this command causes recompilation of some files. This is usually due to bugs in `make'. You should either ignore this problem, or use GNU Make. *Warning: there is a bug in `alloca' in the Sun library. To avoid this bug, be sure to install the executables of GNU CC that were compiled by GNU CC. (That is, the executables from stage 2 or 3, not stage 1.) They use `alloca' as a built-in function and never the one in the library.* (It is usually better to install GNU CC executables from stage 2 or 3, since they usually run faster than the ones compiled with some other compiler.) 16. If you're going to use C++, it's likely that you need to also install a C++ runtime library. Just as GNU C does not distribute a C runtime library, it also does not include a C++ runtime library. All I/O functionality, special class libraries, etc., are provided by the C++ runtime library. Here's one way to build and install a C++ runtime library for GNU CC: * Build and install GNU CC, so that invoking `gcc' obtains the GNU CC that was just built. * Obtain a copy of a compatible `libstdc++' distribution. For example, the `libstdc++-2.8.0.tar.gz' distribution should be compatible with GCC 2.8.0. GCC distributors normally distribute `libstdc++' as well. * Set the `CXX' environment variable to `gcc' while running the `libstdc++' distribution's `configure' command. Use the same `configure' options that you used when you invoked GCC's `configure' command. * Invoke `make' to build the C++ runtime. * Invoke `make install' to install the C++ runtime. To summarize, after building and installing GNU CC, invoke the following shell commands in the topmost directory of the C++ library distribution. For CONFIGURE-OPTIONS, use the same options that you used to configure GNU CC. $ CXX=gcc ./configure CONFIGURE-OPTIONS $ make $ make install 17. GNU CC includes a runtime library for Objective-C because it is an integral part of the language. You can find the files associated with the library in the subdirectory `objc'. The GNU Objective-C Runtime Library requires header files for the target's C library in order to be compiled,and also requires the header files for the target's thread library if you want thread support. *Note Cross-Compilers and Header Files: Cross Headers, for discussion about header files issues for cross-compilation. When you run `configure', it picks the appropriate Objective-C thread implementation file for the target platform. In some situations, you may wish to choose a different back-end as some platforms support multiple thread implementations or you may wish to disable thread support completely. You do this by specifying a value for the OBJC_THREAD_FILE makefile variable on the command line when you run make, for example: make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2" OBJC_THREAD_FILE=thr-single Below is a list of the currently available back-ends. * thr-single Disable thread support, should work for all platforms. * thr-decosf1 DEC OSF/1 thread support. * thr-irix SGI IRIX thread support. * thr-mach Generic MACH thread support, known to work on NEXTSTEP. * thr-os2 IBM OS/2 thread support. * thr-posix Generix POSIX thread support. * thr-pthreads PCThreads on Linux-based GNU systems. * thr-solaris SUN Solaris thread support. * thr-win32 Microsoft Win32 API thread support.Configurations Supported by GNU CC================================== Here are the possible CPU types: 1750a, a29k, alpha, arm, cN, clipper, dsp16xx, elxsi, h8300, hppa1.0, hppa1.1, i370, i386, i486, i586, i860, i960, m32r, m68000, m68k, m88k, mips, mipsel, mips64, mips64el, ns32k, powerpc, powerpcle, pyramid, romp, rs6000, sh, sparc, sparclite, sparc64, vax, we32k. Here are the recognized company names. As you can see, customaryabbreviations are used rather than the longer official names. acorn, alliant, altos, apollo, apple, att, bull, cbm, convergent, convex, crds, dec, dg, dolphin, elxsi, encore, harris, hitachi, hp, ibm, intergraph, isi, mips, motorola, ncr, next, ns, omron, plexus, sequent, sgi, sony, sun, tti, unicom, wrs. The company name is meaningful only to disambiguate when the rest ofthe information supplied is insufficient. You can omit it, writingjust `CPU-SYSTEM', if it is not needed. For example, `vax-ultrix4.2'is equivalent to `vax-dec-ultrix4.2'. Here is a list of system types: 386bsd, aix, acis, amigaos, aos, aout, aux, bosx, bsd, clix, coff, ctix, cxux, dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms, genix, gnu, linux-gnu, hiux, hpux, iris, irix, isc, luna, lynxos, mach, minix, msdos, mvs, netbsd, newsos, nindy, ns, osf, osfrose, ptx, riscix, riscos, rtu, sco, sim, solaris, sunos, sym, sysv, udi, ultrix, unicos, uniplus, unos, vms, vsta, vxworks, winnt, xenix.You can omit the system type; then `configure' guesses the operatingsystem from the CPU and company. You can add a version number to the system type; this may or may notmake a difference. For example, you can write `bsd4.3' or `bsd4.4' todistinguish versions of BSD. In practice, the version number is mostneeded for `sysv3' and `sysv4', which are often treated differently. If you specify an impossible combination such as `i860-dg-vms', thenyou may get an error message from `configure', or it may ignore part ofthe information and do the best it can with the rest. `configure'always prints the canonical name for the alternative that it used. GNUCC does not support all possible alternatives. Often a particular model of machine has a name. Many machine namesare recognized as aliases for CPU/company combinations. Thus, themachine name `sun3', mentioned above, is an alias for `m68k-sun'.Sometimes we accept a company name as a machine name, when the name ispopularly used for a particular machine. Here is a table of the knownmachine names: 3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?