Arizona State University

The CERN Program Library, including 64-bit and gfortran

This web page provides information for setting up and building the CERN Program Library (Cernlib) under a Linux operating system on x86 computer chips. These chips include those of the Intel and AMD families, including the AMD64, Opteron, and EM64T chips. The GNU C and Fortran compilers are used. The build procedures are also fully compatible with 32-bit systems.

The venerable CERN Program Library was 'frozen' in 2002 and is no longer maintained. It is programmed largely in Fortran (mostly Fortran 77 compatible), and includes some C codes. Current and future programming at CERN has shifted primarily to C++.

However, the Program Library is still widely used. New computer chips and compilers sometimes bring some incompatabilities with the legacy build scripts. For example, the transition of the GNU compilers from version 2.95 to versions >3.0 created several problems. Some code and script modifications were necessary, and were incorporated into the "2003" versions. A few additional bug fixes and some modifications to handle 64-bit chips were made to the "2004" version. Some additional changes, mainly regarding temporary files, were made for the 2005 version.

Some users have found additional things that needed to be changed. Some of these were for additional 64-bit problems. More importantly, changes were needed to allow compilation with gfortran in the GNU gcc 4+ compilers. It should be noted that the 4.0.x versions of gfortran (e.g., SuSE 10.0) are not satisfactory and will fail. One must have at least a 4.1 version (e.g., SuSE 10.1). Web sites for the modifications include

The changes from these web sites have been included in the patches used here, albeit with a few corrections and modifications.

Patch files have been generated that will enable Cernlib to be installed on both 32-bit and 64-bit machines, and with either gcc 3.x or 4.x compilers. The appropriate configuration is detected in the build scripts. It is assumed that gcc 4.x utilizes gfortran instead of g77.


To establish the Cernlib on your computer, copy the following README files into a new directory, such as /usr/local/cern/2005 or /cern/2005. The README.first file provides details on setting up and building the Cernlib. (The other README filecontains achival information.) Then create a 'tar' subdirectory and change ('cd') into it. Connect to the CERN Program Library web site . Under the "Downloads" link, click on the "compressed tar files" link of the "Development sources." The direct link to this location is http://cernlib.web.cern.ch/cernlib/download/2005_source/tar/ . Download all of the 'src_*.tar.gz' files. (The corresponding '*.contents' files are optional.) There are 15 such files, although some are for auxilliary programs and are not needed for the Cernlib proper. In addition, download the 'include.tar.gz' file. The 'gcalor.tar.gz' file is optional. It is an old version. If downloaded, change the name to something like 'gcalor_old.tar.gz'.

The following files must now be downloaded from this (current) site.

Building the library may now proceed, as stated in the README.first file.


You may send an e-mail message to me at Joseph.Comfort 'at' asu.edu