On Big Red or Quarry at IU, how do I link to a library?
Note: Following a system-wide upgrade in December 2012, Quarry now runs Red Hat Enterprise Linux version 6 (RHEL 6) and uses the Modules package (instead of SoftEnv) for manipulating user environments. For more, see Information about the 2012 upgrade to Quarry at IU. If you encounter any problems or have questions, email the High Performance Systems group.
Note: Big Red is scheduled to be retired from service in June 2013. Indiana University is replacing it with Big Red II, the fastest university-owned supercomputer in the nation, capable of performing one quadrillion floating-point operations per second (1 petaflop). Based on Cray XE/XK technology, Big Red II has 676 XK nodes (each containing one AMD "Interlagos" processor and one NVIDIA "Kepler" GPU) and 344 XE nodes (each containing two AMD "Abu Dhabi" processors). For more, see Big Red II at Indiana University.
On Unix systems (including Big Red
and Quarry at Indiana University), if the
library file resides in one of the standard directories (i.e.,
/usr/local/lib), you can
link to the library by using the
(lowercase L). For example, linking with the
actually means the library file is
libx.so in one of the standard directories.
If the library is not in a standard directory, use the
-L flag (uppercase L) to explicitly specify
the library file search path. For example, if the LAPACK library
resides in the
/libapps/lapack directory, use the
following to link with it:
ld usually searches in the
directories specified by the
-L flag first,
and then in the standard directories. The first match will satisfy the
search. If files with both
extensions are found in a directory, the
.so file is
For more, see the
ld man page. Also, see When compiling a C program in Unix, why do I get "ld: Unresolved:"?
Note: In some special cases, you cannot link to a
-l flags; for example, on
Solaris systems, the Sun Performance Library uses
Last modified on November 01, 2012.