2. Sun/Solaris Compilers: Cosmos

At the time of writing (April, 2001) there are three sets of Sun Workshop compilers available from and supported by ISD: those from Workshop 4.2, Workshop 5.0 and Workshop 6.0. These are all installed on Cosmos, though the latter has not yet been fully tested.

2.1. Using the Workshop 6.0 Compilers and IDE (Forte Developer)

Forte Developer is Sun's new name for what would be Workshop 6. Forte includes C and C++ compilers, Fortran 77, 90 and 95 compilers, and the dbx debugger, as for previous versions of Workshop --- Forte also includes an Integrated Development Environment (IDE) and a GUI-development tool.

The simplest way to use Forte (for most people) is to execute the command
    setup_forte6
immediately after logging on --- this sets your path appropriately, then the commands f77, f90, f95, cc and CC access the Fortran 77, 90 and 95 compilers, and the C and C++ compilers, respectively; the command dbx accesses the debugger, workshop starts the IDE, and visu starts the GUI-development tool.

Should you have trouble with the setup_forte6 command, or not wish to use it, then pre-pending
    /software/workshop6/utils/SUNWspro/bin
to your environment path, and
    /software/workshop6/utils/SUNWspro/lib
to your environment library-path with, for example, the commands
    export PATH=/software/workshop6/utils/SUNWspro/bin:$PATH
    export LD_LIBRARY_PATH=/software/ ... /SUNWspro/lib:$LD_LIBRARY_PATH
will make the above commands/applications directly accessible (i.e., without needing to resort to using the full path) and ensure the necessary libraries are available to you.

Since Forte has not yet been fully tested, we would welcome any feedback regarding successes as well as any problems.

2.2. Using the Workshop 5.0 Compilers

To run the Fortran 77 and Fortran 90 Sun compilers on Cosmos simply type
     f77 <source_file> 
and
     f90 <source_file> 
at the command line. The Workshop 5.0 compilers are picked up by default; the full paths are /software/SUNWspro/bin/f77 and /software/SUNWspro/bin/f90, though these should not usually be needed as /software/SUNWspro/bin will be on your path by default.

2.3. Example --- A Simple Programme

Suppose we want to compile, link and run the following simple programme

  PROGRAM hello  
  IMPLICIT NONE
  PRINT *, "Hello world!"
  END
which resides in hello.f90. Type
   f90 hello.90
If the source code has been typed in correctly you will get no messages from the compiler; alternatively type
  f90 -v hello.90
to show compilation details such as environment variables and full paths to executables used:
  f90 -v hello.f90
  ### f90: Note: LM_LICENSE_FILE = (null)
  ### f90: Note: NLSPATH = /software/SUNWspro/bin/ ...
  /software/SUNWspro/bin/../SC5.0/bin/f90comp -y-o -ytemp_f90.o ...
  ### f90: Note: LD_LIBRARY_PATH = /home/mpciish2/lib/kde_1.9/...
  ### f90: Note: LD_RUN_PATH     = (null)
  ### f90: Note: LD_OPTIONS = (null)
  /usr/ccs/bin/ld -t -R/software/SUNWspro/lib:/opt/SUNWspro/lib -o a.out ...
  /SUNWspro/SC5.0/lib/crti.o /software/SUNWspro/SC5.0/lib/crt1.o ...
  rm temp_f90.o
An excutable binary called a.out will be produced (it is assigned the executable file attribute automatically). To run this simply type the file name:
    a.out
    Hello world!  
The programme prints the string "Hello world!" to the screen. You may want to change the name of the executable produced by the compiler --- use the -o option:
  f90 -o hellow hello.90
will produce an executable called hellow. N.B. Using the -o option is a good idea --- if a file called a.out already exists the compiler will overwrite it without warning.

2.4. Problems With the Workshop 5.0 Compilers

We have found significant problems with the 5.0 compilers: first, according to the Numerical Algorithms Group (NAg), their numerical library source code will not compile with this version of Sun Workshop (apparently due to compiler bugs) and so NAg have not released libraries suitable for linking to the 5.0 compilers; secondly there appear to be problems using the Fortran 5.0 compilers with dbx (the supplied debugger). For these reasons we still maintain the 4.2 compilers.

2.5. Which version am I using?

It is very easy to get confused over compiler versions. The simplest way to check which compiler you are using is the use the -V (upper-case) flag, for example:
    f90 -V graph.f90
    f90: Sun WorkShop 6 update 1 Fortran 95 6.1 2000/09/11
    .
    .  

2.6. The man Pages and On-line Full Documentation

The man pages for the Workshop 4.2, 5.0 and 6.0 compilers are installed in
    /software/SUNWspro_4.2/man
    /software/SUNWspro/man
    /software/workshop6/utils/SUNWspro/man
respectively. These can be accessed by appending the required path to your MANPATH environment variable.

The full documentation for the Sun Fortran compilers is available on-line at docs.sun.com:

2.7. Workshop 4.2 Compilers

The full paths for the Workshop 4.2 compilers are /software/SUNWspro_4.2/bin/f77 and /software/SUNWspro_4.2/bin/f90 so that, for example, one can type
     /software/SUNWspro_4.2/bin/f90 <source_file> 
to use the 4.2 Fortran 90 compiler. For convenience, the command oldf90 accesses this compiler directly (it's a link from /usr/local/bin/oldf90 to /software/SUNWspro_4.2/bin/f90 and so should be on your path).

If you have problems with the 5.0 compilers we recommend tryingthe 4.2 compilers before contacting ISD.

2.8. Mixing (the 4.2, 5.0 and 6.0) Compilers

As a rule, don't! All source code to be linked (whether statically or dynamically) should be compiled with the same compiler --- this is "more" true of Fortran 90 than Fortran 77 since data-structures can be more complex with the former.


...previousup (conts)next...



About this document:

Produced from the SGML: /home/isd/public_html/_compilers_unix_fortran/_reml_grp/compilers_Fortran.reml
On: 20/2/2002 at 9:56:3
Options: reml2 -i noindex -l long -o html -p multiple