]> gcc.gnu.org Git - gcc.git/blob - gcc/f/INSTALL
Initial revision
[gcc.git] / gcc / f / INSTALL
1 This file contains installation information for the GNU Fortran
2 compiler. Copyright (C) 1995, 1996 Free Software Foundation, Inc. You
3 may copy, distribute, and modify it freely as long as you preserve this
4 copyright notice and permission notice.
5
6 Installing GNU Fortran
7 **********************
8
9 The following information describes how to install `g77'.
10
11 The information in this file generally pertains to dealing with
12 *source* distributions of `g77' and `gcc'. It is possible that some of
13 this information will be applicable to some *binary* distributions of
14 these products--however, since these distributions are not made by the
15 maintainers of `g77', responsibility for binary distributions rests with
16 whoever built and first distributed them.
17
18 Nevertheless, efforts to make `g77' easier to both build and install
19 from source and package up as a binary distribution are ongoing.
20
21 Prerequisites
22 =============
23
24 The procedures described to unpack, configure, build, and install
25 `g77' assume your system has certain programs already installed.
26
27 The following prerequisites should be met by your system before you
28 follow the `g77' installation instructions:
29
30 `gzip'
31 To unpack the `gcc' and `g77' distributions, you'll need the
32 `gunzip' utility in the `gzip' distribution. Most UNIX systems
33 already have `gzip' installed. If yours doesn't, you can get it
34 from the FSF.
35
36 Note that you'll need `tar' and other utilities as well, but all
37 UNIX systems have these. There are GNU versions of all these
38 available--in fact, a complete GNU UNIX system can be put together
39 on most systems, if desired.
40
41 `gcc-2.7.2.2.tar.gz'
42 You need to have this, or some other applicable, version of `gcc'
43 on your system. The version should be an exact copy of a
44 distribution from the FSF. It is approximately 7MB large.
45
46 If you've already unpacked `gcc-2.7.2.2.tar.gz' into a directory
47 (named `gcc-2.7.2.2') called the "source tree" for `gcc', you can
48 delete the distribution itself, but you'll need to remember to
49 skip any instructions to unpack this distribution.
50
51 Without an applicable `gcc' source tree, you cannot build `g77'.
52 You can obtain an FSF distribution of `gcc' from the FSF.
53
54 `g77-0.5.21.tar.gz'
55 You probably have already unpacked this distribution, or you are
56 reading an advanced copy of this manual, which is contained in
57 this distribution. This distribution approximately 1MB large.
58
59 You can obtain an FSF distribution of `g77' from the FSF, the same
60 way you obtained `gcc'.
61
62 100MB disk space
63 For a complete "bootstrap" build, about 100MB of disk space is
64 required for `g77' by the author's current GNU/Linux system.
65
66 Some juggling can reduce the amount of space needed; during the
67 bootstrap process, once Stage 3 starts, during which the version
68 of `gcc' that has been copied into the `stage2/' directory is used
69 to rebuild the system, you can delete the `stage1/' directory to
70 free up some space.
71
72 It is likely that many systems don't require the complete
73 bootstrap build, as they already have a recent version of `gcc'
74 installed. Such systems might be able to build `g77' with only
75 about 75MB of free space.
76
77 `patch'
78 Although you can do everything `patch' does yourself, by hand,
79 without much trouble, having `patch' installed makes installation
80 of new versions of GNU utilities such as `g77' so much easier that
81 it is worth getting. You can obtain `patch' the same way you
82 obtained `gcc' and `g77'.
83
84 In any case, you can apply patches by hand--patch files are
85 designed for humans to read them.
86
87 `make'
88 Your system must have `make', and you will probably save yourself
89 a lot of trouble if it is GNU `make' (sometimes referred to as
90 `gmake').
91
92 `cc'
93 Your system must have a working C compiler.
94
95 *Note Installing GNU CC: (gcc)Installation, for more information
96 on prerequisites for installing `gcc'.
97
98 `bison'
99 If you do not have `bison' installed, you can usually work around
100 any need for it, since `g77' itself does not use it, and `gcc'
101 normally includes all files generated by running it in its
102 distribution. You can obtain `bison' the same way you obtained
103 `gcc' and `g77'.
104
105 *Note Missing bison?::, for information on how to work around not
106 having `bison'.
107
108 `makeinfo'
109 If you are missing `makeinfo', you can usually work around any
110 need for it. You can obtain `makeinfo' the same way you obtained
111 `gcc' and `g77'.
112
113 *Note Missing makeinfo?::, for information on getting around the
114 lack of `makeinfo'.
115
116 `root' access
117 To perform the complete installation procedures on a system, you
118 need to have `root' access to that system, or equivalent access.
119
120 Portions of the procedure (such as configuring and building `g77')
121 can be performed by any user with enough disk space and virtual
122 memory.
123
124 However, these instructions are oriented towards less-experienced
125 users who want to install `g77' on their own personal systems.
126
127 System administrators with more experience will want to determine
128 for themselves how they want to modify the procedures described
129 below to suit the needs of their installation.
130
131 Problems Installing
132 ===================
133
134 This is a list of problems (and some apparent problems which don't
135 really mean anything is wrong) that show up when configuring, building,
136 installing, or porting GNU Fortran.
137
138 *Note Installation Problems: (gcc)Installation Problems, for more
139 information on installation problems that can afflict either `gcc' or
140 `g77'.
141
142 General Problems
143 ----------------
144
145 These problems can occur on most or all systems.
146
147 GNU C Required
148 ..............
149
150 Compiling `g77' requires GNU C, not just ANSI C. Fixing this
151 wouldn't be very hard (just tedious), but the code using GNU extensions
152 to the C language is expected to be rewritten for 0.6 anyway, so there
153 are no plans for an interim fix.
154
155 This requirement does not mean you must already have `gcc' installed
156 to build `g77'. As long as you have a working C compiler, you can use a
157 bootstrap build to automate the process of first building `gcc' using
158 the working C compiler you have, then building `g77' and rebuilding
159 `gcc' using that just-built `gcc', and so on.
160
161 Patching GNU CC Necessary
162 .........................
163
164 `g77' currently requires application of a patch file to the gcc
165 compiler tree. The necessary patches should be folded in to the
166 mainline gcc distribution.
167
168 Some combinations of versions of `g77' and `gcc' might actually
169 *require* no patches, but the patch files will be provided anyway as
170 long as there are more changes expected in subsequent releases. These
171 patch files might contain unnecessary, but possibly helpful, patches.
172 As a result, it is possible this issue might never be resolved, except
173 by eliminating the need for the person configuring `g77' to apply a
174 patch by hand, by going to a more automated approach (such as
175 configure-time patching).
176
177 Building GNU CC Necessary
178 .........................
179
180 It should be possible to build the runtime without building `cc1'
181 and other non-Fortran items, but, for now, an easy way to do that is
182 not yet established.
183
184 Missing strtoul
185 ...............
186
187 On SunOS4 systems, linking the `f771' program produces an error
188 message concerning an undefined symbol named `_strtoul'.
189
190 This is not a `g77' bug. *Note Patching GNU Fortran::, for
191 information on a workaround provided by `g77'.
192
193 The proper fix is either to upgrade your system to one that provides
194 a complete ANSI C environment, or improve `gcc' so that it provides one
195 for all the languages and configurations it supports.
196
197 *Note:* In earlier versions of `g77', an automated workaround for
198 this problem was attempted. It worked for systems without `_strtoul',
199 substituting the incomplete-yet-sufficient version supplied with `g77'
200 for those systems. However, the automated workaround failed
201 mysteriously for systems that appeared to have conforming ANSI C
202 environments, and it was decided that, lacking resources to more fully
203 investigate the problem, it was better to not punish users of those
204 systems either by requiring them to work around the problem by hand or
205 by always substituting an incomplete `strtoul()' implementation when
206 their systems had a complete, working one. Unfortunately, this meant
207 inconveniencing users of systems not having `strtoul()', but they're
208 using obsolete (and generally unsupported) systems anyway.
209
210 Object File Differences
211 .......................
212
213 A comparison of object files after building Stage 3 during a
214 bootstrap build will result in `gcc/f/zzz.o' being flagged as different
215 from the Stage 2 version. That is because it contains a string with an
216 expansion of the `__TIME__' macro, which expands to the current time of
217 day. It is nothing to worry about, since `gcc/f/zzz.c' doesn't contain
218 any actual code. It does allow you to override its use of `__DATE__'
219 and `__TIME__' by defining macros for the compilation--see the source
220 code for details.
221
222 Cleanup Kills Stage Directories
223 ...............................
224
225 It'd be helpful if `g77''s `Makefile.in' or `Make-lang.in' would
226 create the various `stageN' directories and their subdirectories, so
227 developers and expert installers wouldn't have to reconfigure after
228 cleaning up.
229
230 Missing `gperf'?
231 ................
232
233 If a build aborts trying to invoke `gperf', that strongly suggests
234 an improper method was used to create the `gcc' source directory, such
235 as the UNIX `cp -r' command instead of `cp -pr', since this problem
236 very likely indicates that the date-time-modified information on the
237 `gcc' source files is incorrect.
238
239 The proper solution is to recreate the `gcc' source directory from a
240 `gcc' distribution known to be provided by the FSF.
241
242 It is possible you might be able to temporarily work around the
243 problem, however, by trying these commands:
244
245 sh# cd gcc
246 sh# touch c-gperf.h
247 sh#
248
249 These commands update the date-time-modified information for the
250 file produced by the invocation of `gperf' in the current versions of
251 `gcc', so that `make' no longer believes it needs to update it. This
252 file should already exist in a `gcc' distribution, but mistakes made
253 when copying the `gcc' directory can leave the modification information
254 set such that the `gperf' input files look more "recent" than the
255 corresponding output files.
256
257 If the above does not work, definitely start from scratch and avoid
258 copying the `gcc' using any method that does not reliably preserve
259 date-time-modified information, such as the UNIX `cp -r' command.
260
261 Cross-compiler Problems
262 -----------------------
263
264 `g77' has been in alpha testing since September of 1992, and in
265 public beta testing since February of 1995. Alpha testing was done by
266 a small number of people worldwide on a fairly wide variety of
267 machines, involving self-compilation in most or all cases. Beta
268 testing has been done primarily via self-compilation, but in more and
269 more cases, cross-compilation (and "criss-cross compilation", where a
270 version of a compiler is built on one machine to run on a second and
271 generate code that runs on a third) has been tried and has succeeded,
272 to varying extents.
273
274 Generally, `g77' can be ported to any configuration to which `gcc',
275 `f2c', and `libf2c' can be ported and made to work together, aside from
276 the known problems described in this manual. If you want to port `g77'
277 to a particular configuration, you should first make sure `gcc' and
278 `libf2c' can be ported to that configuration before focusing on `g77',
279 because `g77' is so dependent on them.
280
281 Even for cases where `gcc' and `libf2c' work, you might run into
282 problems with cross-compilation on certain machines, for several
283 reasons.
284
285 * There is one known bug (a design bug to be fixed in 0.6) that
286 prevents configuration of `g77' as a cross-compiler in some cases,
287 though there are assumptions made during configuration that
288 probably make doing non-self-hosting builds a hassle, requiring
289 manual intervention.
290
291 * `gcc' might still have some trouble being configured for certain
292 combinations of machines. For example, it might not know how to
293 handle floating-point constants.
294
295 * Improvements to the way `libf2c' is built could make building
296 `g77' as a cross-compiler easier--for example, passing and using
297 `LD' and `AR' in the appropriate ways.
298
299 * There are still some challenges putting together the right
300 run-time libraries (needed by `libf2c') for a target system,
301 depending on the systems involved in the configuration. (This is
302 a general problem with cross-compilation, and with `gcc' in
303 particular.)
304
305 Changing Settings Before Building
306 =================================
307
308 Here are some internal `g77' settings that can be changed by editing
309 source files in `gcc/f/' before building.
310
311 This information, and perhaps even these settings, represent
312 stop-gap solutions to problems people doing various ports of `g77' have
313 encountered. As such, none of the following information is expected to
314 be pertinent in future versions of `g77'.
315
316 Larger File Unit Numbers
317 ------------------------
318
319 As distributed, whether as part of `f2c' or `g77', `libf2c' accepts
320 file unit numbers only in the range 0 through 99. For example, a
321 statement such as `WRITE (UNIT=100)' causes a run-time crash in
322 `libf2c', because the unit number, 100, is out of range.
323
324 If you know that Fortran programs at your installation require the
325 use of unit numbers higher than 99, you can change the value of the
326 `MXUNIT' macro, which represents the maximum unit number, to an
327 appropriately higher value.
328
329 To do this, edit the file `f/runtime/libI77/fio.h' in your `g77'
330 source tree, changing the following line:
331
332 #define MXUNIT 100
333
334 Change the line so that the value of `MXUNIT' is defined to be at
335 least one *greater* than the maximum unit number used by the Fortran
336 programs on your system.
337
338 (For example, a program that does `WRITE (UNIT=255)' would require
339 `MXUNIT' set to at least 256 to avoid crashing.)
340
341 Then build or rebuild `g77' as appropriate.
342
343 *Note:* Changing this macro has *no* effect on other limits your
344 system might place on the number of files open at the same time. That
345 is, the macro might allow a program to do `WRITE (UNIT=100)', but the
346 library and operating system underlying `libf2c' might disallow it if
347 many other files have already been opened (via `OPEN' or implicitly via
348 `READ', `WRITE', and so on). Information on how to increase these
349 other limits should be found in your system's documentation.
350
351 Always Flush Output
352 -------------------
353
354 Some Fortran programs require output (writes) to be flushed to the
355 operating system (under UNIX, via the `fflush()' library call) so that
356 errors, such as disk full, are immediately flagged via the relevant
357 `ERR=' and `IOSTAT=' mechanism, instead of such errors being flagged
358 later as subsequent writes occur, forcing the previously written data
359 to disk, or when the file is closed.
360
361 Essentially, the difference can be viewed as synchronous error
362 reporting (immediate flagging of errors during writes) versus
363 asynchronous, or, more precisely, buffered error reporting (detection
364 of errors might be delayed).
365
366 `libf2c' supports flagging write errors immediately when it is built
367 with the `ALWAYS_FLUSH' macro defined. This results in a `libf2c' that
368 runs slower, sometimes quite a bit slower, under certain
369 circumstances--for example, accessing files via the networked file
370 system NFS--but the effect can be more reliable, robust file I/O.
371
372 If you know that Fortran programs requiring this level of precision
373 of error reporting are to be compiled using the version of `g77' you
374 are building, you might wish to modify the `g77' source tree so that
375 the version of `libf2c' is built with the `ALWAYS_FLUSH' macro defined,
376 enabling this behavior.
377
378 To do this, find this line in `f/runtime/configure.in' in your `g77'
379 source tree:
380
381 dnl AC_DEFINE(ALWAYS_FLUSH)
382
383 Remove the leading `dnl ', so the line begins with `AC_DEFINE(', and
384 run `autoconf' in that file's directory. (Or, if you don't have
385 `autoconf', you can modify `f2c.h.in' in the same directory to include
386 the line `#define ALWAYS_FLUSH' after `#define F2C_INCLUDE'.)
387
388 Then build or rebuild `g77' as appropriate.
389
390 Maximum Stackable Size
391 ----------------------
392
393 `g77', on most machines, puts many variables and arrays on the stack
394 where possible, and can be configured (by changing
395 `FFECOM_sizeMAXSTACKITEM' in `gcc/f/com.c') to force smaller-sized
396 entities into static storage (saving on stack space) or permit
397 larger-sized entities to be put on the stack (which can improve
398 run-time performance, as it presents more opportunities for the GBE to
399 optimize the generated code).
400
401 *Note:* Putting more variables and arrays on the stack might cause
402 problems due to system-dependent limits on stack size. Also, the value
403 of `FFECOM_sizeMAXSTACKITEM' has no effect on automatic variables and
404 arrays. *Note But-bugs::, for more information.
405
406 Floating-point Bit Patterns
407 ---------------------------
408
409 The `g77' build will crash if an attempt is made to build it as a
410 cross-compiler for a target when `g77' cannot reliably determine the
411 bit pattern of floating-point constants for the target. Planned
412 improvements for g77-0.6 will give it the capabilities it needs to not
413 have to crash the build but rather generate correct code for the target.
414 (Currently, `g77' would generate bad code under such circumstances if
415 it didn't crash during the build, e.g. when compiling a source file
416 that does something like `EQUIVALENCE (I,R)' and `DATA R/9.43578/'.)
417
418 Initialization of Large Aggregate Areas
419 ---------------------------------------
420
421 A warning message is issued when `g77' sees code that provides
422 initial values (e.g. via `DATA') to an aggregate area (`COMMON' or
423 `EQUIVALENCE', or even a large enough array or `CHARACTER' variable)
424 that is large enough to increase `g77''s compile time by roughly a
425 factor of 10.
426
427 This size currently is quite small, since `g77' currently has a
428 known bug requiring too much memory and time to handle such cases. In
429 `gcc/f/data.c', the macro `FFEDATA_sizeTOO_BIG_INIT_' is defined to the
430 minimum size for the warning to appear. The size is specified in
431 storage units, which can be bytes, words, or whatever, on a
432 case-by-case basis.
433
434 After changing this macro definition, you must (of course) rebuild
435 and reinstall `g77' for the change to take effect.
436
437 Note that, as of version 0.5.18, improvements have reduced the scope
438 of the problem for *sparse* initialization of large arrays, especially
439 those with large, contiguous uninitialized areas. However, the warning
440 is issued at a point prior to when `g77' knows whether the
441 initialization is sparse, and delaying the warning could mean it is
442 produced too late to be helpful.
443
444 Therefore, the macro definition should not be adjusted to reflect
445 sparse cases. Instead, adjust it to generate the warning when densely
446 initialized arrays begin to cause responses noticeably slower than
447 linear performance would suggest.
448
449 Alpha Problems Fixed
450 --------------------
451
452 `g77' used to warn when it was used to compile Fortran code for a
453 target configuration that is not basically a 32-bit machine (such as an
454 Alpha, which is a 64-bit machine, especially if it has a 64-bit
455 operating system running on it). That was because `g77' was known to
456 not work properly on such configurations.
457
458 As of version 0.5.20, `g77' is believed to work well enough on such
459 systems. So, the warning is no longer needed or provided.
460
461 However, support for 64-bit systems, especially in areas such as
462 cross-compilation and handling of intrinsics, is still incomplete. The
463 symptoms are believed to be compile-time diagnostics rather than the
464 generation of bad code. It is hoped that version 0.6 will completely
465 support 64-bit systems.
466
467 Quick Start
468 ===========
469
470 This procedure configures, builds, and installs `g77' "out of the
471 box" and works on most UNIX systems. Each command is identified by a
472 unique number, used in the explanatory text that follows. For the most
473 part, the output of each command is not shown, though indications of
474 the types of responses are given in a few cases.
475
476 To perform this procedure, the installer must be logged in as user
477 `root'. Much of it can be done while not logged in as `root', and
478 users experienced with UNIX administration should be able to modify the
479 procedure properly to do so.
480
481 Following traditional UNIX conventions, it is assumed that the
482 source trees for `g77' and `gcc' will be placed in `/usr/src'. It also
483 is assumed that the source distributions themselves already reside in
484 `/usr/FSF', a naming convention used by the author of `g77' on his own
485 system:
486
487 /usr/FSF/gcc-2.7.2.2.tar.gz
488 /usr/FSF/g77-0.5.21.tar.gz
489
490 Users of the following systems should not blindly follow these
491 quick-start instructions, because of problems their systems have coping
492 with straightforward installation of `g77':
493
494 * SunOS4
495
496 Instead, see *Note Complete Installation::, for detailed information
497 on how to configure, build, and install `g77' for your particular
498 system. Also, see *Note Known Causes of Trouble with GNU Fortran:
499 Trouble, for information on bugs and other problems known to afflict the
500 installation process, and how to report newly discovered ones.
501
502 If your system is *not* on the above list, and *is* a UNIX system or
503 one of its variants, you should be able to follow the instructions
504 below. If you vary *any* of the steps below, you might run into
505 trouble, including possibly breaking existing programs for other users
506 of your system. Before doing so, it is wise to review the explanations
507 of some of the steps. These explanations follow this list of steps.
508
509 sh[ 1]# cd /usr/src
510
511 sh[ 2]# gunzip -c < /usr/FSF/gcc-2.7.2.2.tar.gz | tar xf -
512 [Might say "Broken pipe"...that is normal on some systems.]
513
514 sh[ 3]# gunzip -c < /usr/FSF/g77-0.5.21.tar.gz | tar xf -
515 ["Broken pipe" again possible.]
516
517 sh[ 4]# ln -s gcc-2.7.2.2 gcc
518
519 sh[ 5]# ln -s g77-0.5.21 g77
520
521 sh[ 6]# mv -i g77/* gcc
522 [No questions should be asked by mv here; or, you made a mistake.]
523
524 sh[ 7]# patch -p1 -V t -d gcc < gcc/f/gbe/2.7.2.2.diff
525 [Unless patch complains about rejected patches, this step worked.]
526
527 sh[ 8]# cd gcc
528 sh[ 9]# touch f77-install-ok
529 [Do not do the above if your system already has an f77
530 command, unless you've checked that overwriting it
531 is okay.]
532
533 sh[10]# touch f2c-install-ok
534 [Do not do the above if your system already has an f2c
535 command, unless you've checked that overwriting it
536 is okay. Else, touch f2c-exists-ok.]
537
538 sh[11]# ./configure --prefix=/usr
539 [Do not do the above if gcc is not installed in /usr/bin.
540 You might need a different --prefix=..., as
541 described below.]
542
543 sh[12]# make bootstrap
544 [This takes a long time, and is where most problems occur.]
545
546 sh[13]# rm -fr stage1
547
548 sh[14]# make -k install
549 [The actual installation.]
550
551 sh[15]# g77 -v
552 [Verify that g77 is installed, obtain version info.]
553
554 sh[16]#
555
556 *Note Updating Your Info Directory: Updating Documentation, for
557 information on how to update your system's top-level `info' directory
558 to contain a reference to this manual, so that users of `g77' can
559 easily find documentation instead of having to ask you for it.
560
561 Elaborations of many of the above steps follows:
562
563 Step 1: `cd /usr/src'
564 You can build `g77' pretty much anyplace. By convention, this
565 manual assumes `/usr/src'. It might be helpful if other users on
566 your system knew where to look for the source code for the
567 installed version of `g77' and `gcc' in any case.
568
569 Step 3: `gunzip -d < /usr/FSF/g77-0.5.21.tar.gz | tar xf -'
570 It is not always necessary to obtain the latest version of `g77'
571 as a complete `.tar.gz' file if you have a complete, earlier
572 distribution of `g77'. If appropriate, you can unpack that earlier
573 version of `g77', and then apply the appropriate patches to
574 achieve the same result--a source tree containing version 0.5.21
575 of `g77'.
576
577 Step 4: `ln -s gcc-2.7.2.2 gcc'
578
579 Step 5: `ln -s g77-0.5.21 g77'
580 These commands mainly help reduce typing, and help reduce visual
581 clutter in examples in this manual showing what to type to install
582 `g77'.
583
584 *Note Unpacking::, for information on using distributions of `g77'
585 made by organizations other than the FSF.
586
587 Step 6: `mv -i g77/* gcc'
588 After doing this, you can, if you like, type `rm g77' and `rmdir
589 g77-0.5.21' to remove the empty directory and the symbol link to
590 it. But, it might be helpful to leave them around as quick
591 reminders of which version(s) of `g77' are installed on your
592 system.
593
594 *Note Unpacking::, for information on the contents of the `g77'
595 directory (as merged into the `gcc' directory).
596
597 Step 7: `patch -p1 ...'
598 This can produce a wide variety of printed output, from `Hmm, I
599 can't seem to find a patch in there anywhere...' to long lists of
600 messages indicated that patches are being found, applied
601 successfully, and so on.
602
603 If messages about "fuzz", "offset", or especially "reject files"
604 are printed, it might mean you applied the wrong patch file. If
605 you believe this is the case, it is best to restart the sequence
606 after deleting (or at least renaming to unused names) the
607 top-level directories for `g77' and `gcc' and their symbolic links.
608
609 After this command finishes, the `gcc' directory might have old
610 versions of several files as saved by `patch'. To remove these,
611 after `cd gcc', type `rm -i *.~*~'.
612
613 *Note Merging Distributions::, for more information.
614
615 Step 9: `touch f77-install-ok'
616 Don't do this if you don't want to overwrite an existing version
617 of `f77' (such as a native compiler, or a script that invokes
618 `f2c'). Otherwise, installation will overwrite the `f77' command
619 and the `f77' man pages with copies of the corresponding `g77'
620 material.
621
622 *Note Installing `f77': Installing f77, for more information.
623
624 Step 10: `touch f2c-install-ok'
625 Don't do this if you don't want to overwrite an existing
626 installation of `libf2c' (though, chances are, you do). Instead,
627 `touch f2c-exists-ok' to allow the installation to continue
628 without any error messages about `/usr/lib/libf2c.a' already
629 existing.
630
631 *Note Installing `f2c': Installing f2c, for more information.
632
633 Step 11: `./configure --prefix=/usr'
634 This is where you specify that the `g77' executable is to be
635 installed in `/usr/bin/', the `libf2c.a' library is to be
636 installed in `/usr/lib/', and so on.
637
638 You should ensure that any existing installation of the `gcc'
639 executable is in `/usr/bin/'. Otherwise, installing `g77' so that
640 it does not fully replace the existing installation of `gcc' is
641 likely to result in the inability to compile Fortran programs.
642
643 *Note Where in the World Does Fortran (and GNU CC) Go?: Where to
644 Install, for more information on determining where to install
645 `g77'. *Note Configuring gcc::, for more information on the
646 configuration process triggered by invoking the `./configure'
647 script.
648
649 Step 12: `make bootstrap'
650 *Note Installing GNU CC: (gcc)Installation, for information on the
651 kinds of diagnostics you should expect during this procedure.
652
653 *Note Building gcc::, for complete `g77'-specific information on
654 this step.
655
656 Step 13: `rm -fr stage1'
657 You don't need to do this, but it frees up disk space.
658
659 Step 14: `make -k install'
660 If this doesn't seem to work, try:
661
662 make -k install install-libf77 install-f2c-all
663
664 *Note Installation of Binaries::, for more information.
665
666 *Note Updating Your Info Directory: Updating Documentation, for
667 information on entering this manual into your system's list of
668 texinfo manuals.
669
670 Step 15: `g77 -v'
671 If this command prints approximately 25 lines of output, including
672 the GNU Fortran Front End version number (which should be the same
673 as the version number for the version of `g77' you just built and
674 installed) and the version numbers for the three parts of the
675 `libf2c' library (`libF77', `libI77', `libU77'), and those version
676 numbers are all in agreement, then there is a high likelihood that
677 the installation has been successfully completed.
678
679 You might consider doing further testing. For example, log in as
680 a non-privileged user, then create a small Fortran program, such
681 as:
682
683 PROGRAM SMTEST
684 DO 10 I=1, 10
685 PRINT *, 'Hello World #', I
686 10 CONTINUE
687 END
688
689 Compile, link, and run the above program, and, assuming you named
690 the source file `smtest.f', the session should look like this:
691
692 sh# g77 -o smtest smtest.f
693 sh# ./smtest
694 Hello World # 1
695 Hello World # 2
696 Hello World # 3
697 Hello World # 4
698 Hello World # 5
699 Hello World # 6
700 Hello World # 7
701 Hello World # 8
702 Hello World # 9
703 Hello World # 10
704 sh#
705
706 After proper installation, you don't need to keep your gcc and g77
707 source and build directories around anymore. Removing them can
708 free up a lot of disk space.
709
710 Complete Installation
711 =====================
712
713 Here is the complete `g77'-specific information on how to configure,
714 build, and install `g77'.
715
716 Unpacking
717 ---------
718
719 The `gcc' source distribution is a stand-alone distribution. It is
720 designed to be unpacked (producing the `gcc' source tree) and built as
721 is, assuming certain prerequisites are met (including the availability
722 of compatible UNIX programs such as `make', `cc', and so on).
723
724 However, before building `gcc', you will want to unpack and merge
725 the `g77' distribution in with it, so that you build a Fortran-capable
726 version of `gcc', which includes the `g77' command, the necessary
727 run-time libraries, and this manual.
728
729 Unlike `gcc', the `g77' source distribution is *not* a stand-alone
730 distribution. It is designed to be unpacked and, afterwards,
731 immediately merged into an applicable `gcc' source tree. That is, the
732 `g77' distribution *augments* a `gcc' distribution--without `gcc',
733 generally only the documentation is immediately usable.
734
735 A sequence of commands typically used to unpack `gcc' and `g77' is:
736
737 sh# cd /usr/src
738 sh# gunzip -d < /usr/FSF/gcc-2.7.2.2.tar.gz | tar xf -
739 sh# gunzip -d < /usr/FSF/g77-0.5.21.tar.gz | tar xf -
740 sh# ln -s gcc-2.7.2.2 gcc
741 sh# ln -s g77-0.5.21 g77
742 sh# mv -i g77/* gcc
743
744 *Notes:* The commands beginning with `gunzip...' might print `Broken
745 pipe...' as they complete. That is nothing to worry about, unless you
746 actually *hear* a pipe breaking. The `ln' commands are helpful in
747 reducing typing and clutter in installation examples in this manual.
748 Hereafter, the top level of `gcc' source tree is referred to as `gcc',
749 and the top level of just the `g77' source tree (prior to issuing the
750 `mv' command, above) is referred to as `g77'.
751
752 There are three top-level names in a `g77' distribution:
753
754 g77/COPYING.g77
755 g77/README.g77
756 g77/f
757
758 All three entries should be moved (or copied) into a `gcc' source
759 tree (typically named after its version number and as it appears in the
760 FSF distributions--e.g. `gcc-2.7.2.2').
761
762 `g77/f' is the subdirectory containing all of the code,
763 documentation, and other information that is specific to `g77'. The
764 other two files exist to provide information on `g77' to someone
765 encountering a `gcc' source tree with `g77' already present, who has
766 not yet read these installation instructions and thus needs help
767 understanding that the source tree they are looking at does not come
768 from a single FSF distribution. They also help people encountering an
769 unmerged `g77' source tree for the first time.
770
771 *Note:* Please use *only* `gcc' and `g77' source trees as
772 distributed by the FSF. Use of modified versions, such as the
773 Pentium-specific-optimization port of `gcc', is likely to result in
774 problems that appear to be in the `g77' code but, in fact, are not. Do
775 not use such modified versions unless you understand all the
776 differences between them and the versions the FSF distributes--in which
777 case you should be able to modify the `g77' (or `gcc') source trees
778 appropriately so `g77' and `gcc' can coexist as they do in the stock
779 FSF distributions.
780
781 Merging Distributions
782 ---------------------
783
784 After merging the `g77' source tree into the `gcc' source tree, the
785 final merge step is done by applying the pertinent patches the `g77'
786 distribution provides for the `gcc' source tree.
787
788 Read the file `gcc/f/gbe/README', and apply the appropriate patch
789 file for the version of the GNU CC compiler you have, if that exists.
790 If the directory exists but the appropriate file does not exist, you
791 are using either an old, unsupported version, or a release one that is
792 newer than the newest `gcc' version supported by the version of `g77'
793 you have.
794
795 As of version 0.5.18, `g77' modifies the version number of `gcc' via
796 the pertinent patches. This is done because the resulting version of
797 `gcc' is deemed sufficiently different from the vanilla distribution to
798 make it worthwhile to present, to the user, information signaling the
799 fact that there are some differences.
800
801 GNU version numbers make it easy to figure out whether a particular
802 version of a distribution is newer or older than some other version of
803 that distribution. The format is, generally, MAJOR.MINOR.PATCH, with
804 each field being a decimal number. (You can safely ignore leading
805 zeros; for example, 1.5.3 is the same as 1.5.03.) The MAJOR field only
806 increases with time. The other two fields are reset to 0 when the
807 field to their left is incremented; otherwise, they, too, only increase
808 with time. So, version 2.6.2 is newer than version 2.5.8, and version
809 3.0 is newer than both. (Trailing `.0' fields often are omitted in
810 announcements and in names for distributions and the directories they
811 create.)
812
813 If your version of `gcc' is older than the oldest version supported
814 by `g77' (as casually determined by listing the contents of
815 `gcc/f/gbe/'), you should obtain a newer, supported version of `gcc'.
816 (You could instead obtain an older version of `g77', or try and get
817 your `g77' to work with the old `gcc', but neither approach is
818 recommended, and you shouldn't bother reporting any bugs you find if you
819 take either approach, because they're probably already fixed in the
820 newer versions you're not using.)
821
822 If your version of `gcc' is newer than the newest version supported
823 by `g77', it is possible that your `g77' will work with it anyway. If
824 the version number for `gcc' differs only in the PATCH field, you might
825 as well try applying the `g77' patch that is for the newest version of
826 `gcc' having the same MAJOR and MINOR fields, as this is likely to work.
827
828 So, for example, if a particular version of `g77' has support for
829 `gcc' versions 2.7.0 and 2.7.1, it is likely that `gcc-2.7.2' would
830 work well with `g77' by using the `2.7.1.diff' patch file provided with
831 `g77' (aside from some offsets reported by `patch', which usually are
832 harmless).
833
834 However, `gcc-2.8.0' would almost certainly not work with that
835 version of `g77' no matter which patch file was used, so a new version
836 of `g77' would be needed (and you should wait for it rather than
837 bothering the maintainers--*note User-Visible Changes: Changes.).
838
839 This complexity is the result of `gcc' and `g77' being separate
840 distributions. By keeping them separate, each product is able to be
841 independently improved and distributed to its user base more frequently.
842
843 However, `g77' often requires changes to contemporary versions of
844 `gcc'. Also, the GBE interface defined by `gcc' typically undergoes
845 some incompatible changes at least every time the MINOR field of the
846 version number is incremented, and such changes require corresponding
847 changes to the `g77' front end (FFE).
848
849 It is hoped that the GBE interface, and the `gcc' and `g77' products
850 in general, will stabilize sufficiently for the need for hand-patching
851 to disappear.
852
853 Invoking `patch' as described in `gcc/f/gbe/README' can produce a
854 wide variety of printed output, from `Hmm, I can't seem to find a patch
855 in there anywhere...' to long lists of messages indicated that patches
856 are being found, applied successfully, and so on.
857
858 If messages about "fuzz", "offset", or especially "reject files" are
859 printed, it might mean you applied the wrong patch file. If you
860 believe this is the case, it is best to restart the sequence after
861 deleting (or at least renaming to unused names) the top-level
862 directories for `g77' and `gcc' and their symbolic links. That is
863 because `patch' might have partially patched some `gcc' source files,
864 so reapplying the correct patch file might result in the correct
865 patches being applied incorrectly (due to the way `patch' necessarily
866 works).
867
868 After `patch' finishes, the `gcc' directory might have old versions
869 of several files as saved by `patch'. To remove these, after `cd gcc',
870 type `rm -i *.~*~'.
871
872 *Note:* `g77''s configuration file `gcc/f/config-lang.in' ensures
873 that the source code for the version of `gcc' being configured has at
874 least one indication of being patched as required specifically by `g77'.
875 This configuration-time checking should catch failure to apply the
876 correct patch and, if so caught, should abort the configuration with an
877 explanation. *Please* do not try to disable the check, otherwise `g77'
878 might well appear to build and install correctly, and even appear to
879 compile correctly, but could easily produce broken code.
880
881 `diff -rcp2N' is used to create the patch files in `gcc/f/gbe/'.
882
883 Installing `f77'
884 ----------------
885
886 You should decide whether you want installation of `g77' to also
887 install an `f77' command. On systems with a native `f77', this is not
888 normally desired, so `g77' does not do this by default.
889
890 If you want `f77' installed, create the file `f77-install-ok' (e.g.
891 via the UNIX command `touch f77-install-ok') in the source or build
892 top-level directory (the same directory in which the `g77' `f'
893 directory resides, not the `f' directory itself), or edit
894 `gcc/f/Make-lang.in' and change the definition of the
895 `F77_INSTALL_FLAG' macro appropriately.
896
897 Usually, this means that, after typing `cd gcc', you would type
898 `touch f77-install-ok'.
899
900 When you enable installation of `f77', either a link to or a direct
901 copy of the `g77' command is made. Similarly, `f77.1' is installed as
902 a man page.
903
904 (The `uninstall' target in the `gcc/Makefile' also tests this macro
905 and file, when invoked, to determine whether to delete the installed
906 copies of `f77' and `f77.1'.)
907
908 *Note:* No attempt is yet made to install a program (like a shell
909 script) that provides compatibility with any other `f77' programs.
910 Only the most rudimentary invocations of `f77' will work the same way
911 with `g77'.
912
913 Installing `f2c'
914 ----------------
915
916 Currently, `g77' does not include `f2c' itself in its distribution.
917 However, it does include a modified version of the `libf2c'. This
918 version is normally compatible with `f2c', but has been modified to
919 meet the needs of `g77' in ways that might possibly be incompatible
920 with some versions or configurations of `f2c'.
921
922 Decide how installation of `g77' should affect any existing
923 installation of `f2c' on your system.
924
925 If you do not have `f2c' on your system (e.g. no `/usr/bin/f2c', no
926 `/usr/include/f2c.h', and no `/usr/lib/libf2c.a', `/usr/lib/libF77.a',
927 or `/usr/lib/libI77.a'), you don't need to be concerned with this item.
928
929 If you do have `f2c' on your system, you need to decide how users of
930 `f2c' will be affected by your installing `g77'. Since `g77' is
931 currently designed to be object-code-compatible with `f2c' (with very
932 few, clear exceptions), users of `f2c' might want to combine
933 `f2c'-compiled object files with `g77'-compiled object files in a
934 single executable.
935
936 To do this, users of `f2c' should use the same copies of `f2c.h' and
937 `libf2c.a' that `g77' uses (and that get built as part of `g77').
938
939 If you do nothing here, the `g77' installation process will not
940 overwrite the `include/f2c.h' and `lib/libf2c.a' files with its own
941 versions, and in fact will not even install `libf2c.a' for use with the
942 newly installed versions of `gcc' and `g77' if it sees that
943 `lib/libf2c.a' exists--instead, it will print an explanatory message
944 and skip this part of the installation.
945
946 To install `g77''s versions of `f2c.h' and `libf2c.a' in the
947 appropriate places, create the file `f2c-install-ok' (e.g. via the UNIX
948 command `touch f2c-install-ok') in the source or build top-level
949 directory (the same directory in which the `g77' `f' directory resides,
950 not the `f' directory itself), or edit `gcc/f/Make-lang.in' and change
951 the definition of the `F2C_INSTALL_FLAG' macro appropriately.
952
953 Usually, this means that, after typing `cd gcc', you would type
954 `touch f2c-install-ok'.
955
956 Make sure that when you enable the overwriting of `f2c.h' and
957 `libf2c.a' as used by `f2c', you have a recent and properly configured
958 version of `bin/f2c' so that it generates code that is compatible with
959 `g77'.
960
961 If you don't want installation of `g77' to overwrite `f2c''s existing
962 installation, but you do want `g77' installation to proceed with
963 installation of its own versions of `f2c.h' and `libf2c.a' in places
964 where `g77' will pick them up (even when linking `f2c'-compiled object
965 files--which might lead to incompatibilities), create the file
966 `f2c-exists-ok' (e.g. via the UNIX command `touch f2c-exists-ok') in
967 the source or build top-level directory, or edit `gcc/f/Make-lang.in'
968 and change the definition of the `F2CLIBOK' macro appropriately.
969
970 Patching GNU Fortran
971 --------------------
972
973 If you're using a SunOS4 system, you'll need to make the following
974 change to `gcc/f/proj.h': edit the line reading
975
976 #define FFEPROJ_STRTOUL 1 ...
977
978 by replacing the `1' with `0'. Or, you can avoid editing the source by
979 adding
980 CFLAGS='-DFFEPROJ_STRTOUL=0 -g -O'
981 to the command line for `make' when you invoke it. (`-g' is the
982 default for `CFLAGS'.)
983
984 This causes a minimal version of `strtoul()' provided as part of the
985 `g77' distribution to be compiled and linked into whatever `g77'
986 programs need it, since some systems (like SunOS4 with only the bundled
987 compiler and its runtime) do not provide this function in their system
988 libraries.
989
990 Similarly, a minimal version of `bsearch()' is available and can be
991 enabled by editing a line similar to the one for `strtoul()' above in
992 `gcc/f/proj.h', if your system libraries lack `bsearch()'. The method
993 of overriding `X_CFLAGS' may also be used.
994
995 These are not problems with `g77', which requires an ANSI C
996 environment. You should upgrade your system to one that provides a
997 full ANSI C environment, or encourage the maintainers of `gcc' to
998 provide one to all `gcc'-based compilers in future `gcc' distributions.
999
1000 *Note Problems Installing::, for more information on why `strtoul()'
1001 comes up missing and on approaches to dealing with this problem that
1002 have already been tried.
1003
1004 Where in the World Does Fortran (and GNU CC) Go?
1005 ------------------------------------------------
1006
1007 Before configuring, you should make sure you know where you want the
1008 `g77' and `gcc' binaries to be installed after they're built, because
1009 this information is given to the configuration tool and used during the
1010 build itself.
1011
1012 A `g77' installation necessarily requires installation of a
1013 `g77'-aware version of `gcc', so that the `gcc' command recognizes
1014 Fortran source files and knows how to compile them.
1015
1016 For this to work, the version of `gcc' that you will be building as
1017 part of `g77' *must* be installed as the "active" version of `gcc' on
1018 the system.
1019
1020 Sometimes people make the mistake of installing `gcc' as
1021 `/usr/local/bin/gcc', leaving an older, non-Fortran-aware version in
1022 `/usr/bin/gcc'. (Or, the opposite happens.) This can result in `g77'
1023 being unable to compile Fortran source files, because when it calls on
1024 `gcc' to do the actual compilation, `gcc' complains that it does not
1025 recognize the language, or the file name suffix.
1026
1027 So, determine whether `gcc' already is installed on your system,
1028 and, if so, *where* it is installed, and prepare to configure the new
1029 version of `gcc' you'll be building so that it installs over the
1030 existing version of `gcc'.
1031
1032 You might want to back up your existing copy of `bin/gcc', and the
1033 entire `lib/' directory, before you perform the actual installation (as
1034 described in this manual).
1035
1036 Existing `gcc' installations typically are found in `/usr' or
1037 `/usr/local'. If you aren't certain where the currently installed
1038 version of `gcc' and its related programs reside, look at the output of
1039 this command:
1040
1041 gcc -v -o /tmp/delete-me -xc /dev/null -xnone
1042
1043 All sorts of interesting information on the locations of various
1044 `gcc'-related programs and data files should be visible in the output
1045 of the above command. (The output also is likely to include a
1046 diagnostic from the linker, since there's no `main_()' function.)
1047 However, you do have to sift through it yourself; `gcc' currently
1048 provides no easy way to ask it where it is installed and where it looks
1049 for the various programs and data files it calls on to do its work.
1050
1051 Just *building* `g77' should not overwrite any installed
1052 programs--but, usually, after you build `g77', you will want to install
1053 it, so backing up anything it might overwrite is a good idea. (This is
1054 true for any package, not just `g77', though in this case it is
1055 intentional that `g77' overwrites `gcc' if it is already installed--it
1056 is unusual that the installation process for one distribution
1057 intentionally overwrites a program or file installed by another
1058 distribution.)
1059
1060 Another reason to back up the existing version first, or make sure
1061 you can restore it easily, is that it might be an older version on
1062 which other users have come to depend for certain behaviors. However,
1063 even the new version of `gcc' you install will offer users the ability
1064 to specify an older version of the actual compilation programs if
1065 desired, and these older versions need not include any `g77' components.
1066 *Note Specifying Target Machine and Compiler Version: (gcc)Target
1067 Options, for information on the `-V' option of `gcc'.
1068
1069 Configuring GNU CC
1070 ------------------
1071
1072 `g77' is configured automatically when you configure `gcc'. There
1073 are two parts of `g77' that are configured in two different
1074 ways--`g77', which "camps on" to the `gcc' configuration mechanism, and
1075 `libf2c', which uses a variation of the GNU `autoconf' configuration
1076 system.
1077
1078 Generally, you shouldn't have to be concerned with either `g77' or
1079 `libf2c' configuration, unless you're configuring `g77' as a
1080 cross-compiler. In this case, the `libf2c' configuration, and possibly
1081 the `g77' and `gcc' configurations as well, might need special
1082 attention. (This also might be the case if you're porting `gcc' to a
1083 whole new system--even if it is just a new operating system on an
1084 existing, supported CPU.)
1085
1086 To configure the system, see *Note Installing GNU CC:
1087 (gcc)Installation, following the instructions for running `./configure'.
1088 Pay special attention to the `--prefix=' option, which you almost
1089 certainly will need to specify.
1090
1091 (Note that `gcc' installation information is provided as a straight
1092 text file in `gcc/INSTALL'.)
1093
1094 The information printed by the invocation of `./configure' should
1095 show that the `f' directory (the Fortran language) has been configured.
1096 If it does not, there is a problem.
1097
1098 *Note:* Configuring with the `--srcdir' argument is known to work
1099 with GNU `make', but it is not known to work with other variants of
1100 `make'. Irix5.2 and SunOS4.1 versions of `make' definitely won't work
1101 outside the source directory at present. `g77''s portion of the
1102 `configure' script issues a warning message about this when you
1103 configure for building binaries outside the source directory.
1104
1105 Building GNU CC
1106 ---------------
1107
1108 Building `g77' requires building enough of `gcc' that these
1109 instructions assume you're going to build all of `gcc', including
1110 `g++', `protoize', and so on. You can save a little time and disk
1111 space by changes the `LANGUAGES' macro definition in `gcc/Makefile.in'
1112 or `gcc/Makefile', but if you do that, you're on your own. One change
1113 is almost *certainly* going to cause failures: removing `c' or `f77'
1114 from the definition of the `LANGUAGES' macro.
1115
1116 After configuring `gcc', which configures `g77' and `libf2c'
1117 automatically, you're ready to start the actual build by invoking
1118 `make'.
1119
1120 *Note:* You *must* have run `./configure' before you run `make',
1121 even if you're using an already existing `gcc' development directory,
1122 because `./configure' does the work to recognize that you've added
1123 `g77' to the configuration.
1124
1125 There are two general approaches to building GNU CC from scratch:
1126
1127 "bootstrap"
1128 This method uses minimal native system facilities to build a
1129 barebones, unoptimized `gcc', that is then used to compile
1130 ("bootstrap") the entire system.
1131
1132 "straight"
1133 This method assumes a more complete native system exists, and uses
1134 that just once to build the entire system.
1135
1136 On all systems without a recent version of `gcc' already installed,
1137 the bootstrap method must be used. In particular, `g77' uses
1138 extensions to the C language offered, apparently, only by `gcc'.
1139
1140 On most systems with a recent version of `gcc' already installed,
1141 the straight method can be used. This is an advantage, because it
1142 takes less CPU time and disk space for the build. However, it does
1143 require that the system have fairly recent versions of many GNU
1144 programs and other programs, which are not enumerated here.
1145
1146 Bootstrap Build
1147 ...............
1148
1149 A complete bootstrap build is done by issuing a command beginning
1150 with `make bootstrap ...', as described in *Note Installing GNU CC:
1151 (gcc)Installation. This is the most reliable form of build, but it
1152 does require the most disk space and CPU time, since the complete system
1153 is built twice (in Stages 2 and 3), after an initial build (during
1154 Stage 1) of a minimal `gcc' compiler using the native compiler and
1155 libraries.
1156
1157 You might have to, or want to, control the way a bootstrap build is
1158 done by entering the `make' commands to build each stage one at a time,
1159 as described in the `gcc' manual. For example, to save time or disk
1160 space, you might want to not bother doing the Stage 3 build, in which
1161 case you are assuming that the `gcc' compiler you have built is
1162 basically sound (because you are giving up the opportunity to compare a
1163 large number of object files to ensure they're identical).
1164
1165 To save some disk space during installation, after Stage 2 is built,
1166 you can type `rm -fr stage1' to remove the binaries built during Stage
1167 1.
1168
1169 *Note:* *Note Object File Differences::, for information on expected
1170 differences in object files produced during Stage 2 and Stage 3 of a
1171 bootstrap build. These differences will be encountered as a result of
1172 using the `make compare' or similar command sequence recommended by the
1173 GNU CC installation documentation.
1174
1175 Also, *Note Installing GNU CC: (gcc)Installation, for important
1176 information on building `gcc' that is not described in this `g77'
1177 manual. For example, explanations of diagnostic messages and whether
1178 they're expected, or indicate trouble, are found there.
1179
1180 Straight Build
1181 ..............
1182
1183 If you have a recent version of `gcc' already installed on your
1184 system, and if you're reasonably certain it produces code that is
1185 object-compatible with the version of `gcc' you want to build as part
1186 of building `g77', you can save time and disk space by doing a straight
1187 build.
1188
1189 To build just the C and Fortran compilers and the necessary run-time
1190 libraries, issue the following command:
1191
1192 make -k CC=gcc LANGUAGES=f77 all g77
1193
1194 (The `g77' target is necessary because the `gcc' build procedures
1195 apparently do not automatically build command drivers for languages in
1196 subdirectories. It's the `all' target that triggers building
1197 everything except, apparently, the `g77' command itself.)
1198
1199 If you run into problems using this method, you have two options:
1200
1201 * Abandon this approach and do a bootstrap build.
1202
1203 * Try to make this approach work by diagnosing the problems you're
1204 running into and retrying.
1205
1206 Especially if you do the latter, you might consider submitting any
1207 solutions as bug/fix reports. *Note Known Causes of Trouble with GNU
1208 Fortran: Trouble.
1209
1210 However, understand that many problems preventing a straight build
1211 from working are not `g77' problems, and, in such cases, are not likely
1212 to be addressed in future versions of `g77'.
1213
1214 Pre-installation Checks
1215 -----------------------
1216
1217 Before installing the system, which includes installing `gcc', you
1218 might want to do some minimum checking to ensure that some basic things
1219 work.
1220
1221 Here are some commands you can try, and output typically printed by
1222 them when they work:
1223
1224 sh# cd /usr/src/gcc
1225 sh# ./g77 --driver=./xgcc -B./ -v
1226 g77 version 0.5.21
1227 ./xgcc -B./ -v -fnull-version -o /tmp/gfa18047 ...
1228 Reading specs from ./specs
1229 gcc version 2.7.2.2.f.3
1230 ./cpp -lang-c -v -isystem ./include -undef ...
1231 GNU CPP version 2.7.2.2.f.3 (Linux/Alpha)
1232 #include "..." search starts here:
1233 #include <...> search starts here:
1234 ./include
1235 /usr/local/include
1236 /usr/alpha-unknown-linux/include
1237 /usr/lib/gcc-lib/alpha-unknown-linux/2.7.2.2.f.3/include
1238 /usr/include
1239 End of search list.
1240 ./f771 /tmp/cca18048.i -fset-g77-defaults -quiet -dumpbase ...
1241 GNU F77 version 2.7.2.2.f.3 (Linux/Alpha) compiled ...
1242 GNU Fortran Front End version 0.5.21 compiled: ...
1243 as -nocpp -o /tmp/cca180481.o /tmp/cca18048.s
1244 ld -G 8 -O1 -o /tmp/gfa18047 /usr/lib/crt0.o -L. ...
1245 __G77_LIBF77_VERSION__: 0.5.21
1246 @(#)LIBF77 VERSION 19970404
1247 __G77_LIBI77_VERSION__: 0.5.21
1248 @(#) LIBI77 VERSION pjw,dmg-mods 19970527
1249 __G77_LIBU77_VERSION__: 0.5.21
1250 @(#) LIBU77 VERSION 19970609
1251 sh# ./xgcc -B./ -v -o /tmp/delete-me -xc /dev/null -xnone
1252 Reading specs from ./specs
1253 gcc version 2.7.2.2.f.3
1254 ./cpp -lang-c -v -isystem ./include -undef ...
1255 GNU CPP version 2.7.2.2.f.3 (Linux/Alpha)
1256 #include "..." search starts here:
1257 #include <...> search starts here:
1258 ./include
1259 /usr/local/include
1260 /usr/alpha-unknown-linux/include
1261 /usr/lib/gcc-lib/alpha-unknown-linux/2.7.2.2.f.3/include
1262 /usr/include
1263 End of search list.
1264 ./cc1 /tmp/cca18063.i -quiet -dumpbase null.c -version ...
1265 GNU C version 2.7.2.2.f.3 (Linux/Alpha) compiled ...
1266 as -nocpp -o /tmp/cca180631.o /tmp/cca18063.s
1267 ld -G 8 -O1 -o /tmp/delete-me /usr/lib/crt0.o -L. ...
1268 /usr/lib/crt0.o: In function `__start':
1269 crt0.S:110: undefined reference to `main'
1270 /usr/lib/crt0.o(.lita+0x28): undefined reference to `main'
1271 sh#
1272
1273 (Note that long lines have been truncated, and `...' used to
1274 indicate such truncations.)
1275
1276 The above two commands test whether `g77' and `gcc', respectively,
1277 are able to compile empty (null) source files, whether invocation of
1278 the C preprocessor works, whether libraries can be linked, and so on.
1279
1280 If the output you get from either of the above two commands is
1281 noticeably different, especially if it is shorter or longer in ways
1282 that do not look consistent with the above sample output, you probably
1283 should not install `gcc' and `g77' until you have investigated further.
1284
1285 For example, you could try compiling actual applications and seeing
1286 how that works. (You might want to do that anyway, even if the above
1287 tests work.)
1288
1289 To compile using the not-yet-installed versions of `gcc' and `g77',
1290 use the following commands to invoke them.
1291
1292 To invoke `g77', type:
1293
1294 /usr/src/gcc/g77 --driver=/usr/src/gcc/xgcc -B/usr/src/gcc/ ...
1295
1296 To invoke `gcc', type:
1297
1298 /usr/src/gcc/xgcc -B/usr/src/gcc/ ...
1299
1300 Installation of Binaries
1301 ------------------------
1302
1303 After configuring, building, and testing `g77' and `gcc', when you
1304 are ready to install them on your system, type:
1305
1306 make -k CC=gcc LANGUAGES=f77 install
1307
1308 As described in *Note Installing GNU CC: (gcc)Installation, the
1309 values for the `CC' and `LANGUAGES' macros should be the same as those
1310 you supplied for the build itself.
1311
1312 So, the details of the above command might vary if you used a
1313 bootstrap build (where you might be able to omit both definitions, or
1314 might have to supply the same definitions you used when building the
1315 final stage) or if you deviated from the instructions for a straight
1316 build.
1317
1318 If the above command does not install `libf2c.a' as expected, try
1319 this:
1320
1321 make -k ... install install-libf77 install-f2c-all
1322
1323 We don't know why some non-GNU versions of `make' sometimes require
1324 this alternate command, but they do. (Remember to supply the
1325 appropriate definitions for `CC' and `LANGUAGES' where you see `...' in
1326 the above command.)
1327
1328 Note that using the `-k' option tells `make' to continue after some
1329 installation problems, like not having `makeinfo' installed on your
1330 system. It might not be necessary for your system.
1331
1332 Updating Your Info Directory
1333 ----------------------------
1334
1335 As part of installing `g77', you should make sure users of `info'
1336 can easily access this manual on-line. Do this by making sure a line
1337 such as the following exists in `/usr/info/dir', or in whatever file is
1338 the top-level file in the `info' directory on your system (perhaps
1339 `/usr/local/info/dir':
1340
1341 * g77: (g77). The GNU Fortran programming language.
1342
1343 If the menu in `dir' is organized into sections, `g77' probably
1344 belongs in a section with a name such as one of the following:
1345
1346 * Fortran Programming
1347
1348 * Writing Programs
1349
1350 * Programming Languages
1351
1352 * Languages Other Than C
1353
1354 * Scientific/Engineering Tools
1355
1356 * GNU Compilers
1357
1358 Missing `bison'?
1359 ----------------
1360
1361 If you cannot install `bison', make sure you have started with a
1362 *fresh* distribution of `gcc', do *not* do `make maintainer-clean' (in
1363 other versions of `gcc', this was called `make realclean'), and, to
1364 ensure that `bison' is not invoked by `make' during the build, type
1365 these commands:
1366
1367 sh# cd gcc
1368 sh# touch bi-parser.c bi-parser.h c-parse.c c-parse.h cexp.c
1369 sh# touch cp/parse.c cp/parse.h objc-parse.c
1370 sh#
1371
1372 These commands update the date-time-modified information for all the
1373 files produced by the various invocations of `bison' in the current
1374 versions of `gcc', so that `make' no longer believes it needs to update
1375 them. All of these files should already exist in a `gcc' distribution,
1376 but the application of patches to upgrade to a newer version can leave
1377 the modification information set such that the `bison' input files look
1378 more "recent" than the corresponding output files.
1379
1380 *Note:* New versions of `gcc' might change the set of files it
1381 generates by invoking `bison'--if you cannot figure out for yourself
1382 how to handle such a situation, try an older version of `gcc' until you
1383 find someone who can (or until you obtain and install `bison').
1384
1385 Missing `makeinfo'?
1386 -------------------
1387
1388 If you cannot install `makeinfo', either use the `-k' option when
1389 invoking make to specify any of the `install' or related targets, or
1390 specify `MAKEINFO=echo' on the `make' command line.
1391
1392 If you fail to do one of these things, some files, like `libf2c.a',
1393 might not be installed, because the failed attempt by `make' to invoke
1394 `makeinfo' causes it to cancel any further processing.
1395
1396 Distributing Binaries
1397 =====================
1398
1399 If you are building `g77' for distribution to others in binary form,
1400 first make sure you are aware of your legal responsibilities (read the
1401 file `gcc/COPYING' thoroughly).
1402
1403 Then, consider your target audience and decide where `g77' should be
1404 installed.
1405
1406 For systems like GNU/Linux that have no native Fortran compiler (or
1407 where `g77' could be considered the native compiler for Fortran and
1408 `gcc' for C, etc.), you should definitely configure `g77' for
1409 installation in `/usr/bin' instead of `/usr/local/bin'. Specify the
1410 `--prefix=/usr' option when running `./configure'. You might also want
1411 to set up the distribution so the `f77' command is a link to
1412 `g77'--just make an empty file named `f77-install-ok' in the source or
1413 build directory (the one in which the `f' directory resides, not the
1414 `f' directory itself) when you specify one of the `install' or
1415 `uninstall' targets in a `make' command.
1416
1417 For a system that might already have `f2c' installed, you definitely
1418 will want to make another empty file (in the same directory) named
1419 either `f2c-exists-ok' or `f2c-install-ok'. Use the former if you
1420 don't want your distribution to overwrite `f2c'-related files in
1421 existing systems; use the latter if you want to improve the likelihood
1422 that users will be able to use both `f2c' and `g77' to compile code for
1423 a single program without encountering link-time or run-time
1424 incompatibilities.
1425
1426 (Make sure you clearly document, in the "advertising" for your
1427 distribution, how installation of your distribution will affect
1428 existing installations of `gcc', `f2c', `f77', `libf2c.a', and so on.
1429 Similarly, you should clearly document any requirements you assume are
1430 met by users of your distribution.)
1431
1432 For other systems with native `f77' (and `cc') compilers, configure
1433 `g77' as you (or most of your audience) would configure `gcc' for their
1434 installations. Typically this is for installation in `/usr/local', and
1435 would not include a copy of `g77' named `f77', so users could still use
1436 the native `f77'.
1437
1438 In any case, for `g77' to work properly, you *must* ensure that the
1439 binaries you distribute include:
1440
1441 `bin/g77'
1442 This is the command most users use to compile Fortran.
1443
1444 `bin/gcc'
1445 This is the command all users use to compile Fortran, either
1446 directly or indirectly via the `g77' command. The `bin/gcc'
1447 executable file must have been built from a `gcc' source tree into
1448 which a `g77' source tree was merged and configured, or it will
1449 not know how to compile Fortran programs.
1450
1451 `bin/f77'
1452 In installations with no non-GNU native Fortran compiler, this is
1453 the same as `bin/g77'. Otherwise, it should be omitted from the
1454 distribution, so the one on already on a particular system does
1455 not get overwritten.
1456
1457 `info/g77.info*'
1458 This is the documentation for `g77'. If it is not included, users
1459 will have trouble understanding diagnostics messages and other
1460 such things, and will send you a lot of email asking questions.
1461
1462 Please edit this documentation (by editing `gcc/f/*.texi' and
1463 doing `make doc' from the `/usr/src/gcc' directory) to reflect any
1464 changes you've made to `g77', or at least to encourage users of
1465 your binary distribution to report bugs to you first.
1466
1467 Also, whether you distribute binaries or install `g77' on your own
1468 system, it might be helpful for everyone to add a line listing
1469 this manual by name and topic to the top-level `info' node in
1470 `/usr/info/dir'. That way, users can find `g77' documentation more
1471 easily. *Note Updating Your Info Directory: Updating
1472 Documentation.
1473
1474 `man/man1/g77.1'
1475 This is the short man page for `g77'. It is out of date, but you
1476 might as well include it for people who really like man pages.
1477
1478 `man/man1/f77.1'
1479 In installations where `f77' is the same as `g77', this is the
1480 same as `man/man1/g77.1'. Otherwise, it should be omitted from
1481 the distribution, so the one already on a particular system does
1482 not get overwritten.
1483
1484 `lib/gcc-lib/.../f771'
1485 This is the actual Fortran compiler.
1486
1487 `lib/gcc-lib/.../libf2c.a'
1488 This is the run-time library for `g77'-compiled programs.
1489
1490 Whether you want to include the slightly updated (and possibly
1491 improved) versions of `cc1', `cc1plus', and whatever other binaries get
1492 rebuilt with the changes the GNU Fortran distribution makes to the GNU
1493 back end, is up to you. These changes are highly unlikely to break any
1494 compilers, and it is possible they'll fix back-end bugs that can be
1495 demonstrated using front ends other than GNU Fortran's.
1496
1497 Please assure users that unless they have a specific need for their
1498 existing, older versions of `gcc' command, they are unlikely to
1499 experience any problems by overwriting it with your version--though
1500 they could certainly protect themselves by making backup copies first!
1501 Otherwise, users might try and install your binaries in a "safe" place,
1502 find they cannot compile Fortran programs with your distribution
1503 (because, perhaps, they're picking up their old version of the `gcc'
1504 command, which does not recognize Fortran programs), and assume that
1505 your binaries (or, more generally, GNU Fortran distributions in
1506 general) are broken, at least for their system.
1507
1508 Finally, *please* ask for bug reports to go to you first, at least
1509 until you're sure your distribution is widely used and has been well
1510 tested. This especially goes for those of you making any changes to
1511 the `g77' sources to port `g77', e.g. to OS/2.
1512 <fortran@gnu.ai.mit.edu> has received a fair number of bug reports that
1513 turned out to be problems with other peoples' ports and distributions,
1514 about which nothing could be done for the user. Once you are quite
1515 certain a bug report does not involve your efforts, you can forward it
1516 to us.
1517
This page took 0.185087 seconds and 5 git commands to generate.