Bug 88992 - man page PKG_CONFIG_PATH vs. PKG_CONFIG_LIBDIR
Summary: man page PKG_CONFIG_PATH vs. PKG_CONFIG_LIBDIR
Status: RESOLVED MOVED
Alias: None
Product: pkg-config
Classification: Unclassified
Component: src (show other bugs)
Version: unspecified
Hardware: All All
: medium enhancement
Assignee: pkg-config
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-05 09:35 UTC by Liviu Ionescu
Modified: 2018-08-25 12:52 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Liviu Ionescu 2015-02-05 09:35:57 UTC
The current manual page reads:

.I "PKG_CONFIG_PATH"
A colon-separated (on Windows, semicolon-separated) list of
directories to search for .pc files.  The default directory will
always be searched after searching the path; the default is
.I \%libdir/\fPpkgconfig:\fIdatadir\fP/pkgconfig where \fIlibdir\fP is
the libdir for \fIpkg-config\fP and \fIdatadir\fP is the datadir
for \fIpkg-config\fP when it was installed.

.I "PKG_CONFIG_LIBDIR"
Replaces the default \fIpkg-config\fP search directory, usually \fI/usr/lib/pkgconfig\fP


On the other hand, the source code for this logic is:

 search_path = getenv ("PKG_CONFIG_PATH");
 if (search_path) 
   {
     add_search_dirs(search_path, G_SEARCHPATH_SEPARATOR_S);
   }
 if (getenv("PKG_CONFIG_LIBDIR") != NULL) 
   {
     add_search_dirs(getenv("PKG_CONFIG_LIBDIR"), G_SEARCHPATH_SEPARATOR_S);
   }
 else
   {
     add_search_dirs(pkg_config_pc_path, G_SEARCHPATH_SEPARATOR_S);
   }

My understanding of the above is the following:

PKG_CONFIG_PATH

A colon-separated (on Windows, semicolon-separated) list of directories to be searched for .pc files before the default locations.

PKG_CONFIG_LIBDIR

A colon-separated (on Windows, semicolon-separated) list of directories to replace the default pkg-config search path, usually defined at build time.


I saw some other comments related to PKG_CONFIG_PATH being overwritten by PKG_CONFIG_LIBDIR; the source code does not reflect this, the two environment variables seem independent; when defined, PKG_CONFIG_PATH is always searched before anything else; similarly, when defined, PKG_CONFIG_LIBDIR will always replace the system locations.

A clarification in the man page would be highly appreciated.
Comment 1 Dan Nicholson 2015-02-21 20:12:40 UTC
You're understanding is correct. Basically the search path is $PKG_CONFIG_PATH followed by the built-in defaults. You can override the built-in default by specifying PKG_CONFIG_LIBDIR. I actually just opened bug89268 to track changing this to PKG_CONFIG_SYSTEM_PATH to be clearer.

Do you have any concrete suggestions on how the documentation could be changed to be clearer?
Comment 2 Liviu Ionescu 2015-02-21 20:40:36 UTC
> concrete suggestions

what about:

PKG_CONFIG_PATH

If defined, this variable defines a colon-separated (on Windows, semicolon-separated) list of custom folders to be searched for .pc files **before** the system locations. 

PKG_CONFIG_LIBDIR

This variable defines a colon-separated (on Windows, semicolon-separated) list of folders to replace the default pkg-config search path, which includes the system libraries. The default search path depends on distribution and is usually configured when the pkg-config executable is compiled. PKG_CONFIG_LIBDIR is intended for cross builds when it should point to the cross libraries, to avoid referring native libraries in cross application.
Comment 3 GitLab Migration User 2018-08-25 12:52:40 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pkg-config/pkg-config/issues/6.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.