Go to the first, previous, next, last section, table of contents.


Installing GNU CC on VMS

The VMS version of GNU CC is distributed in a backup saveset containing both source code and precompiled binaries.

To install the `gcc' command so you can use the compiler easily, in the same manner as you use the VMS C compiler, you must install the VMS CLD file for GNU CC as follows:

  1. Define the VMS logical names `GNU_CC' and `GNU_CC_INCLUDE' to point to the directories where the GNU CC executables (`gcc-cpp.exe', `gcc-cc1.exe', etc.) and the C include files are kept respectively. This should be done with the commands:
    $ assign /system /translation=concealed -
      disk:[gcc.] gnu_cc
    $ assign /system /translation=concealed -
      disk:[gcc.include.] gnu_cc_include
    
    with the appropriate disk and directory names. These commands can be placed in your system startup file so they will be executed whenever the machine is rebooted. You may, if you choose, do this via the `GCC_INSTALL.COM' script in the `[GCC]' directory.
  2. Install the `GCC' command with the command line:
    $ set command /table=sys$common:[syslib]dcltables -
      /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
    $ install replace sys$common:[syslib]dcltables
    
  3. To install the help file, do the following:
    $ library/help sys$library:helplib.hlb gcc.hlp
    
    Now you can invoke the compiler with a command like `gcc /verbose file.c', which is equivalent to the command `gcc -v -c file.c' in Unix.

If you wish to use GNU C++ you must first install GNU CC, and then perform the following steps:

  1. Define the VMS logical name `GNU_GXX_INCLUDE' to point to the directory where the preprocessor will search for the C++ header files. This can be done with the command:
    $ assign /system /translation=concealed -
      disk:[gcc.gxx_include.] gnu_gxx_include
    
    with the appropriate disk and directory name. If you are going to be using libg++, this is where the libg++ install procedure will install the libg++ header files.
  2. Obtain the file `gcc-cc1plus.exe', and place this in the same directory that `gcc-cc1.exe' is kept. The GNU C++ compiler can be invoked with a command like `gcc /plus /verbose file.cc', which is equivalent to the command `g++ -v -c file.cc' in Unix.

We try to put corresponding binaries and sources on the VMS distribution tape. But sometimes the binaries will be from an older version than the sources, because we don't always have time to update them. (Use the `/version' option to determine the version number of the binaries and compare it with the source file `version.c' to tell whether this is so.) In this case, you should use the binaries you get to recompile the sources. If you must recompile, here is how:

  1. Execute the command procedure `vmsconfig.com' to set up the files `tm.h', `config.h', `aux-output.c', and `md.', and to create files `tconfig.h' and `hconfig.h'. This procedure also creates several linker option files used by `make-cc1.com' and a data file used by `make-l2.com'.
    $ @vmsconfig.com
    
  2. Setup the logical names and command tables as defined above. In addition, define the VMS logical name `GNU_BISON' to point at the to the directories where the Bison executable is kept. This should be done with the command:
    $ assign /system /translation=concealed -
      disk:[bison.] gnu_bison
    
    You may, if you choose, use the `INSTALL_BISON.COM' script in the `[BISON]' directory.
  3. Install the `BISON' command with the command line:
    $ set command /table=sys$common:[syslib]dcltables -
      /output=sys$common:[syslib]dcltables -
      gnu_bison:[000000]bison
    $ install replace sys$common:[syslib]dcltables
    
  4. Type `@make-gcc' to recompile everything (alternatively, submit the file `make-gcc.com' to a batch queue). If you wish to build the GNU C++ compiler as well as the GNU CC compiler, you must first edit `make-gcc.com' and follow the instructions that appear in the comments.
  5. In order to use GCC, you need a library of functions which GCC compiled code will call to perform certain tasks, and these functions are defined in the file `libgcc2.c'. To compile this you should use the command procedure `make-l2.com', which will generate the library `libgcc2.olb'. `libgcc2.olb' should be built using the compiler built from the same distribution that `libgcc2.c' came from, and `make-gcc.com' will automatically do all of this for you. To install the library, use the following commands:
    $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
    $ library gnu_cc:[000000]gcclib/delete=L_*
    $ library libgcc2/extract=*/output=libgcc2.obj
    $ library gnu_cc:[000000]gcclib libgcc2.obj
    
    The first command simply removes old modules that will be replaced with modules from `libgcc2' under different module names. The modules new and eprintf may not actually be present in your `gcclib.olb'---if the VMS librarian complains about those modules not being present, simply ignore the message and continue on with the next command. The second command removes the modules that came from the previous version of the library `libgcc2.c'. Whenever you update the compiler on your system, you should also update the library with the above procedure.
  6. You may wish to build GCC in such a way that no files are written to the directory where the source files reside. An example would be the when the source files are on a read-only disk. In these cases, execute the following DCL commands (substituting your actual path names):
    $ assign dua0:[gcc.build_dir.]/translation=concealed, -
             dua1:[gcc.source_dir.]/translation=concealed  gcc_build
    $ set default gcc_build:[000000]
    
    where the directory `dua1:[gcc.source_dir]' contains the source code, and the directory `dua0:[gcc.build_dir]' is meant to contain all of the generated object files and executables. Once you have done this, you can proceed building GCC as described above. (Keep in mind that `gcc_build' is a rooted logical name, and thus the device names in each element of the search list must be an actual physical device name rather than another rooted logical name).
  7. If you are building GNU CC with a previous version of GNU CC, you also should check to see that you have the newest version of the assembler. In particular, GNU CC version 2 treats global constant variables slightly differently from GNU CC version 1, and GAS version 1.38.1 does not have the patches required to work with GCC version 2. If you use GAS 1.38.1, then extern const variables will not have the read-only bit set, and the linker will generate warning messages about mismatched psect attributes for these variables. These warning messages are merely a nuisance, and can safely be ignored. If you are compiling with a version of GNU CC older than 1.33, specify `/DEFINE=("inline=")' as an option in all the compilations. This requires editing all the gcc commands in `make-cc1.com'. (The older versions had problems supporting inline.) Once you have a working 1.33 or newer GNU CC, you can change this file back.
  8. If you want to build GNU CC with the VAX C compiler, you will need to make minor changes in `make-cccp.com' and `make-cc1.com' to choose alternate definitions of CC, CFLAGS, and LIBS. See comments in those files. However, you must also have a working version of the GNU assembler (GNU as, aka GAS) as it is used as the back-end for GNU CC to produce binary object modules and is not included in the GNU CC sources. GAS is also needed to compile `libgcc2' in order to build `gcclib' (see above); `make-l2.com' expects to be able to find it operational in `gnu_cc:[000000]gnu-as.exe'. To use GNU CC on VMS, you need the VMS driver programs `gcc.exe', `gcc.com', and `gcc.cld'. They are distributed with the VMS binaries (`gcc-vms') rather than the GNU CC sources. GAS is also included in `gcc-vms', as is Bison. Once you have successfully built GNU CC with VAX C, you should use the resulting compiler to rebuild itself. Before doing this, be sure to restore the CC, CFLAGS, and LIBS definitions in `make-cccp.com' and `make-cc1.com'. The second generation compiler will be able to take advantage of many optimizations that must be suppressed when building with other compilers.

Under previous versions of GNU CC, the generated code would occasionally give strange results when linked with the sharable `VAXCRTL' library. Now this should work.

Even with this version, however, GNU CC itself should not be linked with the sharable `VAXCRTL'. The version of qsort in `VAXCRTL' has a bug (known to be present in VMS versions V4.6 through V5.5) which causes the compiler to fail.

The executables are generated by `make-cc1.com' and `make-cccp.com' use the object library version of `VAXCRTL' in order to make use of the qsort routine in `gcclib.olb'. If you wish to link the compiler executables with the shareable image version of `VAXCRTL', you should edit the file `tm.h' (created by `vmsconfig.com') to define the macro QSORT_WORKAROUND.

QSORT_WORKAROUND is always defined when GNU CC is compiled with VAX C, to avoid a problem in case `gcclib.olb' is not yet available.


Go to the first, previous, next, last section, table of contents.