📄 install
字号:
MIPS machines running the MIPS operating system in BSD mode. It's possible that some old versions of the system lack the functions `memcpy', `memcmp', and `memset'. If your system lacks these, you must remove or undo the definition of `TARGET_MEM_FUNCTIONS' in `mips-bsd.h'. `mips-sony-sysv' Sony MIPS NEWS. This works in NEWSOS 5.0.1, but not in 5.0.2 (which uses ELF instead of COFF). Support for 5.0.2 will probably be provided soon by volunteers. `ns32k-encore' Encore ns32000 system. Encore systems are supported only under BSD. `ns32k-*-genix' National Semiconductor ns32000 system. Genix has bugs in `alloca' and `malloc'; you must get the compiled versions of these from GNU Emacs. `ns32k-sequent' Go to the Berkeley universe before compiling. In addition, you probably need to create a file named `string.h' containing just one line: `#include <strings.h>'. `ns32k-utek' UTEK ns32000 system ("merlin"). The C compiler that comes with this system cannot compile GNU CC; contact `tektronix!reed!mason' to get binaries of GNU CC for bootstrapping. `romp-*-aos' `romp-*-mach' The only operating systems supported for the IBM RT PC are AOS and MACH. GNU CC does not support AIX running on the RT. We recommend you compile GNU CC with an earlier version of itself; if you compile GNU CC with `hc', the Metaware compiler, it will work, but you will get mismatches between the stage 2 and stage 3 compilers in various files. These errors are minor differences in some floating-point constants and can be safely ignored; the stage 3 compiler is correct. `rs6000-*-aix' *Read the file `README.RS6000' for information on how to get a fix for a problem in the IBM assembler that prevents use of GNU CC.* You must either obtain the new assembler or avoid using the `-g' switch. Note that `Makefile.in' uses `-g' by default when compiling `libgcc2.c'. `vax-dec-ultrix' Don't try compiling with Vax C (`vcc'). It produces incorrect code in some cases (for example, when `alloca' is used). Meanwhile, compiling `cp-parse.c' with pcc does not work because of an internal table size limitation in that compiler. To avoid this problem, compile just the GNU C compiler first, and use it to recompile building all the languages that you want to run. Here we spell out what files will be set up by `configure'. Normally you need not be concerned with these files. * A symbolic link named `config.h' is made to the top-level config file for the machine you plan to run the compiler on (*note The Configuration File: (gcc.info)Config.). This file is responsible for defining information about the host machine. It includes `tm.h'. The top-level config file is located in the subdirectory `config'. Its name is always `xm-SOMETHING.h'; usually `xm-MACHINE.h', but there are some exceptions. If your system does not support symbolic links, you might want to set up `config.h' to contain a `#include' command which refers to the appropriate file. * A symbolic link named `tconfig.h' is made to the top-level config file for your target machine. This is used for compiling certain programs to run on that machine. * A symbolic link named `tm.h' is made to the machine-description macro file for your target machine. It should be in the subdirectory `config' and its name is often `MACHINE.h'. * A symbolic link named `md' will be made to the machine description pattern file. It should be in the `config' subdirectory and its name should be `MACHINE.md'; but MACHINE is often not the same as the name used in the `tm.h' file because the `md' files are more general. * A symbolic link named `aux-output.c' will be made to the output subroutine file for your machine. It should be in the `config' subdirectory and its name should be `MACHINE.c'. * The command file `configure' also constructs `Makefile' by adding some text to the template file `Makefile.in'. The additional text comes from files in the `config' directory, named `t-TARGET' and `h-HOST'. If these files do not exist, it means nothing needs to be added for a given target or host. 4. Make sure the Bison parser generator is installed. (This is unnecessary if the Bison output files `c-parse.c' and `cexp.c' are more recent than `c-parse.y' and `cexp.y' and you do not plan to change the `.y' files.) Bison versions older than Sept 8, 1988 will produce incorrect output for `c-parse.c'. 5. Build the compiler. Just type `make LANGUAGES=c' in the compiler directory. `LANGUAGES=c' specifies that only the C compiler should be compiled. The makefile normally builds compilers for all the supported languages; currently, C, C++ and Objective C. However, C is the only language that is sure to work when you build with other non-GNU C compilers. In addition, building anything but C at this stage is a waste of time. In general, you can specify the languages to build by typing the argument `LANGUAGES="LIST"', where LIST is one or more words from the list `c', `c++', and `objective-c'. Ignore any warnings you may see about "statement not reached" in `insn-emit.c'; they are normal. 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. If you are building with a previous GNU C compiler, do not use `CC=gcc' on the make command or by editing the Makefile. Instead, use a full pathname to specify the compiler, such as `CC=/usr/local/bin/gcc'. This is because make might execute the `gcc' in the current directory before all of the compiler components have been built. 6. If you are using COFF-encapsulation, you must convert `libgcc.a' to a GNU-format library at this point. See the file `README.ENCAP' in the directory containing the GNU binary file utilities, for directions. 7. If you are building a cross-compiler, stop here. *Note Cross-Compiler::. 8. 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'. 9. Recompile the compiler with itself, with this command: make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O" This is called making the stage 2 compiler. The command shown above builds compilers for all the supported languages. If you don't want them all, you can specify the languages to build by typing the argument `LANGUAGES="LIST"'. LIST should contain one or more words from the list `c', `c++', `objective-c', and `proto'. Separate the words with spaces. `proto' stands for the programs `protoize' and `unprotoize'; they are not a separate language, but you use `LANGUAGES' to enable or disable their installation. If you are going to build the stage 3 compiler, then you might want to build only the C language in stage 2. Once you have built the stage 2 compiler, if you are short of disk space, you can delete the subdirectory `stage1'. On a 68000 or 68020 system lacking floating point hardware, unless you have selected a `tm.h' file that expects by default that there is no such hardware, do this instead: make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float" 10. If you wish to test the compiler by compiling it with itself one more time, do this: make stage2 make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" 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. Then compare the latest object files with the stage 2 object files--they ought to be identical, unless they contain time stamps. You can compare the files, disregarding the time stamps if any, like this: 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. 11. Install the compiler driver, the compiler's passes and run-time support. You can use the following command: make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST" (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. This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1', `cpp' and `libgcc.a' in 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 driver program `gcc' into the directory `/usr/local/bin', so that it appears in typical execution search paths. On some systems, this command will cause 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.) 12. Install the Objective C library (if you have built the Objective C compiler). Here is the command to do this: make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" 13. Correct errors in the header files on your machine. Various system header files often contain constructs which are erroneous, incompatible with ANSI C or otherwise unsuitable, and they will not work when you compile programs with GNU CC. The most common erroneous construct is found in `ioctl.h', where a macro expects argument values to be substituted for argument names inside of character constants--something not done in ANSI C. This particular problem can be prevented by using `-traditional'. Other problems are not so easy to work around. GNU CC comes with shell scripts to fix known header file problems. They install corrected copies of various header files in a special directory where only GNU CC will normally look for them. The scripts adapt to various systems by searching all the system header files for the problem cases that we know about. Use the following command to do this: make install-fixincludes If you selected a different directory for GNU CC installation when
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -