]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/install-old.texi
GNU CC -> GCC
[thirdparty/gcc.git] / gcc / doc / install-old.texi
CommitLineData
e3223ea2 1@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
2284f91b 2@c This is part of the GCC manual.
73e2155a
JM
3@c For copying conditions, see the file install.texi.
4
5@ifnothtml
6@comment node-name, next, previous, up
7@node Old, GNU Free Documentation License, Specific, Top
8@end ifnothtml
9@html
10<h1 align="center">Old installation documentation</h1>
11@end html
12@ifnothtml
13@chapter Old installation documentation
14@end ifnothtml
2284f91b 15
f85b8d1a 16Note most of this information is out of date and superseded by the
73e2155a
JM
17previous chapters of this manual. It is provided for historical
18reference only, because of a lack of volunteers to merge it into the
19main manual.
f85b8d1a 20
73e2155a 21@ifnothtml
2284f91b 22@menu
7ec022b2 23* Configurations:: Configurations Supported by GCC.
2284f91b 24* Cross-Compiler:: Building and installing a cross-compiler.
2284f91b 25* VMS Install:: See below for installation on VMS.
2284f91b 26@end menu
73e2155a 27@end ifnothtml
2284f91b 28
7ec022b2 29Here is the procedure for installing GCC on a GNU or Unix system.
f85b8d1a 30See @ref{VMS Install}, for VMS systems.
2284f91b
DE
31
32@enumerate
ab87f8c8 33@item
7ec022b2 34If you have chosen a configuration for GCC which requires other GNU
ab87f8c8
JL
35tools (such as GAS or the GNU linker) instead of the standard system
36tools, install the required tools in the build directory under the names
cd42d3df 37@file{as}, @file{ld} or whatever is appropriate.
ab87f8c8
JL
38
39Alternatively, you can do subsequent compilation using a value of the
40@code{PATH} environment variable such that the necessary GNU tools come
41before the standard system tools.
42
2284f91b
DE
43@item
44Specify the host, build and target machine configurations. You do this
ab87f8c8 45when you run the @file{configure} script.
2284f91b
DE
46
47The @dfn{build} machine is the system which you are using, the
48@dfn{host} machine is the system where you want to run the resulting
49compiler (normally the build machine), and the @dfn{target} machine is
50the system for which you want the compiler to generate code.
51
52If you are building a compiler to produce code for the machine it runs
53on (a native compiler), you normally do not need to specify any operands
54to @file{configure}; it will try to guess the type of machine you are on
55and use that as the build, host and target machines. So you don't need
56to specify a configuration when building a native compiler unless
57@file{configure} cannot figure out what your configuration is or guesses
58wrong.
59
60In those cases, specify the build machine's @dfn{configuration name}
630d3d5a 61with the @option{--host} option; the host and target will default to be
e5e809f4 62the same as the host machine. (If you are building a cross-compiler,
2284f91b
DE
63see @ref{Cross-Compiler}.)
64
65Here is an example:
66
67@smallexample
f5963e61 68./configure --host=sparc-sun-sunos4.1
2284f91b
DE
69@end smallexample
70
71A configuration name may be canonical or it may be more or less
72abbreviated.
73
74A canonical configuration name has three parts, separated by dashes.
75It looks like this: @samp{@var{cpu}-@var{company}-@var{system}}.
76(The three parts may themselves contain dashes; @file{configure}
77can figure out which dashes serve which purpose.) For example,
78@samp{m68k-sun-sunos4.1} specifies a Sun 3.
79
80You can also replace parts of the configuration by nicknames or aliases.
81For example, @samp{sun3} stands for @samp{m68k-sun}, so
e954b3d7 82@samp{sun3-sunos4.1} is another way to specify a Sun 3.
2284f91b
DE
83
84You can specify a version number after any of the system types, and some
85of the CPU types. In most cases, the version is irrelevant, and will be
86ignored. So you might as well specify the version if you know it.
87
88See @ref{Configurations}, for a list of supported configuration names and
89notes on many of the configurations. You should check the notes in that
7ec022b2 90section before proceeding any further with the installation of GCC@.
2284f91b 91
2284f91b
DE
92@end enumerate
93
73e2155a
JM
94@ifnothtml
95@node Configurations, Cross-Compiler, , Old
7ec022b2 96@section Configurations Supported by GCC
73e2155a
JM
97@end ifnothtml
98@html
7ec022b2 99<h2>@anchor{Configurations}Configurations Supported by GCC</h2>
73e2155a 100@end html
7ec022b2 101@cindex configurations supported by GCC
2284f91b
DE
102
103Here are the possible CPU types:
104
105@quotation
55383d87 106@c gmicro, fx80, spur and tahoe omitted since they don't work.
052a4b28 1071750a, a29k, alpha, arm, avr, c@var{n}, clipper, dsp16xx, elxsi, fr30, h8300,
e3223ea2 108hppa1.0, hppa1.1, i370, i386, i486, i586, i686, i786, i860, i960, ip2k, m32r,
2856c3e3
SC
109m68000, m68k, m6811, m6812, m88k, mcore, mips, mipsel, mips64, mips64el,
110mn10200, mn10300, ns32k, pdp11, powerpc, powerpcle, romp, rs6000, sh, sparc,
111sparclite, sparc64, v850, vax, we32k.
2284f91b
DE
112@end quotation
113
114Here are the recognized company names. As you can see, customary
115abbreviations are used rather than the longer official names.
116
117@c What should be done about merlin, tek*, dolphin?
118@quotation
119acorn, alliant, altos, apollo, apple, att, bull,
120cbm, convergent, convex, crds, dec, dg, dolphin,
121elxsi, encore, harris, hitachi, hp, ibm, intergraph, isi,
122mips, motorola, ncr, next, ns, omron, plexus,
123sequent, sgi, sony, sun, tti, unicom, wrs.
124@end quotation
125
126The company name is meaningful only to disambiguate when the rest of
127the information supplied is insufficient. You can omit it, writing
128just @samp{@var{cpu}-@var{system}}, if it is not needed. For example,
129@samp{vax-ultrix4.2} is equivalent to @samp{vax-dec-ultrix4.2}.
130
131Here is a list of system types:
132
133@quotation
0c82f6bf 134386bsd, aix, acis, amigaos, aos, aout, aux, bosx, bsd, clix, coff, ctix, cxux,
57119aa9
ZW
135dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms, genix, gnu, linux,
136linux-gnu, hiux, hpux, iris, irix, isc, luna, lynxos, mach, minix, msdos, mvs,
2284f91b
DE
137netbsd, newsos, nindy, ns, osf, osfrose, ptx, riscix, riscos, rtu, sco, sim,
138solaris, sunos, sym, sysv, udi, ultrix, unicos, uniplus, unos, vms, vsta,
139vxworks, winnt, xenix.
140@end quotation
141
142@noindent
143You can omit the system type; then @file{configure} guesses the
144operating system from the CPU and company.
145
146You can add a version number to the system type; this may or may not
147make a difference. For example, you can write @samp{bsd4.3} or
161d7b59 148@samp{bsd4.4} to distinguish versions of BSD@. In practice, the version
2284f91b
DE
149number is most needed for @samp{sysv3} and @samp{sysv4}, which are often
150treated differently.
151
f49957d6 152@samp{linux-gnu} is the canonical name for the GNU/Linux target; however
7ec022b2 153GCC will also accept @samp{linux}. The version of the kernel in use is
f49957d6
JL
154not relevant on these systems. A suffix such as @samp{libc1} or @samp{aout}
155distinguishes major versions of the C library; all of the suffixed versions
156are obsolete.
57119aa9 157
2284f91b
DE
158If you specify an impossible combination such as @samp{i860-dg-vms},
159then you may get an error message from @file{configure}, or it may
160ignore part of the information and do the best it can with the rest.
161@file{configure} always prints the canonical name for the alternative
7ec022b2 162that it used. GCC does not support all possible alternatives.
2284f91b
DE
163
164Often a particular model of machine has a name. Many machine names are
165recognized as aliases for CPU/company combinations. Thus, the machine
166name @samp{sun3}, mentioned above, is an alias for @samp{m68k-sun}.
167Sometimes we accept a company name as a machine name, when the name is
168popularly used for a particular machine. Here is a table of the known
169machine names:
170
171@quotation
1723300, 3b1, 3b@var{n}, 7300, altos3068, altos,
173apollo68, att-7300, balance,
174convex-c@var{n}, crds, decstation-3100,
175decstation, delta, encore,
176fx2800, gmicro, hp7@var{nn}, hp8@var{nn},
177hp9k2@var{nn}, hp9k3@var{nn}, hp9k7@var{nn},
178hp9k8@var{nn}, iris4d, iris, isi68,
179m3230, magnum, merlin, miniframe,
180mmax, news-3600, news800, news, next,
181pbd, pc532, pmax, powerpc, powerpcle, ps2, risc-news,
182rtpc, sun2, sun386i, sun386, sun3,
183sun4, symmetry, tower-32, tower.
184@end quotation
185
186@noindent
187Remember that a machine name specifies both the cpu type and the company
188name.
189If you want to install your own homemade configuration files, you can
190use @samp{local} as the company name to access them. If you use
191configuration @samp{@var{cpu}-local}, the configuration name
192without the cpu prefix
193is used to form the configuration file names.
194
195Thus, if you specify @samp{m68k-local}, configuration uses
196files @file{m68k.md}, @file{local.h}, @file{m68k.c},
197@file{xm-local.h}, @file{t-local}, and @file{x-local}, all in the
198directory @file{config/m68k}.
199
200Here is a list of configurations that have special treatment or special
201things you must know:
202
203@table @samp
2284f91b 204@item vax-dec-vms
7ec022b2 205See @ref{VMS Install}, for details on how to install GCC on VMS@.
2284f91b
DE
206@end table
207
73e2155a
JM
208@ifnothtml
209@node Cross-Compiler, VMS Install, Configurations, Old
2284f91b 210@section Building and Installing a Cross-Compiler
73e2155a
JM
211@end ifnothtml
212@html
213<h2>@anchor{Cross-Compiler}Building and Installing a Cross-Compiler</h2>
214@end html
2284f91b
DE
215@cindex cross-compiler, installation
216
7ec022b2 217GCC can function as a cross-compiler for many machines, but not all.
2284f91b
DE
218
219@itemize @bullet
220@item
221Cross-compilers for the Mips as target using the Mips assembler
222currently do not work, because the auxiliary programs
223@file{mips-tdump.c} and @file{mips-tfile.c} can't be compiled on
224anything but a Mips. It does work to cross compile for a Mips
225if you use the GNU assembler and linker.
226
227@item
228Cross-compilers between machines with different floating point formats
7ec022b2 229have not all been made to work. GCC now has a floating point
2284f91b
DE
230emulator with which these can work, but each target machine description
231needs to be updated to take advantage of it.
232
233@item
234Cross-compilation between machines of different word sizes is
235somewhat problematic and sometimes does not work.
236@end itemize
237
7ec022b2
KC
238Since GCC generates assembler code, you probably need a
239cross-assembler that GCC can run, in order to produce object files.
2284f91b
DE
240If you want to link on other than the target machine, you need a
241cross-linker as well. You also need header files and libraries suitable
242for the target machine that you can install on the host machine.
243
73e2155a 244@ifnothtml
2284f91b
DE
245@menu
246* Steps of Cross:: Using a cross-compiler involves several steps
247 that may be carried out on different machines.
248* Configure Cross:: Configuring a cross-compiler.
249* Tools and Libraries:: Where to put the linker and assembler, and the C library.
250* Cross Headers:: Finding and installing header files
251 for a cross-compiler.
2284f91b
DE
252* Build Cross:: Actually compiling the cross-compiler.
253@end menu
73e2155a 254@end ifnothtml
2284f91b 255
73e2155a
JM
256@ifnothtml
257@node Steps of Cross, Configure Cross, , Cross-Compiler
2284f91b 258@subsection Steps of Cross-Compilation
73e2155a
JM
259@end ifnothtml
260@html
261<h2>Steps of Cross-Compilation</h2>
262@end html
2284f91b
DE
263
264To compile and run a program using a cross-compiler involves several
265steps:
266
267@itemize @bullet
268@item
269Run the cross-compiler on the host machine to produce assembler files
270for the target machine. This requires header files for the target
271machine.
272
273@item
274Assemble the files produced by the cross-compiler. You can do this
275either with an assembler on the target machine, or with a
276cross-assembler on the host machine.
277
278@item
279Link those files to make an executable. You can do this either with a
280linker on the target machine, or with a cross-linker on the host
281machine. Whichever machine you use, you need libraries and certain
282startup files (typically @file{crt@dots{}.o}) for the target machine.
283@end itemize
284
285It is most convenient to do all of these steps on the same host machine,
7ec022b2 286since then you can do it all with a single invocation of GCC@. This
2284f91b
DE
287requires a suitable cross-assembler and cross-linker. For some targets,
288the GNU assembler and linker are available.
289
73e2155a
JM
290@ifnothtml
291@node Configure Cross, Tools and Libraries, Steps of Cross, Cross-Compiler
2284f91b 292@subsection Configuring a Cross-Compiler
73e2155a
JM
293@end ifnothtml
294@html
295<h2>Configuring a Cross-Compiler</h2>
296@end html
2284f91b 297
7ec022b2 298To build GCC as a cross-compiler, you start out by running
630d3d5a 299@file{configure}. Use the @option{--target=@var{target}} to specify the
2284f91b 300target type. If @file{configure} was unable to correctly identify the
630d3d5a 301system you are running on, also specify the @option{--build=@var{build}}
2284f91b
DE
302option. For example, here is how to configure for a cross-compiler that
303produces code for an HP 68030 system running BSD on a system that
304@file{configure} can correctly identify:
305
306@smallexample
307./configure --target=m68k-hp-bsd4.3
308@end smallexample
309
73e2155a
JM
310@ifnothtml
311@node Tools and Libraries, Cross Headers, Configure Cross, Cross-Compiler
2284f91b 312@subsection Tools and Libraries for a Cross-Compiler
73e2155a
JM
313@end ifnothtml
314@html
315<h2>Tools and Libraries for a Cross-Compiler</h2>
316@end html
2284f91b
DE
317
318If you have a cross-assembler and cross-linker available, you should
319install them now. Put them in the directory
320@file{/usr/local/@var{target}/bin}. Here is a table of the tools
321you should put in this directory:
322
323@table @file
324@item as
325This should be the cross-assembler.
326
327@item ld
328This should be the cross-linker.
329
330@item ar
331This should be the cross-archiver: a program which can manipulate
332archive files (linker libraries) in the target machine's format.
333
334@item ranlib
335This should be a program to construct a symbol table in an archive file.
336@end table
337
7ec022b2 338The installation of GCC will find these programs in that directory,
2284f91b
DE
339and copy or link them to the proper place to for the cross-compiler to
340find them when run later.
341
342The easiest way to provide these files is to build the Binutils package
161d7b59 343and GAS@. Configure them with the same @option{--host} and @option{--target}
7ec022b2 344options that you use for configuring GCC, then build and install
2284f91b 345them. They install their executables automatically into the proper
7ec022b2 346directory. Alas, they do not support all the targets that GCC
2284f91b
DE
347supports.
348
349If you want to install libraries to use with the cross-compiler, such as
350a standard C library, put them in the directory
7ec022b2
KC
351@file{/usr/local/@var{target}/lib}; installation of GCC copies
352all the files in that subdirectory into the proper place for GCC to
2284f91b
DE
353find them and link with them. Here's an example of copying some
354libraries from a target machine:
355
356@example
357ftp @var{target-machine}
358lcd /usr/local/@var{target}/lib
359cd /lib
360get libc.a
361cd /usr/lib
362get libg.a
363get libm.a
364quit
365@end example
366
367@noindent
368The precise set of libraries you'll need, and their locations on
369the target machine, vary depending on its operating system.
370
371@cindex start files
372Many targets require ``start files'' such as @file{crt0.o} and
373@file{crtn.o} which are linked into each executable; these too should be
374placed in @file{/usr/local/@var{target}/lib}. There may be several
375alternatives for @file{crt0.o}, for use with profiling or other
376compilation options. Check your target's definition of
377@code{STARTFILE_SPEC} to find out what start files it uses.
378Here's an example of copying these files from a target machine:
379
380@example
381ftp @var{target-machine}
382lcd /usr/local/@var{target}/lib
383prompt
384cd /lib
385mget *crt*.o
386cd /usr/lib
387mget *crt*.o
388quit
389@end example
390
73e2155a
JM
391@ifnothtml
392@node Cross Headers, Build Cross, Tools and Libraries, Cross-Compiler
2284f91b 393@subsection Cross-Compilers and Header Files
73e2155a
JM
394@end ifnothtml
395@html
396<h2>Cross-Compilers and Header Files</h2>
397@end html
2284f91b
DE
398
399If you are cross-compiling a standalone program or a program for an
400embedded system, then you may not need any header files except the few
7ec022b2 401that are part of GCC (and those of your program). However, if you
2284f91b
DE
402intend to link your program with a standard C library such as
403@file{libc.a}, then you probably need to compile with the header files
404that go with the library you use.
405
406The GNU C compiler does not come with these files, because (1) they are
407system-specific, and (2) they belong in a C library, not in a compiler.
408
409If the GNU C library supports your target machine, then you can get the
410header files from there (assuming you actually use the GNU library when
411you link your program).
412
413If your target machine comes with a C compiler, it probably comes with
414suitable header files also. If you make these files accessible from the host
415machine, the cross-compiler can use them also.
416
417Otherwise, you're on your own in finding header files to use when
418cross-compiling.
419
9c34dbbf
ZW
420When you have found suitable header files, you should put them in the
421directory @file{/usr/local/@var{target}/include}, before building the
422cross compiler. Then installation will run fixincludes properly and
423install the corrected versions of the header files where the compiler
424will use them.
2284f91b
DE
425
426Provide the header files before you build the cross-compiler, because
427the build stage actually runs the cross-compiler to produce parts of
428@file{libgcc.a}. (These are the parts that @emph{can} be compiled with
7ec022b2 429GCC@.) Some of them need suitable header files.
2284f91b
DE
430
431Here's an example showing how to copy the header files from a target
432machine. On the target machine, do this:
433
434@example
435(cd /usr/include; tar cf - .) > tarfile
436@end example
437
438Then, on the host machine, do this:
439
440@example
441ftp @var{target-machine}
442lcd /usr/local/@var{target}/include
443get tarfile
444quit
445tar xf tarfile
446@end example
447
73e2155a
JM
448@ifnothtml
449@node Build Cross, , Cross Headers, Cross-Compiler
2284f91b 450@subsection Actually Building the Cross-Compiler
73e2155a
JM
451@end ifnothtml
452@html
453<h2>Actually Building the Cross-Compiler</h2>
454@end html
2284f91b
DE
455
456Now you can proceed just as for compiling a single-machine compiler
7857f134
ZW
457through the step of building stage 1.
458
2284f91b 459Do not try to build stage 2 for a cross-compiler. It doesn't work to
7ec022b2 460rebuild GCC as a cross-compiler using the cross-compiler, because
2284f91b
DE
461that would produce a program that runs on the target machine, not on the
462host. For example, if you compile a 386-to-68030 cross-compiler with
463itself, the result will not be right either for the 386 (because it was
464compiled into 68030 code) or for the 68030 (because it was configured
7ec022b2 465for a 386 as the host). If you want to compile GCC into 68030 code,
2284f91b
DE
466whether you compile it on a 68030 or with a cross-compiler on a 386, you
467must specify a 68030 as the host when you configure it.
468
469To install the cross-compiler, use @samp{make install}, as usual.
470
73e2155a
JM
471@ifnothtml
472@node VMS Install, , Cross-Compiler, Old
7ec022b2 473@section Installing GCC on VMS
73e2155a
JM
474@end ifnothtml
475@html
7ec022b2 476<h2>@anchor{VMS Install}Installing GCC on VMS</h2>
73e2155a 477@end html
2284f91b 478@cindex VMS installation
7ec022b2 479@cindex installing GCC on VMS
2284f91b 480
7ec022b2 481The VMS version of GCC is distributed in a backup saveset containing
2284f91b
DE
482both source code and precompiled binaries.
483
484To install the @file{gcc} command so you can use the compiler easily, in
485the same manner as you use the VMS C compiler, you must install the VMS CLD
7ec022b2 486file for GCC as follows:
2284f91b
DE
487
488@enumerate
489@item
490Define the VMS logical names @samp{GNU_CC} and @samp{GNU_CC_INCLUDE}
7ec022b2 491to point to the directories where the GCC executables
2284f91b 492(@file{gcc-cpp.exe}, @file{gcc-cc1.exe}, etc.) and the C include files are
bd819a4a 493kept respectively. This should be done with the commands:
2284f91b
DE
494
495@smallexample
496$ assign /system /translation=concealed -
497 disk:[gcc.] gnu_cc
498$ assign /system /translation=concealed -
499 disk:[gcc.include.] gnu_cc_include
500@end smallexample
501
502@noindent
503with the appropriate disk and directory names. These commands can be
504placed in your system startup file so they will be executed whenever
505the machine is rebooted. You may, if you choose, do this via the
506@file{GCC_INSTALL.COM} script in the @file{[GCC]} directory.
507
508@item
509Install the @file{GCC} command with the command line:
510
511@smallexample
512$ set command /table=sys$common:[syslib]dcltables -
513 /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
514$ install replace sys$common:[syslib]dcltables
515@end smallexample
516
517@item
518To install the help file, do the following:
519
520@smallexample
521$ library/help sys$library:helplib.hlb gcc.hlp
522@end smallexample
523
524@noindent
525Now you can invoke the compiler with a command like @samp{gcc /verbose
526file.c}, which is equivalent to the command @samp{gcc -v -c file.c} in
527Unix.
528@end enumerate
529
7ec022b2 530If you wish to use GNU C++ you must first install GCC, and then
2284f91b
DE
531perform the following steps:
532
533@enumerate
534@item
535Define the VMS logical name @samp{GNU_GXX_INCLUDE} to point to the
536directory where the preprocessor will search for the C++ header files.
bd819a4a 537This can be done with the command:
2284f91b
DE
538
539@smallexample
540$ assign /system /translation=concealed -
541 disk:[gcc.gxx_include.] gnu_gxx_include
542@end smallexample
543
544@noindent
545with the appropriate disk and directory name. If you are going to be
c85f7c16
JL
546using a C++ runtime library, this is where its install procedure will install
547its header files.
2284f91b
DE
548
549@item
550Obtain the file @file{gcc-cc1plus.exe}, and place this in the same
551directory that @file{gcc-cc1.exe} is kept.
552
553The GNU C++ compiler can be invoked with a command like @samp{gcc /plus
554/verbose file.cc}, which is equivalent to the command @samp{g++ -v -c
555file.cc} in Unix.
556@end enumerate
557
558We try to put corresponding binaries and sources on the VMS distribution
559tape. But sometimes the binaries will be from an older version than the
560sources, because we don't always have time to update them. (Use the
561@samp{/version} option to determine the version number of the binaries and
562compare it with the source file @file{version.c} to tell whether this is
563so.) In this case, you should use the binaries you get to recompile the
564sources. If you must recompile, here is how:
565
566@enumerate
567@item
568Execute the command procedure @file{vmsconfig.com} to set up the files
569@file{tm.h}, @file{config.h}, @file{aux-output.c}, and @file{md.}, and
4977bab6 570to create files @file{tconfig.h} and @file{bconfig.h}. This procedure
2284f91b 571also creates several linker option files used by @file{make-cc1.com} and
bd819a4a 572a data file used by @file{make-l2.com}.
2284f91b
DE
573
574@smallexample
575$ @@vmsconfig.com
576@end smallexample
577
578@item
579Setup the logical names and command tables as defined above. In
580addition, define the VMS logical name @samp{GNU_BISON} to point at the
581to the directories where the Bison executable is kept. This should be
bd819a4a 582done with the command:
2284f91b
DE
583
584@smallexample
585$ assign /system /translation=concealed -
586 disk:[bison.] gnu_bison
587@end smallexample
588
589You may, if you choose, use the @file{INSTALL_BISON.COM} script in the
590@file{[BISON]} directory.
591
592@item
bd819a4a 593Install the @samp{BISON} command with the command line:
2284f91b
DE
594
595@smallexample
596$ set command /table=sys$common:[syslib]dcltables -
597 /output=sys$common:[syslib]dcltables -
598 gnu_bison:[000000]bison
599$ install replace sys$common:[syslib]dcltables
600@end smallexample
601
602@item
9c34dbbf
ZW
603Type @samp{@@make-gcc} to recompile everything, or submit the file
604@file{make-gcc.com} to a batch queue. If you wish to build the GNU C++
7ec022b2 605compiler as well as the GCC compiler, you must first edit
2284f91b 606@file{make-gcc.com} and follow the instructions that appear in the
bd819a4a 607comments.
2284f91b
DE
608
609@item
610In order to use GCC, you need a library of functions which GCC compiled code
611will call to perform certain tasks, and these functions are defined in the
612file @file{libgcc2.c}. To compile this you should use the command procedure
613@file{make-l2.com}, which will generate the library @file{libgcc2.olb}.
614@file{libgcc2.olb} should be built using the compiler built from
615the same distribution that @file{libgcc2.c} came from, and
616@file{make-gcc.com} will automatically do all of this for you.
617
bd819a4a 618To install the library, use the following commands:
2284f91b
DE
619
620@smallexample
621$ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
622$ library gnu_cc:[000000]gcclib/delete=L_*
623$ library libgcc2/extract=*/output=libgcc2.obj
624$ library gnu_cc:[000000]gcclib libgcc2.obj
625@end smallexample
626
627The first command simply removes old modules that will be replaced with
628modules from @file{libgcc2} under different module names. The modules
629@code{new} and @code{eprintf} may not actually be present in your
630@file{gcclib.olb}---if the VMS librarian complains about those modules
631not being present, simply ignore the message and continue on with the
632next command. The second command removes the modules that came from the
633previous version of the library @file{libgcc2.c}.
634
635Whenever you update the compiler on your system, you should also update the
636library with the above procedure.
637
638@item
639You may wish to build GCC in such a way that no files are written to the
640directory where the source files reside. An example would be the when
641the source files are on a read-only disk. In these cases, execute the
642following DCL commands (substituting your actual path names):
643
644@smallexample
645$ assign dua0:[gcc.build_dir.]/translation=concealed, -
646 dua1:[gcc.source_dir.]/translation=concealed gcc_build
647$ set default gcc_build:[000000]
648@end smallexample
649
650@noindent
651where the directory @file{dua1:[gcc.source_dir]} contains the source
652code, and the directory @file{dua0:[gcc.build_dir]} is meant to contain
653all of the generated object files and executables. Once you have done
654this, you can proceed building GCC as described above. (Keep in mind
655that @file{gcc_build} is a rooted logical name, and thus the device
656names in each element of the search list must be an actual physical
657device name rather than another rooted logical name).
658
659@item
7ec022b2 660@strong{If you are building GCC with a previous version of GCC,
2284f91b 661you also should check to see that you have the newest version of the
7ec022b2
KC
662assembler}. In particular, GCC version 2 treats global constant
663variables slightly differently from GCC version 1, and GAS version
2284f91b
DE
6641.38.1 does not have the patches required to work with GCC version 2.
665If you use GAS 1.38.1, then @code{extern const} variables will not have
666the read-only bit set, and the linker will generate warning messages
667about mismatched psect attributes for these variables. These warning
668messages are merely a nuisance, and can safely be ignored.
669
2284f91b 670@item
7ec022b2 671If you want to build GCC with the VAX C compiler, you will need to
2284f91b
DE
672make minor changes in @file{make-cccp.com} and @file{make-cc1.com}
673to choose alternate definitions of @code{CC}, @code{CFLAGS}, and
674@code{LIBS}. See comments in those files. However, you must
675also have a working version of the GNU assembler (GNU as, aka GAS) as
7ec022b2
KC
676it is used as the back end for GCC to produce binary object modules
677and is not included in the GCC sources. GAS is also needed to
2284f91b
DE
678compile @file{libgcc2} in order to build @file{gcclib} (see above);
679@file{make-l2.com} expects to be able to find it operational in
680@file{gnu_cc:[000000]gnu-as.exe}.
681
7ec022b2 682To use GCC on VMS, you need the VMS driver programs
2284f91b
DE
683@file{gcc.exe}, @file{gcc.com}, and @file{gcc.cld}. They are
684distributed with the VMS binaries (@file{gcc-vms}) rather than the
7ec022b2 685GCC sources. GAS is also included in @file{gcc-vms}, as is Bison.
2284f91b 686
7ec022b2 687Once you have successfully built GCC with VAX C, you should use the
2284f91b
DE
688resulting compiler to rebuild itself. Before doing this, be sure to
689restore the @code{CC}, @code{CFLAGS}, and @code{LIBS} definitions in
690@file{make-cccp.com} and @file{make-cc1.com}. The second generation
691compiler will be able to take advantage of many optimizations that must
692be suppressed when building with other compilers.
693@end enumerate
694
7ec022b2 695Under previous versions of GCC, the generated code would occasionally
2284f91b
DE
696give strange results when linked with the sharable @file{VAXCRTL} library.
697Now this should work.
698
7ec022b2 699Even with this version, however, GCC itself should not be linked with
2284f91b
DE
700the sharable @file{VAXCRTL}. The version of @code{qsort} in
701@file{VAXCRTL} has a bug (known to be present in VMS versions V4.6
702through V5.5) which causes the compiler to fail.
703
704The executables are generated by @file{make-cc1.com} and
705@file{make-cccp.com} use the object library version of @file{VAXCRTL} in
706order to make use of the @code{qsort} routine in @file{gcclib.olb}. If
707you wish to link the compiler executables with the shareable image
708version of @file{VAXCRTL}, you should edit the file @file{tm.h} (created
709by @file{vmsconfig.com}) to define the macro @code{QSORT_WORKAROUND}.
710
7ec022b2 711@code{QSORT_WORKAROUND} is always defined when GCC is compiled with
2284f91b
DE
712VAX C, to avoid a problem in case @file{gcclib.olb} is not yet
713available.