LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 724|回复: 6

谁来讲一下PKG_CONFIG_PATH

[复制链接]
发表于 2005-2-25 19:17:13 | 显示全部楼层 |阅读模式
有的软件装完后需要设置一下PATH
不明白是怎么回事,也不知道怎样设置
水讲一下
发表于 2005-2-25 20:24:33 | 显示全部楼层
请参考pkg-config manpage中的一段话:
The pkg-config program is used to retrieve information about installed libraries in the system. It is typically used to compile and link against one or more libraries. Here is a typical usage scenario in a Makefile:

program: program.c
        cc program.c `pkg-config --cflags --libs gnomeui`

pkg-config retrieves information about packages from special metadata files. These files are named after the package, with the extension .pc. By default, pkg-config looks in the directory prefix/lib/pkgconfig for these files; it will also look in the colon-separated (on Windows, semicolon-separated) list of directories specified by the PKG_CONFIG_PATH environment variable.

The package name specified on the pkg-config command line is defined to be the name of the metadata file, minus the .pc extension. If a library can install multiple versions simultaneously, it must give each version its own name (for example, GTK 1.2 might have the package name "gtk+" while GTK 2.0 has "gtk+-2.0").


pkg-config用来获取系统所安装的库文件信息,通常用来编译、链接库文件。下面是在一份Makefile文件中的典型用法:
program: program.c
        cc program.c `pkg-config --cflags --libs gnomeui`

pkg-config从特定的元数据文件获取包信息。这些文件按包命名,以.pc扩展结束。默认情况下,pkg-config在目录 prefix/lib/pkg-config下寻找这些文件;它也读取PKG_CONFIG_PATH 环境变量指定的、以冒号分隔(在windows下,以分号分隔)的目录列表。

在pkg-config命令行指定的包名称定义为元数据文件的名称减去.pc扩展。如果一个库可以同时安装多个版本,每个版本必须有自己的名称(例如,GTK 1.2可能用包名称“gtk+”,而GTK 2.0为”gtk+-2.0”)。
回复 支持 反对

使用道具 举报

发表于 2005-2-25 20:32:46 | 显示全部楼层
举个例子,
在/usr/lib和/usr/local/lib下
都有pkg-config/,
要让两个都能被pkg-config找到
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-2-25 21:06:13 | 显示全部楼层
export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig

这句是一个明令还是要写在某个文件下
回复 支持 反对

使用道具 举报

发表于 2005-2-25 21:13:57 | 显示全部楼层
算是个命令吧,
写在/etc/profile里.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-2-25 21:21:18 | 显示全部楼层
你的意思是每装一个软件都会有一个pkg-config????????????
比如我RH9在/usr/local/Python
装了新版python但是找不到
应该怎样设置pkg-config
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-2-25 21:25:32 | 显示全部楼层
Post by Dragonsoar
算是个命令吧,
写在/etc/profile里.


写在什么位置
还有的帖子说写在~/.bash_profile里
我晕~~~
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表