COMPILING THE FORTRAN CODE FOR COMP ANALYSIS

IMPORTANT -- PROBABLY YOU NEED TO COMPILE ON THE SAME MACHINE YOU RUN ON.
  • First make sure you have a Fortran compiler. GFORTRAN and G77 are possibilities (note G77 is considered obsolete however). This is a useful resource: GFORTRAN Binaries And for mac, some more up to date versions (including Yosemite) here
  • Mac/Linux Go to directory $FORWARD/FORCOMP Rename compiler if necessary: edit makefile In the first few lines, FC and LINK should be changed from gfortran to g77 if that is your compiler Remove any old .o files and compiled code (if they are there), and recompile the fortran code on your machine. cd $FORWARD/FORCOMP rm forcomp rm *.o make forcomp If this does not work, you may need to install command line tools in Xcode, from command line try: xcode-select --install Or else you may be able to do this from the XCode preferences/downloads. SAVE your executable (forcomp) to $FORWARD_WORKING_DIR. FORWARD will check first there for an executable, and then use the one in $FORWARD/FORCOMP if not found. By saving your own, platform-specific executable you don't have to recompile every time FORWARD updates. If you run into problems, though, you might check the date stamp on the files in $FORWARD/FORCOMP. The Fortran codes are not updated often, but if they are, you need to recompile.
  • Windows This may be useful: Download Cygwin (https://www.cygwin.com/) During Cygwin installation you should add "gfortran" and "make" packages In the Cygwin "bin" directory (in standard installation it is "c:\Cygwin\bin") copy gfortran.exe to g77.exe Run Cygwin terminal Go to ssw\packages\forward\forcomp\ Run "make forcomp" Done Note when opening command line under Windows NOTE to change to directory in Windows terminal, sometimes you need first to change disks, so for example, say you are in D, but want to go to C, from prompt type: C: then you can change to a directory in that disk CD C:\G77 Rename compiler if necessary: In the first few lines, FC and LINK should be changed from gfortran to g77 if that is your compiler You may have to initialize the compiler (for example, if you have G77) g77setup ALSO you may need to add these lines to your SSWIDL.BAT file (for example, if you have G77): SET OLDPATH=%PATH% PATH=c:\g77\bin;%PATH% SET LIBRARY_PATH=c:\g77\lib Compile From command line type make forcomp SAVE your executable (forcomp or forcomp.exe) to $FORWARD_WORKING_DIR. FORWARD will check first there for an executable, and then use the one in $FORWARD/FORCOMP if not found. By saving your own, platform-specific executable you don't have to recompile every time FORWARD updates. If you run into problems, though, you might check the date stamp on the files in $FORWARD/FORCOMP. The Fortran codes are not updated often, but if they are, you need to recompile.

    TROUBLE-SHOOTING

    32 bit vs 64 bit - issues most likely with G77: If you are running 32-bit G77 compiler on 64 bit machine you may run into problem because 64-bit machines differ in the way that IDL/FORTRAN read/write works with F77_UNFORMATTED, you MAY need to tell the code to work in 32 bit explicitly. You can try changing these lines in $FORWARD/FORCOMP/makefile: --> OPT= -m32 -ffixed-line-length-none --> LFLAGS= -m32 $(DEBUG) ***NOTE some have found this step causes library issues (but see next comment). You should first try with the -m32 option, and see if you have I/O problems (it will complain it does not find a file). You might need to make sure the 32 bit libraries are installed as well. For example, Linux users have had success with installing the "glibc-devel.i686" package.