I would like to compile and link a CFX 11.0 user fortran routine on a system which has the Portland group fortran compiler installed but which does not have CFX 11.0 installed.

How can I do this?

You can always get the syntax of the required fortran compile and link commands by running the cfx5mkext command on a system which does have CFX installed.

There are number of required cfx header files located in the following location on the Unix file system:


You would need to copy those CFX header files from a machine which has CFX installed to an include folder on the machine where you want to build the library.

Suppose you want to compile and link a routine named test.F located in the current working directory on a Linux machine. You have copied the required header files to a folder named include in the current working directory.

To compile the user routine in single precision, you would type the following command (the explicit path to the pgf90 command is included in this example):

/usr/pgi/linux86-64/7.0-2/bin/pgf90 -fpic -Msecond_underscore -g77libs -i4 -r8 -I./include -o test.o -c test.F

When you link the object file you created in the compile step (test.o), you need to include the -Bstatic_pgi flag so thatthelibrary can be used on a Linux system where the Portland group compiler is not installed:

/usr/pgi/linux86-64/7.0-2/bin/pgf90 -shared -g77libs -Bstatic_pgi -o libtest.so test.o

Note the naming convention for the files test.o and libtest.so for the user routine named test.F.

Also note that the required CFX header files were located in the directory ./include

You would copy the test.o and libtest.so files to the proper location (linux in the run directory for 32-bit linux systems, linux-amd64 for a 64-bit Opteron system).

For double precision, the link command would be identical, but the compile command would be issued as:

/usr/pgi/linux86-64/7.0-2/bin/pgf90 -fpic -Msecond_underscore -g77libs -i4 -r8 -DDOUBLE_PRECISION -I./include -o test.o -c test.F

You would then copy the test.o and libtest.so files to the appropriate folders in the run directory (linux/double, linux-amd64/double).

Show Form
No comments yet. Be the first to add a comment!