Hi gobolinux-devel,

I recently submitted a bug report regarding PKG_CONFIG_PATH in
Rootless.  I'm forwarding the bug report to the devel list to
facilitate greater discussion.

You can see the original bug report here:

http://bugs.gobolinux.org/view.php?id=144


I think Rootless can set PKG_CONFIG_PATH to a more useful value than
it currently does.

At present, Rootless (in StartRootless) sets PKG_CONFIG_PATH to:

export PKG_CONFIG_PATH=${goboPrefix}/System/Links/Libraries/pkgconfig${PKG_CONF\
IG_PATH:+:$PKG_CONFIG_PATH}

This is correct as long as Pkgconfig is not installed inside Rootless.

If you install Pkgconfig inside of Rootless, you start to run into
problems.  StartRootless (in Pkgconfig's Environment file) will now
overwrite (and forget) any previous value of PKG_CONFIG_PATH with:

export PKG_CONFIG_PATH=$goboLibraries/pkgconfig

StartRootless will then prepend
${goboPrefix}/System/Links/Libraries/pkgconfig to PKG_CONFIG_PATH as
above.

The result?  (On my system:)

PKG_CONFIG_PATH=\
/home/gobo/System/Links/Libraries/pkgconfig:\
/home/gobo/System/Links/Libraries/pkgconfig

Not only is this redundant, but .pc files provided by the host system
will no longer be found!

According to 'man pkg-config':

 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 lib-
              dir/pkgconfig:datadir/pkgconfig where libdir is the libdir where
              pkg-config and datadir  is  the  datadir  where  pkg-config  was
              installed.

Pkgconfig (inside Rootless) was installed to (in my case)
PREFIX=/home/gobo/Programs/Pkgconfig/<version>.  This means Pkgconfig
will not search the host system's default directories for .pc files.
According to strace, on my system the default directories are:

/usr/local/lib/pkgconfig
/usr/local/lib/pkgconfig/i486-linux-gnu
/usr/local/share/pkgconfig
/usr/lib/pkgconfig
/usr/lib/pkgconfig/i486-linux-gnu
/usr/share/pkgconfig

So, when I try to use Rootless (on Ubuntu) to compile and install a
recent version of GNU Backgammon (for instance), Pkgconfig will not be
able to find the many Ubuntu installed development files that GNU
Backgammon depends on.  (Unless, of course, I manually fix the broken
PKG_CONFIG_PATH.)

My initial proposal for fixing this problem was to update
Pkgconfig's Environment file so that it would be Rootless aware.  (My
proposed Envirnoment file is attached to the bug report, if you care
to see it.)

Hisham was hesitant to accept my proposal as there are other
Programs that might similarly benefit from Rootless-speciaized
Environments, so potentially many Recipes might become more complex.

I then proposed (in the bug report, and now here) that, if you don't
want to make the Recipes more complicated, you could achieve the same
effect by setting PKG_CONFIG_PATH correctly inside StartRootless
itself.  This would centralize all the Rootless specialized behavior
in one location, and, moreover, that location that would not interfere
with GoboLinux proper.

This is a little tricky, but very possible.  If the directory
Programs/Pkgconfig exists, StartRootless simply has to remember the
original value of PKG_CONFIG_PATH and then allow Pkgconfig's
Environment file to clobber PKG_CONFIG_PATH.  Finally, StartRootless
would reset PKG_CONFIG_PATH to a correct value.  A correct value would
be something like:

export PKG_CONFIG_PATH=\
${goboPrefix}/System/Links/Libraries/pkgconfig:\
${ORIGINAL_PKG_CONFIG_PATH:+$ORIGINAL_PKG_CONFIG_PATH:}\
/usr/local/lib/pkgconfig:\
/usr/local/share/pkgconfig:\
/usr/lib/pkgconfig:\
/usr/share/pkgconfig

In the above, I am making a reasonable guess as to what the default
directories will be for the host system's pkg-config.  If there is a
better way of determining the host system's default directories, I'm
all for using it.  I just don't know what it might be.

So, to summarize, I'm proposing that Rootless be improved to
automatically facilitate the Compiling of Programs against development
libraries provided by the host system via the pkg-config mechanism of
library detection.

Thanks!

-mpb
_______________________________________________
gobolinux-devel mailing list
gobolinux-devel@lists.gobolinux.org
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

Reply via email to