您的位置:首页 > 其它

PKG_CONFIG_PATH与LD_LIBRARY_PATH

2011-08-26 14:36 267 查看
转载文章《ld.so.conf文件与PKG_CONFIG_PATH》主要是因为在编译libsoup (http://git.gnome.org/browse/libsoup)
时遇到如下错误信息,而在编译libsoup之前确实下载、编译、安装过了glib (http://ftp.gnome.org/pub/GNOME/sources/glib/2.29/glib-2.29.16.tar.bz2)在/usr/local。

checking for GLIB - version >= 2.27.5... no

*** Could not run GLIB test program, checking why...

*** The test program failed to compile or link. See the file config.log for the

*** exact error that occured. This usually means GLIB is incorrectly installed.

configure: error: GLIB 2.27.5 or later is required to build libsoup

设置环境变量PKG_CONFIG_PATH之后,即export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH,得到如下错误信息:

checking for GLIB - version >= 2.27.5...

*** 'pkg-config --modversion glib-2.0' returned 2.29.16, but GLIB (2.26.0)

*** was found! If pkg-config was correct, then it is best

*** to remove the old version of GLib. You may also be able to fix the error

*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing

*** /etc/ld.so.conf. Make sure you have run ldconfig if that is

*** required on your system.

*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH

*** to point to the correct configuration files

no

configure: error: GLIB 2.27.5 or later is required to build libsoup

而在设置环境变量LD_LIBRARY_PATH之后,即export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH,则上述错误信息都消失了。于是产生了如下脚本:

#!/bin/sh

set -e

PREFIX="/usr/local"

OPT="--prefix=$PREFIX"

PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"

PATH="$PREFIX/bin:$PATH"

LD_LIBRARY_PATH="$PREFIX/lib:$LD_LIBRARY_PATH"

make clean distclean || true

./autogen.sh $OPT

make

sudo make install

sudo ldconfig
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: