📄 install.texi
字号:
@examplemake install-fixincludes@end example@noindentIf you selected a different directory for GNU CC installation when youinstalled it, by specifying the Make variable @code{prefix} or@code{libdir}, specify it the same way in this command.Note that some systems are starting to come with ANSI C system headerfiles. On these systems, don't run @code{install-fixincludes}; it maynot work, and is certainly not necessary. One exception: there are is aspecial script for System V release 4, which you should run.It is not the purpose of @code{install-fixincludes} to add prototypes tothe system header files. We support headers with ANSI C prototypes inthe GNU C Library, and we have no time to support adding them to othersystems' header files.@itemIf you're going to use C++, it's likely that you need to also installthe @code{libg++} distribution. It should be available from the sameplace where you got the GCC distribution. Just as GCC does notdistribute a C runtime library, it also does not include a C++ run-timelibrary. All I/O functionality, special class libraries, etc., areavailable in the @code{libg++} distribution.@end enumerateIf you cannot install the compiler's passes and run-time support in@file{/usr/local/lib}, you can alternatively use the @samp{-B} option tospecify a prefix by which they may be found. The compiler concatenatesthe prefix with the names @file{cpp}, @file{cc1} and @file{libgcc.a}.Thus, you can put the files in a directory @file{/usr/foo/gcc} andspecify @samp{-B/usr/foo/gcc/} when you run GNU CC.Also, you can specify an alternative default directory for these filesby setting the Make variable @code{libdir} when you make GNU CC.@node Other Dir@section Compilation in a Separate Directory@cindex other directory, compilation in@cindex compilation in a separate directory@cindex separate directory, compilation inIf 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:@enumerate@itemMake sure you have a version of Make that supports the @code{VPATH}feature. (GNU Make supports it, as do Make versions on most BSDsystems.)@itemIf you have ever run @file{configure} in the source directory, you must undothe configuration. Do this by running:@examplemake distclean@end example@itemGo to the directory in which you want to build the compiler beforerunning @file{configure}:@examplemkdir gcc-sun3cd gcc-sun3@end exampleOn systems that do not support symbolic links, this directory must beon the same file system as the source code directory.@itemSpecify where to find @file{configure} when you run it:@example../gcc/configure @dots{}@end exampleThis also tells @code{configure} where to find the compiler sources;@code{configure} takes the directory from the file name that was used toinvoke it. But if you want to be sure, you can specify the sourcedirectory with the @samp{--srcdir} option, like this:@example../gcc/configure --srcdir=../gcc sun3@end exampleThe directory you specify with @samp{--srcdir} need not be the sameas the one that @code{configure} is found in.@end enumerateNow, you can run @code{make} in that directory. You need not repeat theconfiguration steps shown above, when ordinary source files change. Youmust, however, run @code{configure} again when the configuration fileschange, if your system does not support symbolic links.@node Cross-Compiler@section Building and Installing a Cross-Compiler@cindex cross-compiler, installationGNU CC can function as a cross-compiler for many machines, but not all.@itemize @bullet@itemCross-compilers for the Mips as target do not work because the auxiliaryprograms @file{mips-tdump.c} and @file{mips-tfile.c} can't be compiledon anything but a Mips.@itemCross-compilers to or from the Vax probably don't work completelybecause the Vax uses an incompatible floating point format (not IEEEformat).@end itemizeSince 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.To build GNU CC as a cross-compiler, you start out by running@code{configure}. You must specify two different configurations, thehost and the target. Use the @samp{--host=@var{host}} option for thehost and @samp{--target=@var{target}} to specify the target type. Forexample, here is how to configure for a cross-compiler that runs on ahypothetical Intel 386 system and produces code for an HP 68030 systemrunning BSD:@exampleconfigure --target=m68k-hp-bsd4.3 --host=i386-bozotheclone-bsd4.3@end exampleNext you should install the cross-assembler and cross-linker (and@code{ar} and @code{ranlib}). Put them in the directory@file{/usr/local/@var{target}/bin}. The installation of GNU CC will findthem there and copy or link them to the proper place to find them whenyou run the cross-compiler later.If you want to install any additional libraries to use with thecross-compiler, put them in the directory@file{/usr/local/@var{target}/lib}; all files in that subdirectory willbe installed in the proper place when you install the cross-compiler.Likewise, put the header files for the target machine in@file{/usr/local/@var{target}/include}.You must now produce a substitute for @file{libgcc1.a}. Normally thisfile is compiled with the ``native compiler'' for the target machine;compiling it with GNU CC does not work. But compiling it with the hostmachine's compiler also doesn't work---that produces a file that wouldrun on the host, and you need it to run on the target.We can't give you any automatic way to produce this substitute. Forsome targets, the subroutines in @file{libgcc1.c} are not actually used.You need not provide the ones that won't be used. The ones that mostcommonly are used are the multiplication, division and remainderroutines---many RISC machines rely on the library for this. One way tomake them work is to define the appropriate @code{perform_@dots{}}macros for the subroutines that you need. If these definitions do notuse the C arithmetic operators that they are meant to implement, youmight be able to compile them with the cross-compiler you are building.To do this, specify @samp{LIBGCC1=libgcc1.a OLDCC=./xgcc} when buildingthe compiler.Now you can proceed just as for compiling a single-machine compilerthrough the step of building stage 1. If you have not provided somesort of @file{libgcc1.a}, then compilation will give up at the pointwhere it needs that file, printing a suitable error message. If youdo provide @file{libgcc1.a}, then building the compiler will automaticallycompile and link a test program called @file{cross-test}; if you geterrors in the linking, it means that not all of the necessary routinesin @file{libgcc1.a} are available.When you are using a cross-compiler configuration, building stage 1does not compile all of GNU CC. This is because one part of building,the compilation of @file{libgcc2.c}, requires use of the cross-compiler.However, when you type @samp{make install} to install the bulk of thecross-compiler, that will also compile @file{libgcc2.c} and install theresulting @file{libgcc.a}.Do not try to build stage 2 for a cross-compiler. It doesn't work torebuild GNU CC as a cross-compiler using the cross-compiler, becausethat would produce a program that runs on the target machine, not on thehost. For example, if you compile a 386-to-68030 cross-compiler withitself, the result will not be right either for the 386 (because it wascompiled into 68030 code) or for the 68030 (because it was configuredfor a 386 as the host). If you want to compile GNU CC into 68030 code,whether you compile it on a 68030 or with a cross-compiler on a 386, youmust specify a 68030 as the host when you configure it.@node PA Install@section Installing GNU CC on the HP Precision ArchitectureThere are two variants of this CPU, called 1.0 and 1.1, which havedifferent machine descriptions. You must use the right one for yourmachine. All 7@var{nn} machines and 8@var{n}7 machines use 1.1, whileall other 8@var{nn} machines use 1.0.The easiest way to handle this problem is to use @samp{configurehp@var{nnn}} or @samp{configure hp@var{nnn}-hpux}, where @var{nnn} isthe model number of the machine. Then @file{configure} will figure outif the machine is a 1.0 or 1.1. Use @samp{uname -a} to find out themodel number of your machine.@samp{-g} does not work on HP-UX, since that system uses a peculiardebugging format which GNU CC does not know about. There are preliminaryversions of GAS and GDB for the HP-PA which do work with GNU CC for debugging. You can get them by anonymous ftp from @code{jaguar.cs.utah.edu}@samp{dist} subdirectory. You would need to install GAS in the file@example/usr/local/lib/gcc-lib/@var{configuration}/@var{gccversion}/as@end example@noindentwhere @var{configuration} is the configuration name (perhaps@samp{hp@var{nnn}-hpux}) and @var{gccversion} is the GNU CC versionnumber. Do this @emph{before} starting the build process, otherwise you willget errors from the HPUX assembler while building @file{libgcc2.a}. Thecommand @examplemake install-dir@end example@noindentwill create the necessary directory hierarchy so you can install GAS beforebuilding GCC.If you obtained GAS before October 6, 1992 it is highly recommended youget a new one to avoid several bugs which have been discoveredrecently.To enable debugging, configure GNU CC with the @samp{--gas} option beforebuilding.@node Sun Install@section Installing GNU CC on the Sun@cindex Sun installation@cindex installing GNU CC on the SunMake sure the environment variable @code{FLOAT_OPTION} is not set whenyou compile @file{libgcc.a}. If this option were set to @code{f68881}when @file{libgcc.a} is compiled, the resulting code would demand to belinked with a special startup file and would not link properly withoutspecial pains.@cindex @code{alloca}, for SunOsThere is a bug in @code{alloca} in certain versions of the Sun library.To avoid this bug, install the binaries of GNU CC that were compiled byGNU CC. They use @code{alloca} as a built-in function and never the onein the library.Some versions of the Sun compiler crash when compiling GNU CC. Theproblem is a segmentation fault in cpp. This problem seems to be due tothe bulk of data in the environment variables. You may be able to avoidit by using the following command to compile GNU CC with Sun CC:@examplemake CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"@end example@node 3b1 Install@section Installing GNU CC on the 3b1@cindex 3b1 installation@cindex installing GNU CC on the 3b1Installing GNU CC on the 3b1 is difficult if you do not already haveGNU CC running, due to bugs in the installed C compiler. However,the following procedure might work. We are unable to test it.@enumerate@itemComment out the @samp{#include "config.h"} line on line 37 of@file{cccp.c} and do @samp{make cpp}. This makes a preliminary versionof GNU cpp.@itemSave the old @file{/lib/cpp} and copy the preliminary GNU cpp to thatfile name.@itemUndo your change in @file{cccp.c}, or reinstall the original version,and do @samp{make cpp} again.@itemCopy this final version of GNU cpp into @file{/lib/cpp}.@findex obstack_free@itemReplace every occurrence of @code{obstack_free} in the file@file{tree.c} with @code{_obstack_free}.@itemRun @code{make} to get the first-stage GNU CC.@itemReinstall the original version of @file{/lib/cpp}.@itemNow you can compile GNU CC with itself and install it in the normalfashion.@end enumerate@node Unos Install@section Installing GNU CC on Unos@cindex Unos installation@cindex installing GNU CC on UnosUse @samp{configure unos} for building on Unos.The Unos assembler is named @code{casm} instead of @code{as}. For somestrange reason linking @file{/bin/as} to @file{/bin/casm} changes thebehavior, and does not work. So, when installing GNU CC, you shouldinstall the following script as @file{as} in the subdirectory wherethe passes of GCC are installed:@example#!/bin/shcasm $*@end exampleThe default Unos library is named @file{libunos.a} instead of@file{libc.a}. To allow GNU CC to function, either change allreferences to @samp{-lc} in @file{gcc.c} to @samp{-lunos} or link@file{/lib/libc.a} to @file{/lib/libunos.a}.@cindex @code{alloca}, for UnosWhen compiling GNU CC with the standard compiler, to overcome bugs inthe support of @code{alloca}, do not use @samp{-O} when making stage 2.Then use the stage 2 compiler with @samp{-O} to make the stage 3compiler. This compiler will have the same characteristics as the usualstage 2 compiler on other systems. Use it to make a stage 4 compilerand compare that with stage 3 to verify proper compilation.(Perhaps simply defining @code{ALLOCA} in @file{x-crds} as described inthe comments there will make the above paragraph superfluous. Pleaseinform us of whether this works.)Unos uses memory segmentation instead of demand paging, so you will needa lot of memory. 5 Mb is barely enough if no other tasks are running.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -