PKG_CONFIG_PATH与LD_LIBRARY_PATH

转载文章《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


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值