Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 210951 - PKG_CONFIG_PATH needs to be set for EPREFIX if an older .pc file (older libs) exists outside of EPREFIX
Summary: PKG_CONFIG_PATH needs to be set for EPREFIX if an older .pc file (older libs)...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All All
: High critical (vote)
Assignee: Gentoo non-Linux Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-21 09:32 UTC by Markus Duft (RETIRED)
Modified: 2008-12-05 19:54 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
the proposed patch for pkgconfig (pkgconfig-path.patch,2.62 KB, patch)
2008-02-21 09:58 UTC, Markus Duft (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Duft (RETIRED) gentoo-dev 2008-02-21 09:32:12 UTC
PKG_CONFIG_PATH is never changed. i fixed the issue for me by applying the attached patch for pkgconfig.

Reproducible: Always

Steps to Reproduce:
1. emerge pkgconfig
2. try to use pkgconfig if there's a newer version of some package installed in /usr/local (PKG_CONFIG_PATH points there)
3. things get messed up, since pkgconfig finds things in /usr/local

Actual Results:  
building our own software outside prefix dails, because it detects, that pkgconfig reports a package version lower than the one detected by another script. (because there are different versions of the same package in the base system (gentoo linux in this case) and the prefix.

Expected Results:  
detect the package installed in prefix.
Comment 1 Markus Duft (RETIRED) gentoo-dev 2008-02-21 09:39:05 UTC
uhm, sorry - in the steps to repo 2. i meant that in the outside system an older version of the package is installed. inside prefix is the newer one.
Comment 2 Markus Duft (RETIRED) gentoo-dev 2008-02-21 09:45:40 UTC
i also tried cutting out the /usr/local bits inside the 99pkgconfig env.d, but it gave me parse errors on merging.... :(
Comment 3 Markus Duft (RETIRED) gentoo-dev 2008-02-21 09:58:52 UTC
Created attachment 144191 [details, diff]
the proposed patch for pkgconfig
Comment 4 Michael Haubenwallner (RETIRED) gentoo-dev 2008-02-26 09:37:58 UTC
Eventually we should explicitly _set_ instead of _extend_ PKG_CONFIG_PATH to "$EPREFIX/usr/$(get_libdir)/pkgconfig:/usr/lib/pkgconfig"

Uhm, how to know the libdir in /usr ?
How does pkgconfig work with multilib ?
Comment 5 Fabian Groffen gentoo-dev 2008-02-26 09:49:05 UTC
is it really necessary to include the host pkgs?

I'm affraid yes, and then we might end up doing something like:

(pegasus:src/backends/monet5) fabian% strings /usr/bin/pkg-config | grep pkgconfig
http://www.freedesktop.org/software/pkgconfig/
atleast-pkgconfig-version
/usr/lib64/pkgconfig:/usr/share/pkgconfig

where the last line is the host-specific pkgconfig built in path.
Comment 6 Fabian Groffen gentoo-dev 2008-05-16 20:30:31 UTC
on a second thought, you probably don't want to find host provided packages using pkgconfig.

So we should set the pkgconfig search path to prefix only.  Comments anyone?
Comment 7 Markus Duft (RETIRED) gentoo-dev 2008-05-19 06:41:00 UTC
+1. i think so too. after all, we change the behaviour of the prefix installed pkg-config only, without nuking the system one :)
Comment 8 Michael Haubenwallner (RETIRED) gentoo-dev 2008-05-19 10:12:06 UTC
(In reply to comment #6)
> on a second thought, you probably don't want to find host provided packages
> using pkgconfig.
> 
> So we should set the pkgconfig search path to prefix only.  Comments anyone?

We definitely must avoid /usr/local/.
But I tend to still keep searching /usr/, although _after_ prefix at all.
This allows prefix to _hide_ system-installed libs (by default), but does not completely ignore them if one decides to package.provide them.
Comment 9 Fabian Groffen gentoo-dev 2008-05-19 10:41:29 UTC
Then we're back at start (and you don't get $200) where we have the problem of not knowing what the vendor specific (host) location of pkg-config files is.
Comment 10 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-12-02 19:53:52 UTC
*ping*

If I read comment #5 correctly, I suffer this bug with X packages! evil
Comment 11 Fabian Groffen gentoo-dev 2008-12-02 20:28:18 UTC
you mean this blocks our profile move?

explains the weird behaviour though...
Comment 12 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-12-02 20:59:28 UTC
(In reply to comment #11)
> you mean this blocks our profile move?
> 
> explains the weird behaviour though...
> 

It explains everything, yes. Is the patch in Comment #3 the target? 

echo "export PKG_CONFIG_PATH=${EPREFIX}/usr/lib/pkgconfig\${PKG_CONFIG_PATH:+:}\${PKG_CONFIG_PATH}" >> "${T}"/99${PN}. I don't know how to resolve comment #9, but aren't .pc files dictated to be in a standard location?

"Uhm, how to know the libdir in /usr ?
How does pkgconfig work with multilib ?"

Not a concern anymore I think. amd64 is usr/lib/ only, multilib is dead now.
Comment 13 Fabian Groffen gentoo-dev 2008-12-02 21:13:12 UTC
(In reply to comment #12)
> Not a concern anymore I think. amd64 is usr/lib/ only, multilib is dead now.

The comment is about the host, which /is/ multilib.  So it may be lib, lib32, lib64, lib/amd64, lib/sparcv9 and what more was invented on this globe.
Comment 14 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-12-02 22:03:14 UTC
(In reply to comment #11)
> you mean this blocks our profile move?
> 
> explains the weird behaviour though...
> 

Wow. /me kicks self for not finding this earlier! (confirmed, all my troubles are gone by setting PKG_CONFIG_PATH)

Now, we just need to settle on a convention for what to set PKG_CONFIG_PATH equal too. I fear that Comment #3 is not quite correct. Alternatively, I may release some experimental stuff for linux only if a convention cannot be established properly >=)
Comment 15 Michael Haubenwallner (RETIRED) gentoo-dev 2008-12-03 17:18:18 UTC
(In reply to comment #5)
> is it really necessary to include the host pkgs?

We could indeed try to go *without* the host path, as we (usually) emerge all dependencies into prefix.
Comment 16 Fabian Groffen gentoo-dev 2008-12-03 18:05:21 UTC
I'll try to implement that later tonight.  Then we can see what breaks.
Comment 17 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-12-03 18:20:45 UTC
(In reply to comment #16)
> I'll try to implement that later tonight.  Then we can see what breaks.
> 

Nothing breaks (on linux). I did an emerge -e world (some 400 packages) and it completed with PKG_CONFIG_PATH set explicitly to:
%% echo $PKG_CONFIG_PATH 
/home/jolexa/portage/linux-64/usr/lib/pkgconfig
Comment 18 Fabian Groffen gentoo-dev 2008-12-03 20:13:40 UTC
I don't get this any more.  pkg-config uses the prefix paths by default, so what does setting PKG_CONFIG_PATH help?
Comment 19 Michael Haubenwallner (RETIRED) gentoo-dev 2008-12-04 08:01:05 UTC
AFAICT, it helps on systems where PKG_CONFIG_PATH is set to something like /usr/local/* in /etc/profile (Interix IIRC), when prefix-bash is started from interix-ksh fex, or when sourcing prefix/etc/profile in interix-shell.

Another option could be to explicitly *unset* PKG_CONFIG_PATH in prefix/etc/profile.

Comment 20 Fabian Groffen gentoo-dev 2008-12-04 08:22:16 UTC
I prefer the last option (to unset it)
Comment 21 Michael Haubenwallner (RETIRED) gentoo-dev 2008-12-04 09:38:36 UTC
(In reply to comment #19)
> (Interix IIRC)

It wasn't on Interix - it was on _my_ Gentoo Linux desktop, where x11-libs/qt-3.3.8-r4 sets PKG_CONFIG_PATH:
$ grep PKG_CONFIG_PATH /etc/env.d/*
/etc/env.d/45qt3:PKG_CONFIG_PATH=/usr/qt/3/lib/pkgconfig

Ohw: x11-libs/qt-3.3.8-r4 pulled in by:
    dev-db/mysqlnavigator-1.4.2
    www-client/opera-9.62

I've not used both for years now...
Comment 22 Markus Duft (RETIRED) gentoo-dev 2008-12-05 12:42:15 UTC
hmm... i just ran into another problem with cross-prefix... if i have pkg-config installed into one prefix, and want it to find packages from the other prefix... i think the only possible way to go is to set PKG_CONFIG_PATH=${EPREFIX}/usr/lib/pkgconfig:$PKG_CONFIG_PATH.

the only question i have left is, wether i should include the existing PKG_CONFIG_PATH value in the new one, or set to EPREFIX exclusively...?
Comment 23 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2008-12-05 19:54:43 UTC
http://overlays.gentoo.org/proj/alt/changeset/35131 (and r35135)

Choose to go with:
echo "PKG_CONFIG_PATH=${EPREFIX}/usr/lib/pkgconfig:${EPREFIX}/usr/share/pkgconfig" >> "${T}"/99${PN}

Note that usr/share/pkgconfig is the correct location for some .pc files as well. (Some people don't know this - I didn't either)