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