1. 程式人生 > >交叉編譯gstreamer for arm

交叉編譯gstreamer for arm

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
成功