Link to a library file on the IU research supercomputers

In most Linux-based or Unix-like operating systems, such those running on the research supercomputers at Indiana University, you can link to a library file located in a standard directory (for example, /usr/lib/lib or /usr/local/lib) by using the -l (lowercase L) flag. For example, using the -lx flag will link to the or libx.a library file stored in one of the standard directories.

If a library file is not located in a standard directory, use the -L (uppercase L) flag to specify the path to the file. For example, if the LAPACK library is in the /libapps/lapack directory, use the following to link with it:

  -L/libapps/lapack -llapack

The linker 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 .a and .so extensions are found in a directory, the .so file is used.

For more, see the ld manual page.

This is document akqm in the Knowledge Base.
Last modified on 2020-07-01 10:43:31.