免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1175 | 回复: 0
打印 上一主题 下一主题

pkg-config [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-03-15 19:02 |只看该作者 |倒序浏览

1. pkg-config 的使用说明可以参见:
http://linux.die.net/man/1/pkg-config
2. 如查看本机的package list:
   # which pkg-list
   /usr/bin/pkg-config
   
   # pkg-config --list-all
   ......
3. pkg-config 从系统的库搜索路径中寻找 pkgconfig 文件夹里面的 *.pc 文件,读出里面的信息。
4. pkg-config搜索 *.pc 的规则是,遍历系统的所有链接库搜索路径。因此,一般情况下,*.pc 文件会和库文件装在同一个 prefix 目录下。
   比如,如果 DirectFB 装在 /usr/local/lib/ 下的话, 对应的 .pc 文件就被装在
/usr/local/lib/pkgconfig 下。
   # ls /usr/local/lib/pkgconfig
   direct.pc  directfb-internal.pc  directfb.pc  fusion.pc
5. .pc 文件里记载里库的版本,路径,使用库的编译器选项等信息。如:
  # cat /usr/local/lib/pkgconfig/directfb.pc
-------------------------------------------------------------------------------
prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: DirectFB
Description: Graphics and windowing library for the Linux frame buffer device
Version: 1.3.0
Requires: fusion direct
Libs: -L${libdir} -ldirectfb -lpthread
Libs.private: -L${libdir} -ldl -lz
Cflags: -D_REENTRANT -I${prefix}/include/directfb
-------------------------------------------------------------------------------
6. 如果所使用的库文件不在系统的库搜索路径的时候,可以通过变量PKG_CONFIG_PATH来指定路径:
   # PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --exists --print-errors directfb
7. DirectFB 1.3 使用 pkg-config来安装库文件。如果系统有几个 pkg-config 命令的时候(比如,交叉编译的时候),可以使用 PKG_CONFIG 选项指定 pkg-config路径。具体参看 ./configure --help
8. 常见错误:
   ......
   checking for pkg-config... /usr/bin/pkg-config
   checking pkg-config is at least version 0.9.0... yes
   checking for DIRECTFB... no
   configure: error: Requested 'directfb >= 1.2.0' but version of DirectFB is 1.0.1
   *** DirectFB 1.2.0 or newer is required. The latest version
   *** of DirectFB is available from http://www.directfb.org/.
   make: *** No targets specified and no makefile found.  Stop.
   安装了两个不同版本的DirectFB,先找到了低版本的,报错~~~~
(config.log)
......
configure:4285: checking for pkg-config
configure:4303: found /usr/bin/pkg-config
configure:4315: result: /usr/bin/pkg-config
configure:4344: checking pkg-config is at least version 0.9.0
configure:4347: result: yes
configure:4358: checking for DIRECTFB
configure:4366: $PKG_CONFIG --exists --print-errors "directfb >= $VERSION"
Package directfb was not found in the pkg-config search path.
Perhaps you should add the directory containing `directfb.pc'
to the PKG_CONFIG_PATH environment variable
No package 'directfb' found
configure:4369: $? = 1
configure:4384: $PKG_CONFIG --exists --print-errors "directfb >= $VERSION"
Package directfb was not found in the pkg-config search path.
Perhaps you should add the directory containing `directfb.pc'
to the PKG_CONFIG_PATH environment variable
No package 'directfb' found
configure:4387: $? = 1
No package 'directfb' found
configure:4415: result: no
configure:4419: error: No package 'directfb' found
*** DirectFB 1.2.0 or newer is required. The latest version
*** of DirectFB is available from http://www.directfb.org/.
没有找到 DirectFB 库,如果你安装了库pkg-config 没有找到的话,基本上就是:
  1) 安装的库不在它的搜索路径
 2) 没有安装 .pc 文件


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/52480/showart_1863991.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP