交叉编译gstreamer for arm

2019-07-13 07:48发布

1.下载glib,libxml2,gstreamer到目录/home/mars/Downloads/
2.mkdir /home/mars/arm-linux/usr
3.解压缩glib:tar zxvf glib-2.22.0.tar.gz
4.cd glib-2.22.0
5.输入:
CC=arm-linux-gcc ./configure --build=i686-linux --host=arm-linux --prefix=/usr

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

解释:用编译器:arm-linux-gcc ,--host:运行环境是arm-linux,--prefix:运行目录是/usr。
后面很多要yes or no的都是必须的,因为arm和pc毕竟不同,所以很多配置要重新配置。
6.顺利成功
7.make
8.恶 编了好久啊 真怀疑在无限循环中。。。尤其这会同时在循环听一首歌 有一种时空混乱,时间重复的

感觉
9.呵呵,太好了,成功。
10.make DESTDIR=/home/mars/arm-linux/usr install
11.成功。

12.解压缩libxml2
13.cd libxml2-2.7.6
14.CC=arm-linux-gcc ./configure --build=i686-linux --host=arm-linux --prefix=/usr
15.成功。5分钟。最后显示了一个:
/bin/rm: cannot remove 'libtoolT': No such file or directory
Done configuring
但是没看到error字样,应该成功了吧。
16.make
17.成功。13分钟 真有得等的
18.make DESTDIR=/home/mars/arm-linux/usr install
19。成功

20.解压缩gstreamer,并进入文件夹cd gstreamer-0.10.29
21.
CC=arm-linux-gcc  PKG_CONFIG_PATH=/usr/lib/pkgconfig ./configure --build=i686-linux --

host=arm-linux --prefix=/usr CFLAGS=-I/usr/include --disable-registry --disable-loadsave --

disable-gtk-doc ac_cv_func_register_printf_function=no --disable-tests --disable-valgrind --

disable-debug --disable-gst-debug
22.失败configure: error: Could not find bison
23.下载bison-2.4.2,
tar zxvf bison-2.4.2.tar.gz
cd bison-2.4.2
24.
CC=arm-linux-gcc ./configure --build=i686-linux --host=arm-linux --prefix=/usr
25.失败
checking for GNU M4 that supports accurate traces... configure: error: no acceptable m4 could

be found in $PATH.
GNU M4 1.4.6 or later is required; 1.4.13 is recommended
26.下载m4。地址http://ftp.gnu.org/gnu/m4/
27.解压缩m4-1.4.41.tar.gz,并cd m4-1.4.14
28.
CC=arm-linux-gcc ./configure --build=i686-linux --host=arm-linux --prefix=/usr
29.成功
30.make 成功
31.make DESTDIR=/home/mars/arm-linux/usr install 成功
32.
cd bison-2.4.2
CC=arm-linux-gcc ./configure --build=i686-linux --host=arm-linux --prefix=/usr
33.失败
checking for GNU M4 that supports accurate traces... configure: error: no acceptable m4 could

be found in $PATH.
GNU M4 1.4.6 or later is required; 1.4.13 is recommended
34.export PATH=$PATH:/home/mars/arm-linux/usr/usr/bin
35.重复32
36.同样错误。
37.下载m4-1.1.13版本,重新安装,重复27-31步
38.成功
39。重复bison编译。
40.失败。同样的错误
41.export PATH=$PATH:/home/mars/arm-linux/usr/usr
42.重复bison编译。失败,同样的错误。
43.进入m4目录,用gcc编译出x86版本,试一下。
./configure
make
make install
44.失败
45.try this: apt-get install m4 ; result : success
46.try to install bison again.(do step 32 again); result : success
47.try : make; result : sucess
48.make DESTDIR=/home/mars/arm-linux/usr install 成功


49.重新安装gstreamer
cd gstreamer-0.10.29
CC=arm-linux-gcc  PKG_CONFIG_PATH=/usr/lib/pkgconfig ./configure --build=i686-linux --

host=arm-linux --prefix=/usr CFLAGS=-I/usr/include --disable-registry --disable-loadsave --

disable-gtk-doc ac_cv_func_register_printf_function=no --disable-tests --disable-valgrind --

disable-debug --disable-gst-debug
50.失败configure: error: Could not find bison
51.try this:apt-get install bison 
   result : success
52.重复49
53.失败:configure:error: Could not find flex
54.apt-get install flex 成功
55.重复49
56.成功。。。。。。。。
57.make
58.失败:
gstpoll.c:284: error: impossible constraint in 'asm'
gstpoll.c:285: error: impossible constraint in 'asm'
gstpoll.c:286: error: impossible constraint in 'asm'

