LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (http://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Pkg-config (http://www.linuxquestions.org/questions/linux-from-scratch-13/pkg-config-4175435553/)

spiky0011 11-04-2012 08:17 AM

Pkg-config
 
Hi

I have installed pkg-config when I run
Code:

echo $PKG_CONFIG_PATH
it returns nothing. Is this correct?
The reason being I had trouble building I think makedepend, Error cant find pkg-config, FYI pkg-config was installed before starting Xwindows

mariostg 11-04-2012 09:33 AM

Hi
I get this, but I have no idea what the correct answer should be.

Quote:

>>>echo $PKG_CONFIG_PATH
<PREFIX>/lib/pkgconfig:<PREFIX>/share/pkgconfig

stoat 11-04-2012 09:43 AM

Quote:

Originally Posted by spiky0011

I have installed pkg-config when I run
Code:

echo $PKG_CONFIG_PATH
it returns nothing. Is this correct?

That's interesting. I also had already installed pkg-config before starting my current BLFS system since pkg-config now is part of the LFS book. My PKG_CONFIG_PATH was probably like yours since it now is this...
Code:

$ echo $PKG_CONFIG_PATH
/opt/qt/lib/pkgconfig

And that gets established by /etc/profile.d/qt.sh which functions to append that path to PKG_CONFIG_PATH. That script was created as part of the installation of Qt-4.8.3...
Code:

# Begin /etc/profile.d/qt.sh

QTDIR=/opt/qt

pathappend /opt/qt/bin          PATH
pathappend /opt/qt/lib/pkgconfig PKG_CONFIG_PATH

export QTDIR

# End /etc/profile.d/qt.sh

Therefore, my PKG_CONFIG_PATH must have been like yours before I installed Qt-4.8.3. In other words, empty.

The LFS book doesn't mention anything about PKG_CONFIG_PATH (except as part of the configuration for installing Libpipeline). But the BLFS book mentions it explicitly as though it should already be set...
Quote:

Originally Posted by The current BLFS book for pkg-config-0.27.1

The default setting for PKG_CONFIG_PATH is /usr/lib/pkgconfig:/usr/share/pkgconfig because of the prefix used to install pkg-config. You may add to PKG_CONFIG_PATH by exporting additional paths on your system where .pc files are installed.

I haven't had any problems of any kind related to this matter including when I installed makedepend. But I wonder if I should fix my PKG_CONFIG_PATH variable since there are .pc files located in /usr/lib/pkgconfig and /usr/share/pkgconfig. I could do that in /etc/profile. To me, it looks like something I should do.

stoat 11-04-2012 09:46 AM

Quote:

Originally Posted by mariostg

I get this, but I have no idea what the correct answer should be.
Quote:

>>>echo $PKG_CONFIG_PATH
<PREFIX>/lib/pkgconfig:<PREFIX>/share/pkgconfig

To me, yours is clearly wrong. It looks like you copied that from somewhere without changing <PREFIX> to what it should be. So, where did you read to do that? Just curious.

stoat 11-04-2012 09:57 AM

FWIW (maybe nothing), I added this to /etc/profile...
Code:

export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/share/pkgconfig
Now PKG_CONFIG_PATH contains the path to all three locations of my .pc files...
Code:

echo $PKG_CONFIG_PATH
/usr/lib/pkgconfig:/usr/share/pkgconfig:/opt/qt/lib/pkgconfig

I'm not saying anybody else should do this. But to me, it just looks more right. I'll see how things go from now on.

spiky0011 11-04-2012 10:19 AM

Thks stoat

That seems to have fixed it makedepend made ok, the missing .pc files were found.
Just would like to know why I had to make the adjustment.

mariostg 11-04-2012 10:49 AM

Quote:

Originally Posted by stoat (Post 4821912)
To me, yours is clearly wrong. It looks like you copied that from somewhere without changing <PREFIX> to what it should be. So, where did you read to do that? Just curious.

I am curious too. I have no ides where the heck I got that.
grep -r "<PREFIX>/lib/pkgconfig" LFS-BOOK-7.2-NOCHUNKS.html yields nothing.

I also got that:
Code:

>>>grep -r PKG_CONFIG /etc/
/etc/profile.d/extrapaths.sh:        pathappend /usr/local/lib/pkgconfig PKG_CONFIG_PATH
/etc/profile.d/xorg.sh:pathappend $XORG_PREFIX/lib/pkgconfig PKG_CONFIG_PATH
/etc/profile.d/xorg.sh:pathappend $XORG_PREFIX/share/pkgconfig PKG_CONFIG_PATH
/etc/profile.d/xorg.sh:export PATH PKG_CONFIG_PATH


stoat 11-04-2012 11:03 AM

Quote:

Originally Posted by mariostg

I am curious too. I have no ides where the heck I got that.
grep -r "<PREFIX>/lib/pkgconfig" LFS-BOOK-7.2-NOCHUNKS.html yields nothing.

Well IMO, the PKG_CONFIG_PATH you posted above was closer to being right than ours. And the formatting of it with that <PREFIX> part suggested it was from an instruction in the book somewhere.

I also have the pathappend function for /usr/local/lib/pkgconfig in my extrapaths.sh script. That doesn't get added to PKG_CONFIG_PATH in my case because /usr/local/lib/pkgconfig doesn't exist in my system. But that part of extrapaths.sh implies that the PKG_CONFIG_PATH variable should already be set somewhere, and extrapaths.sh is just adding more on to it.

My Xorg.sh script doesn't have anything about PKG_CONFIG_PATH in it. It's from Xorg-7.7. The book has a version of Xorg.sh with those PKG_CONFIG_PATH lines in it when /usr is not used as the prefix for Xorg. I did use it.

So to me, all of this indicates that PKG_CONFIG_PATH should be set somewhere before /etc/profile calls those scripts in /etc/profile.d. I put the export command to do that in /etc/profile above the lines that call the scripts in /etc/profile.d. Until I learn or find out otherwise, I think that is the right thing to do.


All times are GMT -5. The time now is 07:27 PM.