Link to a library file on the IU research computing systems

In most Linux-based or Unix-like operating systems, such those running on the research computing systems at Indiana University, you can link to a library file located in a standard directory (e.g., /usr/lib/lib or /usr/local/lib) by using the -l (lowercase L) flag. For example, using the -lx flag will link to the libx.so 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 2018-07-16 13:40:34.

Contact us

For help or to comment, email the UITS Support Center.