📄 install
字号:
`powerpcle-*-sysv4' Embedded PowerPC system in little endian mode. This system is currently under development.`powerpcle-*-eabisim' Embedded PowerPC system in little endian mode for use in running under the PSIM simulator. This system is currently under development.`powerpcle-*-eabi' Embedded PowerPC system in little endian mode. This configuration is currently under development.`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.`sparc-sun-*' See *Note Sun Install::, for information on installing GNU CC on Sun systems.`vax-dec-vms' See *Note VMS Install::, for details on how to install GNU CC on VMS.`we32k-*-*' These computers are also known as the 3b2, 3b5, 3b20 and other similar names. (However, the 3b1 is actually a 68000; see *Note Configurations::.) Don't use `-g' when compiling with the system's compiler. The system's linker seems to be unable to handle such a large program with debugging information. The system's compiler runs out of capacity when compiling `stmt.c' in GNU CC. You can work around this by building `cpp' in GNU CC first, then use that instead of the system's preprocessor with the system's C compiler to compile `stmt.c'. Here is how: mv /lib/cpp /lib/cpp.att cp cpp /lib/cpp.gnu echo '/lib/cpp.gnu -traditional ${1+"$@"}' > /lib/cpp chmod +x /lib/cpp The system's compiler produces bad code for some of the GNU CC optimization files. So you must build the stage 2 compiler without optimization. Then build a stage 3 compiler with optimization. That executable should work. Here are the necessary commands: make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g" make stage2 make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O" You may need to raise the ULIMIT setting to build a C++ compiler, as the file `cc1plus' is larger than one megabyte.Compilation in a Separate Directory=================================== If you wish to build the object files and executables in a directoryother than the one containing the source files, here is what you mustdo differently: 1. Make sure you have a version of Make that supports the `VPATH' feature. (GNU Make supports it, as do Make versions on most BSD systems.) 2. If you have ever run `configure' in the source directory, you must undo the configuration. Do this by running: make distclean 3. Go to the directory in which you want to build the compiler before running `configure': mkdir gcc-sun3 cd gcc-sun3 On systems that do not support symbolic links, this directory must be on the same file system as the source code directory. 4. Specify where to find `configure' when you run it: ../gcc/configure ... This also tells `configure' where to find the compiler sources; `configure' takes the directory from the file name that was used to invoke it. But if you want to be sure, you can specify the source directory with the `--srcdir' option, like this: ../gcc/configure --srcdir=../gcc OTHER OPTIONS The directory you specify with `--srcdir' need not be the same as the one that `configure' is found in. Now, you can run `make' in that directory. You need not repeat theconfiguration steps shown above, when ordinary source files change. Youmust, however, run `configure' again when the configuration fileschange, if your system does not support symbolic links.Building and Installing a Cross-Compiler======================================== GNU CC can function as a cross-compiler for many machines, but notall. * Cross-compilers for the Mips as target using the Mips assembler currently do not work, because the auxiliary programs `mips-tdump.c' and `mips-tfile.c' can't be compiled on anything but a Mips. It does work to cross compile for a Mips if you use the GNU assembler and linker. * Cross-compilers between machines with different floating point formats have not all been made to work. GNU CC now has a floating point emulator with which these can work, but each target machine description needs to be updated to take advantage of it. * Cross-compilation between machines of different word sizes is somewhat problematic and sometimes does not work. Since GNU CC generates assembler code, you probably need across-assembler that GNU CC can run, in order to produce object files.If you want to link on other than the target machine, you need across-linker as well. You also need header files and libraries suitablefor the target machine that you can install on the host machine.Steps of Cross-Compilation-------------------------- To compile and run a program using a cross-compiler involves severalsteps: * Run the cross-compiler on the host machine to produce assembler files for the target machine. This requires header files for the target machine. * Assemble the files produced by the cross-compiler. You can do this either with an assembler on the target machine, or with a cross-assembler on the host machine. * Link those files to make an executable. You can do this either with a linker on the target machine, or with a cross-linker on the host machine. Whichever machine you use, you need libraries and certain startup files (typically `crt....o') for the target machine. It is most convenient to do all of these steps on the same hostmachine, since then you can do it all with a single invocation of GNUCC. This requires a suitable cross-assembler and cross-linker. Forsome targets, the GNU assembler and linker are available.Configuring a Cross-Compiler---------------------------- To build GNU CC as a cross-compiler, you start out by running`configure'. Use the `--target=TARGET' to specify the target type. If`configure' was unable to correctly identify the system you are runningon, also specify the `--build=BUILD' option. For example, here is howto configure for a cross-compiler that produces code for an HP 68030system running BSD on a system that `configure' can correctly identify: ./configure --target=m68k-hp-bsd4.3Tools and Libraries for a Cross-Compiler---------------------------------------- If you have a cross-assembler and cross-linker available, you shouldinstall them now. Put them in the directory `/usr/local/TARGET/bin'.Here is a table of the tools you should put in this directory:`as' This should be the cross-assembler.`ld' This should be the cross-linker.`ar' This should be the cross-archiver: a program which can manipulate archive files (linker libraries) in the target machine's format.`ranlib' This should be a program to construct a symbol table in an archive file. The installation of GNU CC will find these programs in thatdirectory, and copy or link them to the proper place to for thecross-compiler to find them when run later. The easiest way to provide these files is to build the Binutilspackage and GAS. Configure them with the same `--host' and `--target'options that you use for configuring GNU CC, then build and installthem. They install their executables automatically into the properdirectory. Alas, they do not support all the targets that GNU CCsupports. If you want to install libraries to use with the cross-compiler,such as a standard C library, put them in the directory`/usr/local/TARGET/lib'; installation of GNU CC copies all all thefiles in that subdirectory into the proper place for GNU CC to findthem and link with them. Here's an example of copying some librariesfrom a target machine: ftp TARGET-MACHINE lcd /usr/local/TARGET/lib cd /lib get libc.a cd /usr/lib get libg.a get libm.a quitThe precise set of libraries you'll need, and their locations on thetarget machine, vary depending on its operating system. Many targets require "start files" such as `crt0.o' and `crtn.o'which are linked into each executable; these too should be placed in`/usr/local/TARGET/lib'. There may be several alternatives for`crt0.o', for use with profiling or other compilation options. Checkyour target's definition of `STARTFILE_SPEC' to find out what startfiles it uses. Here's an example of copying these files from a targetmachine: ftp TARGET-MACHINE lcd /usr/local/TARGET/lib prompt cd /lib mget *crt*.o cd /usr/lib mget *crt*.o quit`libgcc.a' and Cross-Compilers------------------------------ Code compiled by GNU CC uses certain runtime support functionsimplicitly. Some of these functions can be compiled successfully withGNU CC itself, but a few cannot be. These problem functions are in thesource file `libgcc1.c'; the library made from them is called`libgcc1.a'. When you build a native compiler, these functions are compiled withsome other compiler-the one that you use for bootstrapping GNU CC.Presumably it knows how to open code these operations, or else knows howto call the run-time emulation facilities that the machine comes with.But this approach doesn't work for building a cross-compiler. Thecompiler that you use for building knows about the host system, not thetarget system. So, when you build a cross-compiler you have to supply a suitablelibrary `libgcc1.a' that does the job it is expected to do. To compile `libgcc1.c' with the cross-compiler itself does not work.The functions in this file are supposed to implement arithmeticoperations that GNU CC does not know how to open code for your targetmachine. If these functions are compiled with GNU CC itself, they willcompile into infinite recursion. On any given target, most of these functions are not needed. If GNUCC can open code an arithmetic operation, it will not call thesefunctions to perform the operation. It is possible that on your targetmachine, none of these functions is needed. If so, you can supply anempty library as `libgcc1.a'. Many targets need library support only for multiplication anddivision. If you are linking with a library that contains functions formultiplication and division, you can tell GNU CC to call them directlyby defining the macros `MULSI3_LIBCALL', and the like. These macrosneed to be defined in the target description macro file. For sometargets, they are defined already. This may be sufficient to avoid theneed for libgcc1.a; if so, you can supply an empty library. Some targets do not have floating point instructions; they need otherfunctions in `libgcc1.a', which do floating arithmetic. Recentversions of GNU CC have a file which emulates floating point. With acertain amount of work, you should be able to construct a floatingpoint emulator that can be used as `libgcc1.a'. Perhaps futureversions will contain code to do this automatically and conveniently.That depends on whether someone wants to implement it. Some embedded targets come with all the necessary `libgcc1.a'routines wri
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -