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