OpenGL under Linux with ifc

OpenGL under Linux with ifc

I was wondering if anyone managed to get the f90gl
package for OpenGL fortran bindings compiled up and
working under Linux using the Intel Fortran compiler.

Any caveats or points of note?


7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Yes, I've got it working with 5.1
Its quite complex as many of the
files have to be changed. I sent
a copy of the files to Bill Mitchell
(author of f90gl). Try him, and if not
I'll send you the files

Hi David,
Is it possible for you to send me the files or
post a URL for it?

joseph_antony at yahoo dot com


I'd be very happy if you could give me hints how to get f90gl working. Could you send me e.g. the Makefile?
Thanks in advance!

Bill Mitchell has posted f90gl allowing
the use of native OpenGL/Mesa via ifc.

The site is:

Thanks to davidwriter for pointing this out.


I am tring to install f90gl on my machine, but it's SO hard to install.
I am using RH8.0 with
1. kernel 2.4.28-24.8.0
2.for openGL
3. For glut
4. ifc 7.0
What I need to do to install f90gl then?

Wish f90gl to be easier to install, anyway.


It took several tries, but I finally managed to install f90gl under Mandrake Linux 9.0 (2.4.19 kernel). Mandrake is (was?) based on Red Hat, so the steps I took might work on RH machines too.

f90gl refused to work with the distro's RPMs for Mesa and GLUT (libMesaGL*, libMesaGLU*, libMesaglut* in both developer and non-developer flavors), even when I specified the libraries' location (they are in /usr/X11R6/lib rather than in /usr/lib for some reason).

I downloaded the library and demos tarballs for Mesa 5.0 from Sometime recently, the notes on installation (click on "Installation" in the "Download/Install" section of the left-hand navigation menu) added a comment about a workaround for a libtool problem in linking a C++ library. The workaround made the error messages (undefined references, etc.) from my previous attempts at f90gl installation go away.

After unpacking the tarballs and cding to the Mesa directory, the following commands took care of the installation:

    export LDFLAGS="-lstdc++"              <-- this makes all the difference

    ./configure --prefix=/usr


    make install

    make check; make exec                      <-- optional testing

This placed the libraries,, and in /usr/lib and the header files glut.h and glutf90.h in /usr/include/GL (i.e., MESAHOME is /usr).

Note: "make exec" runs a bunch of demos one after another, including a benchmarking thingy which took a longish time to run (~45 minutes on my 500 MHz Celeron laptop, not including the other demos).

Luckily, f90gl seemed happy with the GLUT 3.7 included in (the now properly installed) Mesa 5.0.

(If you decide to try installing the GLUT 3.7.1 tarball from NIST's f90gl website, here are some comments based on the unsuccessful attempt at installing f90gl where I tried using GLUT 3.7.1 to fix the problems: make sure you grab the glut_data-3.7 tarball *and* the glut-3.6 tarball from -- the glut_data-3.7 tarball's "data" and "progs" directories must be moved into the directory created when the glut-3.7.1 tarball is unpacked, and the contents of the glut-3.6 tarball's "progs" directory must be copied to the glut-3.7.1 "progs" directory. Otherwise, mkmkfiles.imake chokes. will need to be modified (make sure /usr/include is in the "EXTRA INCLUDES" line, put the actual library names in instead of libMesa*, etc.) a bit too. I suspect the attempt to compile GLUT would have been successful had I known about the above Mesa workaround, as GLUT and f90gl were producing the same "undefined reference" error messages.)

After unpacking the f90gl (version 1.2.7) tarball, I modified fppincs/fpp8lim as follows: I grepped for the OpenGL versions in glu.h ('grep VERSION /usr/include/GL/glu.h') and added lines for them (possibly not necessary to do so however), then deleted the GLU 1.1 tesselation line (merely commenting it out seemed to produce a syntax error), ending up with

----------------------------- fpp8lim -----------------------------


#define OPENGL_1_1
#define OPENGL_1_2
#define OPENGL_1_3
#define INTEL

----------------------------- fpp8lim -----------------------------

In the makefile mf8lim7 (I have IFC 7.0 installed), I edited the lines for OGLINC and OGLLIB, as well as a couple of other lines where I have not gotten around to sorting out environment var iables properly. My modified makefile begins like this (my comments begin and end with '###' for easier spotting, and hopefully the forum software will not muck up the formatting too badly):

----------------------------- mf8lim7 -----------------------------



# This makefile has been tested on
#   computer: Pentium III
#         OS: Linux 2.4.18-18 (Red Hat 8.0)
#   compiler: Intel Fortran Compiler for Linux 32bit Version 7.0
#          C: gcc 3.2
#     OpenGL: Mesa 3.0, Glut 3.7.1, f90gl 1.2.5
#------------- User configuration parameters ---------------

# modify these for your system

### define MESAHOME, as have not yet defined appropriate environment variable ###

# any relative paths should be relative to a subdirectory of the directory
# containing this makefile

# procedure name mangling approach used by your fortran compiler
#  LOWERCASE  - convert to lower case
#  UNDERSCORE - convert to lower case and append underscore
#  UPPERCASE  - convert to upper case
#  MODULE     - prepend module_name_MOD_ (used for faking out F)

# the include directory(ies) for OpenGL (GL is a subdirectory of it) and GLUT
### do not have /local/apps directory, so get rid of reference in OGLINC###
#OGLINC = -I$(MESAHOME)/include -I/local/apps/glut/include
OGLINC = -I$(MESAHOME)/include

# the include directory for X11
X11INC = -I/usr/X11R6/include

# the library directory(ies) for OpenGL and GLUT

# the OpenGL, GLU and GLUT libraries
### "Mesa" does not appear in the library names ###
#OGLLIB = -lglut -lMesaGLU -lMesaGL
OGLLIB = -lglut -lGLU -lGL

# the library directory for X11
# is in /usr/lib
X11LIBDIR = -L/usr/X11R6/lib

# the X11 libraries
X11LIB = -lXaw -lXt -lXmu -lXi -lXext -lX11 -lm

# extra characters to put into the library names, in case there is
# more than one OpenGL installed.  For example if LIBNAME is Mesa
# then the libraries will be libMesaf90GL.a etc.

# commands for making a library
MAKELIB = ar rcv
RANLIB = ranlib

# fortran 90 compiler and compiler flags
### compiler is not in root's default path, so I will specify the full path here ###
#F90 = ifc
F90 = /opt/intel/compiler70/ia32/bin/ifc

# C compiler and compiler flags
CC = gcc
# The suffix for module files generated by the compiler.  If none are
# generated, then use 'junk' or something (do not leave it blank).
MOD = mod

# The compiler flag to get at the module file for opengl_kinds in ../include/GL
USEMOD = -I../include/GL

#----------- end of user configuration parameters ------------
### rest of makefile left unaltered ###

----------------------------- mf8lim7 -----------------------------

Finally, to install f90gl, I ran



    make -f mf8lim7

which compiled uneventfully. Then, to test things out,



    cd examples


    make -f mf8lim7

Then, at successful compilation, I proceeded to run some of the demos, e.g.




Okay, this ran quite a bit longer than I expected. Sorry about that. I kept transcripts of the various configure and make stages, so if you want the gory details, I can email them or stick them up on a website.

Anyway, good luck. Oh, and if anyone knows of a good tutorial on how to use this stuff (I'm interested in setting up a "user friendly" GUI to provide inputs t o a Fortran code and then plot the results, not in writing games or doing animation per se), I would love to know about it.


Leave a Comment

Please sign in to add a comment. Not a member? Join today