Concept

Pkg-config

pkg-config is a computer program that defines and supports a unified interface for querying installed libraries for the purpose of compiling software that depends on them. It allows programmers and installation scripts to work without explicit knowledge of detailed library path information. pkg-config was originally designed for Linux, but it is now also available for BSD, Microsoft Windows, macOS, and Solaris. It outputs various information about installed libraries. This information may include: Parameters (flags) for C or C++ compiler Parameters (flags) for linker Version of the package in question The first implementation was written in shell. Later, it was rewritten in C using the GLib library. When a library is installed (automatically through the use of an RPM, , or other binary packaging system or by compiling from the source), a .pc file should be included and placed into a directory with other .pc files (the exact directory is dependent upon the system and outlined in the pkg-config man page). This file has several entries. These entries typically contain a list of dependent libraries that programs using the package also need to compile. Entries also typically include the location of s, version information and a description. Here is an example .pc file for libpng: prefix=/usr/local exec_prefix=prefixlibdir={prefix} libdir={exec_prefix}/lib includedir=execprefix/includeName:libpngDescription:LoadsandsavesPNGfilesVersion:1.2.8Libs:L{exec_prefix}/include Name: libpng Description: Loads and saves PNG files Version: 1.2.8 Libs: -L{libdir} -lpng12 -lz Cflags: -Iincludedir/libpng12Thisfiledemonstrateshowlibpnginformsthatitslibrariescanbefoundin/usr/local/libanditsheadersin/usr/local/include,thatthelibrarynameislibpng,andthattheversionis1.2.8.Italsogivestheadditionallinkerflagsthatareneededtocompilecodethatusesthislibrary.Hereisanexampleofusageofpkgconfigwhilecompiling:{includedir}/libpng12 This file demonstrates how libpng informs that its libraries can be found in /usr/local/lib and its headers in /usr/local/include, that the library name is libpng, and that the version is 1.2.8. It also gives the additional linker flags that are needed to compile code that uses this library. Here is an example of usage of pkg-config while compiling: gcc -o test test.c $(pkg-config --libs --cflags libpng) pkg-config can be used by build automation software such as CMake.

About this result
This page is automatically generated and may contain information that is not correct, complete, up-to-date, or relevant to your search query. The same applies to every other page on this website. Please make sure to verify the information with EPFL's official sources.

Graph Chatbot

Chat with Graph Search

Ask any question about EPFL courses, lectures, exercises, research, news, etc. or try the example questions below.

DISCLAIMER: The Graph Chatbot is not programmed to provide explicit or categorical answers to your questions. Rather, it transforms your questions into API requests that are distributed across the various IT services officially administered by EPFL. Its purpose is solely to collect and recommend relevant references to content that you can explore to help you answer your questions.