Library Search Options - 2021.2 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2021-12-15
Version
2021.2 English
-l <library name>
By default, the compiler searches only the standard libraries, such as libc, libm, and libxil. You can also create your own libraries. You can specify the name of the library and where the compiler can find the definition of these functions. The compiler prefixes lib to the library name that you provide.

The compiler is sensitive to the order in which you provide options, particularly the -l command line switch. Provide this switch only after all of the sources in the command line.

For example, if you create your own library called libproject.a. you can include functions from this library using the following command:

Compiler Source_Files -L${LIBDIR} -l project
Important: If you supply the library flag -l library_name before the source files, the compiler does not find the functions called from any of the sources. This is because the compiler search is only done in one direction and it does not keep a list of available libraries.
-L <lib directory>
This option indicates the directories in which to search for the libraries. The compiler has a default library search path, where it looks for the standard library. Using the -L option, you can include some additional directories in the compiler search path.