59.进入gstpoll.c文件看了一下,发现报错的三行都是在调用FD_ZERO()函数,在网上查了一下,是说宏定义出错要把select.h换掉
locate select.h
发现多个select.h
/usr/include/bits/select.h
/usr/include/sigc++-2.0/sigc++/adaptors/lambda/select.h
/usr/include/sigc++-2.0/sigc++/adaptors/lambda/macros/select.h.m4
/usr/include/sys/select.h
/usr/local/arm-linux-4.1.1/arm-iwmmxt-linux-gnueabi/include/bits/select.h
/usr/local/arm-linux-4.1.1/arm-iwmmxt-linux-gnueabi/include/sys/select.h
/usr/local/arm-linux-4.1.1/arm-iwmmxt-linux-gnueabi/sys-include/bits/select.h
/usr/local/arm-linux-4.1.1/arm-iwmmxt-linux-gnueabi/sys-include/sys/select.h

然后新建了一个文本文件,/usr/include/bits/select.h的内容保存下来了。
然后删掉这个文件,把/usr/local/arm-linux-4.1.1/arm-iwmmxt-linux-gnueabi/include/bits/select.h

复制一份到/usr/include/bits/目录



60.make
61.失败
报错: /usr/local/arm-linux-4.1.1/bin/../lib/gcc/arm-iwmmxt-linux-

gnueabi/4.1.1/../../../../arm-iwmmxt-linux-gnueabi/bin/ld: cannot find -lgobject-2.0

62.make clean

63.
要配置两个变量,这里不是要输入的。
{
 LDFLAGS=-L/home/mars/arm-linux/usr/usr/lib/ -L/home/mars/arm-linux/usr/usr/lib/ -lglib-2.0

-lgio-2.0 -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lxml2 

CFLAGS=-I/home/mars/arm-linux/usr/usr/include/ -I/home/mars/arm-linux/usr/usr/include/glib-

2.0/ -I/home/mars/arm-linux/usr/usr/lib/glib-2.0/include -I/home/mars/arm-

linux/usr/usr/include/libxml2 -I/home/mars/arm-linux/usr/usr/include/libxml2/libxml -

I/home/mars/arm-linux/usr/usr/include/gio-unix-2.0/ -I/home/mars/arm-

linux/usr/usr/include/gio-unix-2.0/gio
}
这里都是之前glib什么的安装的位置。
输入:
CC=arm-linux-gcc  PKG_CONFIG_PATH=/usr/lib/pkgconfig ./configure --build=i686-linux --

host=arm-linux --prefix=/usr CFLAGS='-I/home/mars/arm-linux/usr/usr/include/ -

I/home/mars/arm-linux/usr/usr/include/glib-2.0/ -I/home/mars/arm-linux/usr/usr/lib/glib-

2.0/include -I/home/mars/arm-linux/usr/usr/include/libxml2 -I/home/mars/arm-

linux/usr/usr/include/libxml2/libxml -I/home/mars/arm-linux/usr/usr/include/gio-unix-2.0/ -

I/home/mars/arm-linux/usr/usr/include/gio-unix-2.0/gio' LDFLAGS='-L/home/mars/arm-

linux/usr/usr/lib/ -L/home/mars/arm-linux/usr/usr/lib/ -lglib-2.0 -lgio-2.0 -lgobject-2.0 -

lgthread-2.0 -lgmodule-2.0 -lxml2' --disable-registry --disable-loadsave --disable-gtk-doc

ac_cv_func_register_printf_function=no --disable-tests --disable-valgrind --disable-debug --

disable-gst-debug 

成功
64.make 失败
/usr/lib/libgio-2.0.so: could not read symbols: File in wrong format
好像一定会先找这里的库。所以我要把这里的都move走,然后把其他地方的弄过来。
首先先保存一份。

cd /usr/lib
mkdir /home/mars/savelib
cp -r libgio-2.0.so  /home/mars/savelib/
mv libgio-2.0.so libgio-2.0.so_back
ln -s /home/mars/arm-linux/usr/usr/lib/libgio-2.0.so  ./libgio-2.0.so

65.
cd /home/mars/Downloads/gstreamer-0.10.29
make
失败
/usr/lib/libxml2.so: could not read symbols: File in wrong format

66.照着上面的libgio的方法再做一次:
cp -r libxml2.so /home/mars/savelib/
mv libxml2.so libxml2.so_back
ln -s /home/mars/arm-linux/usr/usr/lib/libxml2.so ./libxml2.so

转回gstreamer安装
make
失败
/usr/lib/libgobject-2.0.so: could not read symbols: File in wrong format

67.同上做一遍

转回gstreamer安装
make
失败
/usr/lib/libgthread-2.0.so: could not read symbols: File in wrong format
69。 同上再做一次。

然后转回gst文件夹,安装
make
失败
/usr/lib/libgmodule-2.0.so: could not read symbols: File in wrong format

70.同上再做一次。

然后转回gst文件夹,安装
make
失败
/usr/lib/libglib-2.0.so: could not read symbols: File in wrong format
71.再做一次。。。。。耐心,耐心,耐心。。。。。

然后转回gst文件夹,安装
make
成功  哈哈哈哈哈哈哈哈
72.make DESTDIR=/home/mars/arm-linux/usr install
成功