cernlib-static (1) - Linux Manuals

cernlib-static: get libraries needed to link with CERN Program Library


cernlib-static - get libraries needed to link with CERN Program Library


cernlib-static [options] library[/version] ...


cernlib-static writes to standard output a list of object libraries needed to link a program with the given library(s) of CERNlib; other libraries needed implicitely, both CERNlib and system libraries, are added automatically. library may be any of the CERNlib libraries using a short name like packlib, mathlib, graflib, phtools...

version allows to specify which version to use for this library, see usage notes.


cernlib-static recognizes the following options:

-G driver
specifies the graphics interface to use. Defaults to X11. The choices available depend on the system in use:
all systems. On HP/UX X11R5 is used when available on the system.
all systems. On HP/UX Motif1.2 is used when available on the system.
Vendor specific graphics, DEC Ultrix, IBM/RS6000, SUN only
Vendor specific graphics, Apollo only.
Vendor specific graphics, IBM/RS6000 and SGI only.

obsolete option. Ignored.

Don't link against system lapack and blas.

do not automatically add vendor libraries needed to link, but not specified by the user.

-v version
Use level version of CERNlib libraries; version can be pro, new or old, or you may specify the explicit version number; the default version is pro. The global version can be overwritten for an individual library by specifying the library as library/version.


cernlib-static expects to find the CERNlib directory tree in /cern; if your system does not have this, set the environment variable CERN to contain the name of the root directory for the CERNlib tree.

After the library a version for that library different from the default version may be specified. The possible values are as for the -v option, or in the case of graflib as for the -G option.


As cernlib-static writes the list of libraries to standard output, using it as a command will show the list of libraries generated by cernlib-static. Also, it can be used like other commands in the command line surrounded by back quotes(`). At CERN you should use the hepf77 command to link on your system as this gives the compiler parameters which are compatible with Cernlib (in particular for xlf on IBM/RS6000 and fort77 on HP/UX ) you could type:

hepf77 your.o `cernlib-static`
to link your object file with routines from packlib and kernlib; you need not specify packlib, as this is added automatically. Also all kernlib routines are included in packlib. If your application uses graflib and the Motif interface, the command would be:
hepf77 your.o `cernlib-static graflib/Motif`
Again packlib need not be specified.

If you prefer to have an environment variable CERNLIB set at login time, put the following into

 .profile for sh, ksh or similar
CERNLIB=`cernlib-static graflib`; export CERNLIB

 .login for users of csh of similar
setenv CERNLIB "`cernlib-static graflib`"
The CERNLIB variable can then be used in the link command instead of calling the cernlib-static command.


There is no checking that any of the libraries (or options) are valid or exist. Most loaders only check the libraries once for symbols, hence the order the libraries given is important. This command does not check that the order given is correct.

For systems other than Alliant, Apollo, DEC Ultrix, Digital Unix (or DEC OSF), HP/UX, SGI, Linux, Sun OS, Sun Solaris the libraries given for the graphics interface are likely to be wrong, even for X11 and Motif.


The cernlib-static command is available in the /cern/pro/bin directory in the CERNlib tree.


If you have suggestions for improvements, or find bugs, please report them to

cernlib [at]

Your report must state which version of CERNlib you are using, or the output of the command:
what `which cernlib-static`