Compilers FAQs

How do I set up my C/C++/Fortran compiler?
Fortran/C/C++ compilers can be used on the command line. But often in bigger projects, this is performed by the following recipe: prompt> configure OPTIONS prompt> make

This recipe assumes that your environment variables have been set up correctly for the compiler that you want to use. To see your current compiler environment settings, the command compenv has been provided:
prompt> compenv

Only Sun Studio Fortran is available. f95 which supports the Fortran 90/95/200x standards and f77 which supports Fortran 77.

Currently, we have two stable compiler sets for C/C++ installed Sun Studio (cc/CC/as) and GCC (gcc/g++/gas). Some projects may require one set of compilers while other projects another. Most free software projects will work with Sun Studio, so that is the default. Occasionally a project will require GCC. To choose GCC: prompt> gnuset

To return to the default of Sun Studio: prompt> sunset

Also, an experimental compiler with bounds checking is being investigated: (bcgcc/bcg++/gas). For more information about bounds checking view the and how to use it, see Network Theory LTD Free Software Manuals and William Bader GCC Bounds Checking Example.

To choose it: prompt> bcset

How do I use GSL?
GSL is a free-software/open-source alternative to IMSL. Currently, GSL v. 1.11 is installed. It works well with XEmacs. The documentation is available in XEmacs; type M-x info or press the Info button. The documentation is in the Scientific Software section; click on gsl-ref. View GNU Reference Manual

View documentation in paperback form

Here is an example:  
Suppose the program is called chisq.c. XEmacs compiles C programs with the make utility. For that to work, place the following at the end of your program: /*

Local Variables:
compile-command: "make chisq.out"
End: */

From now on when you open this file, XEmacs will know what to do; the first time, however, you will need to manually tell XEmacs what to do.
Type M-:
and at the minibuffer prompt "Eval:", type "(hack-local-variables)" without the quotes and hit return.

You will also need to create a Makefile ([TAB] means hit the tab key):

%.out: %.c Makefile
[TAB] $(CC) -g -o $@ $< -lgsl -lgslcblas -lm

So, to compile your program; type M-x compile or press the Compile button.

'xport-dynamic' is undefined GSL?
The following error message is indicative of using Sun ld, but passing it options that only GNU ld needs and understands:
ld: fatal: entry point symbol `xport-dynamic' is undefined GSL

The solution is to not pass the -export-dynamic switch to Sun ld since it is not needed and not recognized.

SAS Help

Rodney Sparapani, PhD
Assistant Professor
Institute for Health and Society
(414) 955-8786