Ubuntu下交叉编译gstreamer

最近要在arm平台上使用gstreamer,于是开始了gstreamer的交叉编译。实现交叉编译有两种方式:

1. 在pc平台编译,利用Ubuntu平台上的arm-linux-系列工具进行编译,此方式编译速度快,但是configure的交叉配置项设置很麻烦

2. 在目标平台编译,直接在目标板上用目标gcc工具进行编译,此方式编译速度慢,但是configure配置很简单,和pc机上的configure配置基本一样。

下面为pc平台的编译,还有错误

$GLIB_CFLAGS="-I/home/soeasy/nfsroot/target/usr/include/glib-2.0 -I/home/soeasy/nfsroot/target/usr/lib/glib-2.0/include" GLIB_LIBS="-L/home/soeasy/nfsroot/target/usr/lib/" XML_CFLAGS="-I/home/soeasy/nfsroot/target/usr/include/libxml2 "  GLIB_ONLY_CFLAGS=" -I/home/soeasy/nfsroot/target/usr/include/glib-2.0 -I/home/soeasy/nfsroot/target/usr/lib/glib-2.0/include  " ./configure --host=arm-linux --disable-nls --disable-static --disable-loadsave --with-html-dir=/tmp/dump --prefix=/home/soeasy/nfsroot/gstreamer/install LDFLAGS="-Wl,-rpath-link,/home/soeasy/nfsroot/target -lglib-2.0  -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lxml2 " CFLAGS="-I/home/soeasy/nfsroot/target/usr/include -I/home/soeasy/nfsroot/target/usr/include/glib-2.0 -I/home/soeasy/nfsroot/target/usr/lib/glib-2.0/include"

链接是提示下列错误:

arm-linux-gcc -shared  .libs/libgstreamer_0.10_la-glib-compat.o \

.libs/libgstreamer_0.10_la-gst.o .libs/libgstreamer_0.10_la-gstobject.o .libs/libgstreamer_0.10_la-gstbin.o \

.libs/libgstreamer_0.10_la-gstbuffer.o .libs/libgstreamer_0.10_la-gstbus.o .libs/libgstreamer_0.10_la-gstcaps.o \

.libs/libgstreamer_0.10_la-gstchildproxy.o .libs/libgstreamer_0.10_la-gstclock.o .libs/libgstreamer_0.10_la-gstelement.o \

.libs/libgstreamer_0.10_la-gstelementfactory.o .libs/libgstreamer_0.10_la-gsterror.o .libs/libgstreamer_0.10_la-gstevent.o \

.libs/libgstreamer_0.10_la-gstfilter.o .libs/libgstreamer_0.10_la-gstformat.o .libs/libgstreamer_0.10_la-gstghostpad.o \

.libs/libgstreamer_0.10_la-gstindex.o .libs/libgstreamer_0.10_la-gstindexfactory.o .libs/libgstreamer_0.10_la-gstinfo.o \

.libs/libgstreamer_0.10_la-gstinterface.o .libs/libgstreamer_0.10_la-gstiterator.o .libs/libgstreamer_0.10_la-gstmessage.o \

.libs/libgstreamer_0.10_la-gstminiobject.o .libs/libgstreamer_0.10_la-gstpad.o .libs/libgstreamer_0.10_la-gstpadtemplate.o \

.libs/libgstreamer_0.10_la-gstpipeline.o .libs/libgstreamer_0.10_la-gstplugin.o .libs/libgstreamer_0.10_la-gstpluginfeature.o \

.libs/libgstreamer_0.10_la-gstquery.o .libs/libgstreamer_0.10_la-gstregistry.o .libs/libgstreamer_0.10_la-gstsegment.o \

.libs/libgstreamer_0.10_la-gststructure.o .libs/libgstreamer_0.10_la-gstsystemclock.o .libs/libgstreamer_0.10_la-gsttaglist.o \

