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
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
没有找到 DirectFB 库,如果你安装了库pkg-config 没有找到的话,基本上就是:
1) 安装的库不在它的搜索路径
2) 没有安装 .pc 文件
阅读(1396) | 评论(0) | 转发(0) |