GNU C Compiler Version 2.8.0 for openVMS/Alpha 6.2 and 7.1 Provided by Klaus Kaempf (kkaempf@progis.de) Installation Instructions This is a full release of the GNU Compiler System for the openVMS/Alpha 6.2 or 7.1 environment. A release for other openVMS versions and for openVMS/VAX will be made later. If you're used to GNU C on openVMS/VAX It is assembled from various pieces of software that are all freely available under the GNU public license. GNU Make 3.76 GNU Binutils 2.8 (nm, objdump, size, strings) GNU Assembler 2.8 GNU C 2.8.0 GNU C++ 2.8.0 GNU libg++ 2.8.0 Source for this software isn't available on ftp.progis.de yet, look for it on prep.ai.mit.edu or any of it's mirror servers All programs are compiled with the GNU compiler. The software is packaged in .ZIP format to conserver VMS file attributes and to make the installation very easy. If you don't have UNZIP for VMS, get it from 'ftp.progis.de/pub/vms/utils/unzip.exe' and install it as a foreign command. Be sure to use the binary format with ftp ! For GNU C on openVMS/Alpha 6.2 you'll need the following files: ftp.progis.de/pub/vms/gnu/6_2/bin.zip ftp.progis.de/pub/vms/gcc/6_2/gcc-2_8_0.zip ftp.progis.de/pub/vms/gcc/gnu_setup.com ftp.progis.de/pub/vms/gcc/login.com For GNU C on openVMS/Alpha 7.1 you'll need the following files: ftp.progis.de/pub/vms/gnu/7_1/bin.zip ftp.progis.de/pub/vms/gcc/7_1/gcc-2_8_0.zip ftp.progis.de/pub/vms/gcc/gnu_setup.com ftp.progis.de/pub/vms/gcc/login.com For GNU C and GNU C++ on openVMS/Alpha 6.2 you'll need: ftp.progis.de/pub/vms/gnu/6_2/bin.zip ftp.progis.de/pub/vms/gcc/6_2/gxx-2_8_0.zip ftp.progis.de/pub/vms/gcc/gnu_setup.com ftp.progis.de/pub/vms/gcc/login.com GNU C++ for openVMS/Alpha 7.1 isn't available yet. *** Remember to set your ftp to 'IMAGE' or 'BINARY' *** 1. Creating a directory for GNU This release follows more closely the GNU naming scheme for directories as used on un*x systems. This allows for easy installation of other gnu software and makes administration more clearly. All files are installed below GNU_ROOT:[000000] which serves as the '/usr/local' directory tree entry point in un*x gnu installations. Below that, the following directories are typically needed: GNU_ROOT:[BIN] gnu .exe files GNU_ROOT:[CLD] vms .CLD files for gnu utilities GNU_ROOT:[INCLUDE] non compiler specific include files (like flexlexer.h from flex) GNU_ROOT:[SHARE] shared files (like bison skeleton files) GNU_ROOT:[LIB] non compiler specific library files GNU_ROOT:[INFO] emacs .info files GNU_ROOT:[ALPHA-PROGIS-VMS_6_2] target specific compiler files GNU_ROOT:[ALPHA-PROGIS-VMS_6_2.2_8_0] target and compiler version specific files. The logical GNU_CC_LIBRARY points to this directory. GNU_ROOT:[ALPHA-PROGIS-VMS_6_2.2_8_0.INCLUDE] gnu c compiler specific include files. The concealed logical GNU_CC_INCLUDE points to this directory. GNU_ROOT:[ALPHA-PROGIS-VMS_6_2.2_8_0.GXX-INCLUDE] gnu c++ compiler specific include files. The concealed logical GNU_GXX_INCLUDE points to this directory. You must create a directory for GNU_ROOT and put 'gnu_setup.com' into this directory. Then set your default directory there (with $ set def) and execute the following DCL commands: $ define GNU_CC_VERSION 2_8_0 $ @GNU_SETUP This sets up all needed logicals. Now set your default directory to GNU_ROOT:[000000] $ set def GNU_ROOT:[000000] 2. Installing GNU utilities Unpack BIN.ZIP below GNU_ROOT:[000000] with $ set def GNU_ROOT:[000000] $ unzip BIN.ZIP This creates the directory GNU_ROOT:[BIN] and extracts the following files to it GNU_ROOT:[BIN]AS.EXE gnu assembler 2.8 GNU_ROOT:[BIN]GASP.EXE gnu assembler preprocessor 2.8 GNU_ROOT:[BIN]MAKE.EXE gnu make 3.76 GNU_ROOT:[BIN]NM.EXE gnu nm 2.8 GNU_ROOT:[BIN]OBJDUMP.EXE gnu objdump 2.8 GNU_ROOT:[BIN]SIZE.EXE gnu size 2.8 GNU_ROOT:[BIN]STRINGS.EXE gnu strings 2.8 GNU_ROOT:[BIN]GCC.EXE gnu c compiler driver, first part GNU_ROOT:[BIN]GCC.COM gnu c compiler driver, second part 3. Installing the C-Compiler If you also want the C++ compiler, skip to step 4. Unpack GCC-2_8_0.ZIP below GNU_ROOT:[000000] with $ set def GNU_ROOT:[000000] $ unzip GCC-2_8_0 This creates the directory GNU_ROOT:[ALPHA-PROGIS-VMS_6_2.2_8_0] (named GNU_CC_LIBRARY below) and extracts the following files to it: GNU_CC_LIBRARY:cpp.exe gnu c preprocessor GNU_CC_LIBRARY:cc1.exe gnu c compiler GNU_CC_LIBRARY:crt0.obj ansi c compatible startup file GNU_CC_LIBRARY:crt1.obj dec c compatible startup file GNU_CC_LIBRARY:libgcc.olb gnu c compiler library GNU_CC_LIBRARY:macrosc.vms gnu c preprocessor macros GNU_CC_LIBRARY:[include] gnu c include files 4. Installing the C++-Compiler Unpack GXX-2_8_0.ZIP below GNU_ROOT:[000000] with $ set def GNU_ROOT:[000000] $ unzip GXX-2_8_0 This creates the directory GNU_ROOT:[ALPHA-PROGIS-VMS_6_2.2_8_0] (named GNU_CC_LIBRARY below) and extracts all the files from GCC-2_8_0.ZIP (see step 3 above) and the following files to it: GNU_CC_LIBRARY:cc1plus.exe gnu c++ compiler GNU_CC_LIBRARY:crtbegin.obj start hook for static constructors GNU_CC_LIBRARY:crtend.obj end hook for static constructors GNU_CC_LIBRARY:gxx_main.obj gnu c++ startup file GNU_CC_LIBRARY:libgccplus.olb gnu c++ compiler library GNU_CC_LIBRARY:macroscc.vms gnu c++ preprocessor macros GNU_CC_LIBRARY:[gxx-include] gnu c++ include files 5. Changes in your LOGIN.COM The GNU compiler setup and the definition of foreign commands is done with the file LOGIN.COM This should be executed every time you log in, so it is best included in your own login.com 6. Working with the compiler GNU C isn't a direct 'drop-in' replacement for DEC C although it understands most of the parameters. If you want to pass special parameters to the GNU preprocessor, add them with /cpp="parameter". Passing parameter to the C compiler cc1 is done with /cc1="parameter". By default, GNU C uses the IEEE floating point format on Alpha. 7. Linking programs Linking object files to make an executable isn't easy but GNU Make has default rules for most cases. If you have a source file called 'program.c', running 'make program.exe' will do all needed work for you. GNU C uses the DEC C runtime library as the standard C library. Get the latest version as there are *lots* of bugs in DECCRTL.OLB, especially in the stdio part. See www.services.digital.com for updates. A typical link command for an object file 'cprogram.obj' would be: link/exe=cprogram.exe cprogram.obj, ! gnu c compiled program GNU_CC_LIBRARY:libgcc.olb/lib, ! gnu c compiler utility routines sys$library:vaxcrtl.olb/lib, ! standard C routines GNU_CC_LIBRARY:crt0.obj ! startup file The DEC C runtime library (DECCRTL) is linked automatically. The handling of exit values is different between VMS and the rest of the world. VMS uses odd values for 'success' and even values for 'failure'. Almost all other OS use zero for 'success' and non-zero for 'failure', so do most C programs. So running a standard C program which returns '1' for failure isn't recognized on VMS as an error. The startup file 'crt0.obj' doubles the exit code from 'main()' before returning the value to VMS. So programs returning a non-zero exit code are guaranteed to return an odd value to VMS, signalling 'error'. If you link a VAX C or DEC C program, replace crt0.obj by crt1.obj in the link command. Linking C++ programs is a different issue alltogether. Since C++ has to go through all static constructors *before* calling main(), a 'constructor chain' has to be build up. This is done with the files crtbegin.obj, which must be linked before the first GNU C++ compiled file, and crtend.obj, which must be linked after the last GNU C++ compiled file. The startup file 'gxx_main' links all constructors together and executes them to make sure all static objects are properly initialized. Because of this, linking a C++ program is complicated: link/exe=cxxprogram.exe GNU_CC_LIBRARY:crtbegin.obj, ! start hook for constructor chain sys$disk:[]cxxprogram.obj, ! gnu c++ compiled program GNU_CC_LIBRARY:libstdcxx.olb/lib, ! gnu c++ standard library GNU_CC_LIBRARY:libgccplus.olb/lib, ! gnu c++ compiler utility routines GNU_CC_LIBRARY:crtend.obj, ! end hook for constructor chain sys$library:vaxcrtl.olb/lib, ! standard C routines GNU_CC_LIBRARY:libgcc.olb/lib, ! gnu c compiler utility routines GNU_CC_LIBRARY:gxx_main.obj ! startup file A. Reporting bugs The GNU compiler system based on GNU C 2.8.0 on openVMS/Alpha has bugs. Period. If you need a stable compiler with professional support, think about purchasing the GNUPRO 64 compiler system from proGIS Software. Mail to info@progis.de or visit the web site at http://www.progis.de. I can only give support for the free version as time permits. However, it passes the GNU c-torture test and compiles itself and all other mentioned gnu utilities. If you run into a bug, there are three traps you might have fallen into. - Bugs in the GNU compiler itself If you find a bug in the GNU compiler itself, you should wait for the next version which is planned for end of january 1998. - Bugs in the GNU compiler port to openVMS/Alpha Get in contact with me (kkaempf@progis.de) and I will try to help you out. - Bugs in the include files. This will most certanly happen if you use VMS specific include files. All of them are based on the freely available include file set for openVMS/*VAX* If ported most of the files and added a comment at the beginning of the file. If you use a file without such a comment, mail me for a replacement. **** IMPORTANT **** If you report a bug to me, *** DON'T *** send me your source code but try to explain what's going wrong in english (or better in german :-) Please start the subject with '[GNUC]' ! !!!! Mail with more than about 50 lines of text go into the bit bucket !!!! If I need the source, I will tell you. Have fun !