Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3029588
  • 博文数量: 396
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4209
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-04 13:04
文章分类

全部博文(396)

文章存档

2022年(1)

2021年(2)

2020年(8)

2019年(24)

2018年(135)

2017年(158)

2016年(68)

我的朋友

分类: 嵌入式

2018-01-10 10:05:28

一 安装gstreamer

1 下载gstreamer源码

我下的是gstreamer-0.10.31.tar.gz

2 解压缩,进入目录

./configure

出现如下错误:

configure: No package 'glib-2.0' found
No package 'gobject-2.0' found
No package 'gthread-2.0' found
No package 'gmodule-no-export-2.0' found
configure: error: This package requires GLib >= 2.20 to compile.

但是执行命令

apt-get install glib-2.0

提示已经安装,google了一下,

echo $PKG_CONFIG_PATH

显示是空的,说明pkg-config没有装

=============================================================

在此学习下有关编译时so库加载的内容:

#/etc/ld.so.conf

此文件记录了编译时使用的动态链接库的路径,更直白的说就是配置so库的加载路径;

默认情况下,编译器只会使用/lib和/usr/lib这两个目录下的库文件,而通常通过源码包安装时,如果不指定—prefix会将库安装在/usr/local下,而又在文件/etc/ld.so.conf中没有添加路径/usr/local/lib这个路径,这样虽然安装了源码包,但是在使用仍然找不到相关的so库就会报错,也就是说系统不知道你安装了源码。

对于此情况有两种解决方法:

(1)在用源码安装时,用prefix指定安装路径为/usr/lib。这样的话也就不用配置PKG_CONFIG_PATH

(2)直接路径/usr/local/lib加入到文件/etc/ld.so.conf

在文件/etc/ld.so.conf中末尾直接添加:

/usr/local/lib

(这个方法给力!)

#ldconfig

再来看看ldconfig这个程序,位于/sbin下,它的作用是将文件/etc/ld.so.conf列出的路径下的库文件缓存到/etc/ld.so.cache以供使用,因此当安装完一些库文件,或者修改/etc/ld.so.conf增加了库的新的搜索路径,需要运行一下ldconfig,使所有的库文件都被缓存到文件/etc/ld.so.cache中,如果没做,可能会找不到刚安装的库

#PKG_CONFIG_PATH:

最后说下PKG_CONFIG_PATH这个环境变量,它是在安装了pkgconfig后出现的

The pkgconfig package contains tools for passing the include path and/or library paths to build tools during the make file execution.
pkg-config is a function that returns meta information for the specified library.
The default setting for PKG_CONFIG_PATH is /usr/lib/pkgconfig because of the prefix we use to install pkgconfig. You may add to PKG_CONFIG_PATH by exporting additional paths on your system where pkgconfig files are installed. Note that PKG_CONFIG_PATH is only needed when compiling packages, not during run-time.

我想看过这段说明后,你已经大概了解了它是做什么的吧。
其实pkg-config就是向configure程序提供系统信息的程序,比如软件的版本啦,库的版本啦,库的路径啦,等等
这些信息只是在编译其间使用。你可以 ls /usr/lib/pkgconfig 下,会看到许多的*.pc,用文本编辑器打开
会发现类似下面的信息:
prefix=/usr
exec_prefix=$
libdir=$/lib
includedir=$/include
glib_genmarshal=glib-genmarshal
gobject_query=gobject-query
glib_mkenums=glib-mkenums
Name: GLib
Description: C Utility Library
Version: 2.4.7
Libs: -L$ -lglib-2.0
Cflags: -I$/glib-2.0 -I$/glib-2.0/include
明白了吧,configure就是靠这些信息判断你的软件版本是否符合要求。并且得到这些东东所在的位置,要不去哪里找呀。
不用我说你也知道为什么会出现上面那些问题了吧。

所以要正确配置这个环境变量,我的配置是:

PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig

参考:http://blog.163.com/huangbao_007/blog/static/356365352008102074129933/

=============================================================

现在pkg-config源码安装,重新编译gstreamer又出现错误:

configure: Requested 'glib-2.0 >= 2.20' but version of GLib is 2.4.1
No package 'gmodule-no-export-2.0' found
configure: error: This package requires GLib >= 2.20 to compile.

哦,系统默认安装的版本太低,下载glib源码,重新安装。我下的是2.21版本

下载地址:

在./configure,又出现错误:

no

configure: error:

            Need libxml2 and development headers/files to build GStreamer.

            You can do without libxml2 if you pass --disable-loadsave to

            configure, but that breaks ABI, so don't do that unless you

            are building for an embedded setup and know what you are doing.

同样,下载libxml2的源码包安装。地址:

再次configure,通过

3 make && make install

二 安装插件:

gstreamer-plugins-base

gstreamer-plugins-good

阅读(1258) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~