转载于:http://www.tmk.com/ftp/vms-freeware/gcc-for-alpha/installation
GNU C Compiler Version 2.8.0 for openVMS/Alpha 6.2 and 7.1Provided by Klaus Kaempf (kkaempf@progis.de)Installation InstructionsThis is a full release of the GNU Compiler System for the openVMS/Alpha 6.2or 7.1 environment. A release for other openVMS versions and for openVMS/VAXwill 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 availableunder the GNU public license.GNU Make 3.76GNU Binutils 2.8 (nm, objdump, size, strings)GNU Assembler 2.8GNU C 2.8.0GNU C++ 2.8.0GNU libg++ 2.8.0Source for this software isn't available on ftp.progis.de yet, look for it onprep.ai.mit.edu or any of it's mirror serversAll programs are compiled with the GNU compiler.The software is packaged in .ZIP format to conserver VMS file attributes andto 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 sureto 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.zipftp.progis.de/pub/vms/gcc/6_2/gcc-2_8_0.zipftp.progis.de/pub/vms/gcc/gnu_setup.comftp.progis.de/pub/vms/gcc/login.comFor GNU C on openVMS/Alpha 7.1 you'll need the following files:ftp.progis.de/pub/vms/gnu/7_1/bin.zipftp.progis.de/pub/vms/gcc/7_1/gcc-2_8_0.zipftp.progis.de/pub/vms/gcc/gnu_setup.comftp.progis.de/pub/vms/gcc/login.comFor GNU C and GNU C++ on openVMS/Alpha 6.2 you'll need:ftp.progis.de/pub/vms/gnu/6_2/bin.zipftp.progis.de/pub/vms/gcc/6_2/gxx-2_8_0.zipftp.progis.de/pub/vms/gcc/gnu_setup.comftp.progis.de/pub/vms/gcc/login.comGNU C++ for openVMS/Alpha 7.1 isn't available yet.*** Remember to set your ftp to 'IMAGE' or 'BINARY' ***1. Creating a directory for GNUThis release follows more closely the GNU naming scheme for directories asused on un*x systems. This allows for easy installation of other gnu softwareand 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 filesGNU_ROOT:[CLD]vms .CLD files for gnu utilitiesGNU_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 filesGNU_ROOT:[INFO]emacs .info filesGNU_ROOT:[ALPHA-PROGIS-VMS_6_2]target specific compiler filesGNU_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_SETUPThis sets up all needed logicals.Now set your default directory to GNU_ROOT:[000000]$ set def GNU_ROOT:[000000]2. Installing GNU utilitiesUnpack BIN.ZIP below GNU_ROOT:[000000] with$ set def GNU_ROOT:[000000]$ unzip BIN.ZIPThis creates the directory GNU_ROOT:[BIN] and extracts the following files to itGNU_ROOT:[BIN]AS.EXEgnu assembler 2.8GNU_ROOT:[BIN]GASP.EXEgnu assembler preprocessor 2.8GNU_ROOT:[BIN]MAKE.EXEgnu make 3.76GNU_ROOT:[BIN]NM.EXEgnu nm 2.8GNU_ROOT:[BIN]OBJDUMP.EXEgnu objdump 2.8GNU_ROOT:[BIN]SIZE.EXEgnu size 2.8GNU_ROOT:[BIN]STRINGS.EXEgnu strings 2.8GNU_ROOT:[BIN]GCC.EXEgnu c compiler driver, first partGNU_ROOT:[BIN]GCC.COMgnu c compiler driver, second part3. Installing the C-CompilerIf 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_0This creates the directory GNU_ROOT:[ALPHA-PROGIS-VMS_6_2.2_8_0] (namedGNU_CC_LIBRARY below) and extracts the following files to it:GNU_CC_LIBRARY:cpp.exegnu c preprocessorGNU_CC_LIBRARY:cc1.exegnu c compilerGNU_CC_LIBRARY:crt0.objansi c compatible startup fileGNU_CC_LIBRARY:crt1.objdec c compatible startup fileGNU_CC_LIBRARY:libgcc.olbgnu c compiler libraryGNU_CC_LIBRARY:macrosc.vmsgnu c preprocessor macrosGNU_CC_LIBRARY:[include]gnu c include files4. Installing the C++-CompilerUnpack GXX-2_8_0.ZIP below GNU_ROOT:[000000] with$ set def GNU_ROOT:[000000]$ unzip GXX-2_8_0This creates the directory GNU_ROOT:[ALPHA-PROGIS-VMS_6_2.2_8_0] (namedGNU_CC_LIBRARY below) and extracts all the files from GCC-2_8_0.ZIP (seestep 3 above) and the following files to it:GNU_CC_LIBRARY:cc1plus.exegnu c++ compilerGNU_CC_LIBRARY:crtbegin.objstart hook for static constructorsGNU_CC_LIBRARY:crtend.objend hook for static constructorsGNU_CC_LIBRARY:gxx_main.objgnu c++ startup fileGNU_CC_LIBRARY:libgccplus.olbgnu c++ compiler libraryGNU_CC_LIBRARY:macroscc.vmsgnu c++ preprocessor macrosGNU_CC_LIBRARY:[gxx-include]gnu c++ include files5. Changes in your LOGIN.COMThe GNU compiler setup and the definition of foreign commands is donewith the file LOGIN.COMThis should be executed every time you log in, so it is best includedin your own login.com6. Working with the compilerGNU C isn't a direct 'drop-in' replacement for DEC C although it understandsmost 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 donewith /cc1="parameter".By default, GNU C uses the IEEE floating point format on Alpha.7. Linking programsLinking object files to make an executable isn't easy but GNU Make has defaultrules 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 versionas there are *lots* of bugs in DECCRTL.OLB, especially in the stdio part. Seewww.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 fileThe 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 otherOS 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 recognizedon 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 codeare 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 throughall static constructors *before* calling main(), a 'constructor chain' has to bebuild up. This is done with the files crtbegin.obj, which must be linked before the firstGNU 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 andexecutes 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 chainsys$disk:[]cxxprogram.obj,! gnu c++ compiled programGNU_CC_LIBRARY:libstdcxx.olb/lib,! gnu c++ standard libraryGNU_CC_LIBRARY:libgccplus.olb/lib,! gnu c++ compiler utility routinesGNU_CC_LIBRARY:crtend.obj,! end hook for constructor chainsys$library:vaxcrtl.olb/lib,! standard C routinesGNU_CC_LIBRARY:libgcc.olb/lib,! gnu c compiler utility routinesGNU_CC_LIBRARY:gxx_main.obj! startup fileA. Reporting bugsThe 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 purchasingthe GNUPRO 64 compiler system from proGIS Software. Mail to info@progis.de orvisit 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 othermentioned 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 toexplain 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 !