http://hi.baidu.com/gh156884/blog/item/2275abfd3a49961d09244d8c 一:准备环境。 1。 首先需要一个交叉编译器。我需要的版本是 /usr/local/arm-linux-gcc-3.4.3/ 安装的路径是:/usr/local $ ls /usr/local/arm-linux-gcc-3.4.3/ arm-linux 编译出来的文件都保存在:/usr/local/arm-linux里面 2. gstramer 依赖以下的packages:glib and libxml,这些包都可以从网上下载。 我用的是:glib-2.22.2.tar.bz2 3。 有些版本的ulibc并不带有 libiconv 和 gettext 。编译glib 需要这两个包。 二:编译 1。编译libxml CC=arm-linux-gcc make && make install 2。编译libiconv CC=arm-linux-gcc ./configure --build=i686-linux --host=arm-linux --prefix=/usr/local/arm-linux make && make install 3。编译gettext CC=arm-linux-gcc ./configure --build=i686-linux --host=arm-linux --prefix=/usr/local/arm-linux 在我的系统上面会有wchar相关的错误。 find . -name "wchar.h" rm ./gettext-tools/gnulib-lib/wchar.h vim ./gettext-tools/libgettextpo/Makefile (把编译wchar 的删除) make 会有符号没有定义 HAVEICONV=1 make wchar相关错误 find . -name "wchar.h" vim ./gettext-tools/libgettextpo/Makefile(把编译wchar 的删除) rm ./gettext-tools/libgettextpo/wchar.h make && make install 4。编译glib CC=arm-linux-gcc CFLAGS="-L/usr/local/arm-linux/lib -I/usr/local/arm-linux/include -liconv" ./configure --build=i686-linux --host=arm-linux --prefix=/usr/local/arm-linux glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=yes ac_cv_func_posix_getgrgid_r=yes ac_cv_lib_rt_clock_gettime=no glib_cv_monotonic_clock=yes make && make install 5。编译gstreamer CC=arm-linux-gcc PKG_CONFIG_PATH=/usr/local/arm-linux/lib/pkgconfig/ ./configure --build=i686-linux --host=arm-linux --prefix=/usr/local/arm-linux CFLAGS=-I/usr/local/arm-linux/include/ make && make install 三:安装和测试 1。 安装:把/usr/loca/arm-linux拷贝到测试机上面。比如目录为:/usr/local//arm-linux 2。 编写测试程序 $cat >helloworld.c <<EOF { const gchar *nano_str; guint major, minor, micro, nano; gst_init (NULL, NULL); gst_version (&major, &minor, µ, &nano); if (nano == 1) nano_str = "(CVS)"; else if (nano == 2) nano_str = "(Prerelease)"; else nano_str = ""; printf ("This program is linked against GStreamer %d.%d.%d %s\n", major, minor, micro, nano_str); return 0; } EOF 3。编译和运行测试程序 $arm-linux-gcc helloworld.c -I/usr/local/arm-linux/include/glib-2.0 -I/usr/local/arm-linux/lib/glib-2.0/include -I/usr/local/arm-linux/include/gstreamer-0.10 -L/usr/local/arm-linux/lib -lgstreamer-0.10 -lglib-2.0 -lgmodule-2.0 -lgobject-2.0 -lgthread-2.0 -liconv -lgettextlib -lgettextpo -lgettextsrc -lintl 把生成的a.out拷贝到测试机上面。然后设置:LD_LIBRARY_PATH=/usr/local/arm-linux/lib 。 运行a.out应该有输出:“This program is linked against GStreamer 0.10.25” 本文参考了:http://blog.youkuaiyun.com/dyzhu/archive/2009/07/02/4316177.aspx 附录: 一:编译 gstreamer 的 plugin。 1。 编译 plug-in base for gstreamer: CC=arm-linux-gcc PKG_CONFIG_PATH=/usr/local/arm-linux/lib/pkgconfig/ ./configure --build=i686-linux --host=arm-linux --prefix=/usr/local/arm-linux CFLAGS=-I/usr/local/arm-linux/include/ --disable-valgrind --disable-x --disable-gnome_vfs --disable-alsa --disable-ogg --disable-pango --disable-theora --disable-vorbis --disable-examples 2。编译 plug-in good for gstramer CC=arm-linux-gcc PKG_CONFIG_PATH=/usr/local/arm-linux/lib/pkgconfig/ ./configure --build=i686-linux --host=arm-linux --prefix=/usr/local/arm-linux CFLAGS=-I/usr/local/arm-linux/include/ --disable-valgrind --disable-examples --disable-gconftool --disable-avi --disable-id3demux --disable-libpng --disable-jpeg --disable-gdk_pixbuf --disable-x --disable-osx_audio --disable-oss --disable-aalib --disable-cairo 然后去修改tests/Makefile,把和check相关的去掉 make && make install 3。编译 plug-in bad for gstramer CC=arm-linux-gcc PKG_CONFIG_PATH=/usr/local/arm-linux/lib/pkgconfig/ ./configure --build=i686-linux --host=arm-linux --prefix=/usr/local/arm-linux CFLAGS=-I/usr/local/arm-linux/include/ --disable-valgrind --disable-examples make && make install 二:运行测试程序 #gst-launch v4l2src num-buffers=1 ! ffmpegcolorspace ! video/x-raw-yuv,width=640,height=480! #gst-launch v4l2src num-buffers=1 ! ffmpegcolorspace ! video/x-raw-yuv,width=640,height=480 ! jpegenc ! filesink location=test.jpg (生成jpege文件) 三:加入video的支持 1。编译 libjpeg-6a, libvorbis-1.2.3, libogg-1.1.4 2。 去http://www.theora.org/downloads/ 下载 theora支持 更改libtheora-1.1.1/lib/Makefile, 在am__objects_11定义的地方加上info.lo,否则在libtheoraenc.so中会有没有定义的符号。 3。 重新配置 gst-plugin-base,把 --disable-ogg --disable-theora去掉 录制一段:#gst-launch v4l2src ! 'video/x-raw-yuv,width=640,height=480' ! queue ! videorate ! 'video/x-raw-yuv,framerate=30/1' ! theoraenc ! queue ! oggmux ! filesink location=me_funny_dancing.ogg |
有关cannot restore segment prot after reloc: Permission denied 问题的解答
在linux上安装有些东西时会出现 Permission denied 的情况:以下就是解决它的办法之一
编辑/etc/selinux/config,找到这段:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing
把 SELINUX=enforcing 注释掉:#SELINUX=enforcing ,然后新加一行为:
SELINUX=disabled
保存,关闭。
......
编辑/etc/sysconfig/selinux,找到:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing
如果SELINUX已经是 SELINUX=disabled,那么就不用改了,否则就把SELINUX=enforcing 注释掉,新加一行:
SELINUX=disabled
保存,退出。
如果你碰到其他类似提示:
cannot restore segment prot after reloc: Permission denied
哪应该是SELinux的问题,可以考虑把它关闭。
-------------------------------------------------------------------------------------
郁闷的是.我把SELinux关闭后还是不行.于是到google上search.发现这个很有用.
在你保证SElinux 被disable后.还执行下
chcon -t texrel_shlib_t
如: chcon -t texrel_shlib_t /路径/路径/名字.so (这个文件视具体执行文件.)
问题2:在编译glib时如果出现下面的提示:
solution(解决方案):http://hi.baidu.com/amixyue/blog/item/944adadfc1532aaacd1166bc
USE_ARCH=32 NM=nm CC="mipsel-linux-gnu-gcc ${BUILD32}" ./configure \
--with-gnu-ld \
--target=mipsel-linux \
--host=mipsel-linux \
CC=mipsel-linux-gnu-gcc \
--prefix=/usr
上面的nm的用途:nm是用来查看指定程序中的符号表相关内容的工具
(2)在X86上编译MIPS版本的gstreamer
-I/home/xxx/mipsel-linux/include -liconv" ./configure --build=i686-linux
--host=mipsel-linux --target=mipsel-linux --prefix=//home/xxx/mipsel-linux
glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=yes
ac_cv_func_posix_getgrgid_r=yes ac_cv_lib_rt_clock_gettime=no
glib_cv_monotonic_clock=yes --with-libiconv=gnu --with-gnu-ld
--prefix=/home/xxx/mipsel-linux/ CFLAGS=-I/home/xxx/mipsel-linux/include/
--disable-loadsave --disable-gtk-doc --disable-tests --disable-valgrind