.libs/libgstreamer_0.10_la-gsttagsetter.o .libs/libgstreamer_0.10_la-gsttask.o .libs/libgstreamer_0.10_la-gsttrace.o \

.libs/libgstreamer_0.10_la-gsttypefind.o .libs/libgstreamer_0.10_la-gsttypefindfactory.o .libs/libgstreamer_0.10_la-gsturi.o \

.libs/libgstreamer_0.10_la-gstutils.o .libs/libgstreamer_0.10_la-gstvalue.o .libs/libgstreamer_0.10_la-gstparse.o \

.libs/libgstreamer_0.10_la-gstregistryxml.o .libs/libgstreamer_0.10_la-gstenumtypes.o .libs/libgstreamer_0.10_la-gstmarshal.o \

-Wl,--whole-archive parse/.libs/libgstparse.a -Wl,--no-whole-archive  -lm -lz -lpthread -ldl \

/usr/lib/libgobject-2.0.so /usr/lib/libgthread-2.0.so -lrt /usr/lib/libgmodule-2.0.so /usr/lib/libglib-2.0.so /usr/lib/libxml2.so  \

-Wl,-rpath-link -Wl,/home/soeasy/nfsroot/target -pthread -Wl,--export-dynamic -Wl,-soname -Wl,libgstreamer-0.10.so.0 \

-Wl,-version-script -Wl,.libs/libgstreamer-0.10.ver -o .libs/libgstreamer-0.10.so.0.7.0

/usr/lib/libgobject-2.0.so: could not read symbols: File in wrong format

显然需要链接的库libgobject-2.0.so没有定位到交叉库的目录,而是定位了pc机本身的i686的库,链接不成功。

根据gcc的参数说明,我在configure时指定了

LDFLAGS="-Wl,-rpath-link,/home/soeasy/nfsroot/target -lglib-2.0  -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lxml2 "

但是还是出错,郁闷

----------------------------------------------------------------------------------------------------------------------------------

继续交叉编译的工作,看来-Wl,-rpath-link,/home/soeasy/nfsroot/target是不能解决问题了,开始试试其他参数。

$LDFLAGS=" --sysroot=/home/soeasy/nfsroot/target -lglib-2.0 -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lxml2 " CPPFLAGS="-I/home/soeasy/nfsroot/target/usr/include -I/home/soeasy/nfsroot/target/usr/include/glib-2.0 -I/home/soeasy/nfsroot/target/usr/lib/glib-2.0/include -I/home/soeasy/nfsroot/target/usr/include/libxml2" GLIB_CFLAGS="-I/home/soeasy/nfsroot/target/usr/include/glib-2.0 -I/home/soeasy/nfsroot/target/usr/lib/glib-2.0/include" GLIB_LIBS="-L/home/soeasy/nfsroot/target/usr/lib --sysroot=/home/soeasy/nfsroot/target -lglib-2.0 -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lxml2" GLIB_ONLY_CFLAGS=" -I/home/soeasy/nfsroot/target/usr/include/glib-2.0 -I/home/soeasy/nfsroot/target/usr/lib/glib-2.0/include  " GLIB_ONLY_LIBS="-L/home/soeasy/nfsroot/target/usr/lib/ --sysroot=/home/soeasy/nfsroot/target -lglib-2.0 -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lxml2" ./configure --prefix=/install --disable-debug --disable-valgrind --host=arm-linux XML_CFLAGS="-I/home/soeasy/nfsroot/target/usr/include/libxml2"  GST_ALL_CFLAGS="-I/home/soeasy/nfsroot/target/usr/include -I/home/soeasy/nfsroot/target/usr/include/glib-2.0 -I/home/soeasy/nfsroot/target/usr/lib/glib-2.0/include -I/home/soeasy/nfsroot/target/usr/include/libxml2"

这次看来libgobject-2.0.so是链接成功了,但是又出现下列错误:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wwpszy.html