PGI Guide to F90 OpenGL

This guide is intended to help PGI customers build and use the F90 Open Graphic Language Libraries version 1.2.9 using the PGI 6.0 release compilers on both 32 and 64-bit Linux.

Building and Using the F90GL library

The f90gl library is a public domain implementation of the Fortran 90 bindings to the OpenGL graphics libraries. Information about f90gl can be found at http://math.nist.gov/f90gl.

Steps to build f90gl on Linux using the PGI Compilers

  1. Download and unpack the f90gl and glut gzipped tar file for Unix found at http://math.nist.gov/f90gl/software.html
  2. Copy the "glut.h" and "glutf90.h" header files from the glut "include/GL" directory to the f90gl-1.2.7 "include/GL" directory.
  3. Move to the f90gl-1.2.9 directory.
  4. Download the make file we've created for use with Mesa (mfpgimesa) or OpenGL (mfpgiopengl) depending on your system. You may need to modify these make files for use with you system.
  5. Ensure the PGI Compilers, pgf90 and pgcc, are in your path.
  6. Build the compilers by typing
    make -f mfpgimesa MESAHOME=/usr
    or
    make -f mfpgiopengl OPENGLHOME=/usr
    "MESAHOME" and "OPENGLHOME" should be the the base directory where the mesa or openGL libraries and include files are located. A "/lib" and "/include" are appended to this directory name. For 64-bit systems, add "MODE=64" to ensure the correct 64-bit libraries are used.
  7. The new libraries are now available in "./lib".

Using the f90gl example programs on Linux with the PGI Compilers

The f90gl package contains several example program which illustrate how the f90gl libraries can be used. To compile these programs perform the following steps:

  1. Move to the "examples" directory.
  2. Download the make file we've created for use with Mesa (mfpgimesa-ex) or OpenGL (mfpgiopengl-ex) depending on your system. You may need to modify these make files for use with you system.
  3. Ensure the PGI Compilers, pgf90 and pgcc, are in your path.
  4. Build the compilers by typing
    make -f mfpgimesa-ex MESAHOME=/usr
    or
    make -f mfpgiopengl-ex OPENGLHOME=/usr
    "MESAHOME" and "OPENGLHOME" should be the the base directory where the mesa or openGL libraries and include files are located. A "/lib" and "/include" are appended to this directory name. For 64-bit systems, add "MODE=64" to ensure the correct 64-bit libraries are used.
  5. The example programs are: blender, checker, fbitfont, fscene, glutdino, molehill, olympic, scube, sphere, trivial, modview, stars, plotfunc, eps.

Some Problems we encountered:

Problem Possible Solutions
The linker cannot find a library - Ensure that "MESAHOME" or "OPENGLHOME" is set correctly.
- Make sure the library is installed. You may need to install the mesa, mesaglu, and mesaglut packages or the XFree86 package.
- The linker my not be resloving the library name correctly. This can happen when a shared library (.so) is named using its version number (example libXaw.so.6.1) but is missing a soft link using the base libary name (example libXaw.so -> libXaw.so.6.1). To fix, add the soft link to the correct library.
Incompatible libraries when compiling 64-bit - You are using the 32-bit libraries. Make sure you've set the "MODE" and you are using the "/usr/lib64" and "/usr/X11R6/lib64" libraries if you've added soft links.
The compiler cannot find the "glut.h" or "glutf90.h" header files. - Ensure you have copied the glut headers to your "include/GL" directory.
- Make sure the "-I../include" was not removed the the "OGLINC" variable in the make file.
The compiler cannot find the "gl.h" or "glu.h" header files. - You most likely do not have the appropriate development package installed. You must have the mesa-devel, mesaglu-devel, and mesaglut-devel packages or the XFree86-devel package installed.
The following error occurs:
"PGC-S-0040-Illegal use of symbol, __int64_t"
- You have used "-I/usr/include" on the commands line. Remove this option. A few header files in "/usr/include" needed to be modified for use with the PGI compilers. Putting "-I/usr/include" on the command line forces the use of these incompatible versions.
Click me