GStreamer在Linux平台的交叉编译

Posted Geek.Fan

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GStreamer在Linux平台的交叉编译相关的知识,希望对你有一定的参考价值。

一、下载源码:

        GStreamer: 新闻

        我这里是下载到Linux的桌面目录,先拷贝文件到opt:

sudo cp -r ohos-sdk/* /opt

解压文件:

sudo unzip *.zip

解压完配置环境变量:

fanyun@ubuntu:/opt/linux$ sudo vi /etc/profile

export C_INCLUDE_PATH=/usr/local/include

export CPLUS_INCLUDE_PATH=/usr/local/include

export PATH=$PATH:/home/fanyun/bin

export PATH=$PATH:/opt/ohos-sdk/linux/toolchains

fanyun@ubuntu:/opt/linux$ source /etc/profile

sudo cp -r /home/fanyun/Desktop/lib/* ./
tar -zxvf lib.tar.gz

 1 编译依赖

首先依赖关系如下:

gstreamer -> glib -> libffi zlib elfutils

1.1 先编glib的依赖

1.1.1 libffi

libffi3.3下载:

wget ftp://sourceware.org/pub/libffi/libffi-3.3.tar.gz

下载完,解压:

fanyun@ubuntu:~/Desktop/Dependence-1/libffi-3.3$ tar zxvf libffi-3.3.tar.gz

编译配置(1):

./configure --prefix=/home/fanyun/gstreamer/usr --host=arm-linux-gnueabihf --enable-shared --enable-static

编译配置(2),我使用的第二种:

./configure --prefix=/home/fanyun/gstreamer/usr CC=$CC --host=arm-linux-gnueabihf

编译安装:

make && make install

查看编译生成的库:

 配置路径:

export LD_LIBRARY_PATH=/usr/local/libffi-3.3:$LD_LIBRARY_PATH

这样设置只是在当前终端有效,如果要使其长期有效,可将这条命令追加到~/.bashrc文件的最后一行。

1.1.2 zlib

zlib1.2.11下载地址

./configure --prefix=/home/fanyun/gstreamer/usr CC=$CC --host=arm-linux-gnueabihf --enable-shared --enable-static

//由于zlib的configure没有CC和--host参数,所以要用export先指定交叉编译器

export CC=$CC

配置:

fanyun@ubuntu:~/Desktop/Dependence-1/zlib-1.2.11$ ./configure --prefix=/home/fanyun/gstreamer/usr

Checking for gcc...

Compiler error reporting is too harsh for ./configure (perhaps remove -Werror).

** ./configure aborting.

配置报错,vi 打开configure 文件,删除以下字段以避免将warn处理为error :

fanyun@ubuntu:~/Desktop/Dependence-1/zlib-1.2.11$

sudo apt-get install libasound2-dev libgudev-1.0-dev libxt-dev libvorbis-dev libcdparanoia-dev libpango1.0-dev libtheora-dev libvisual-0.4-dev iso-codes libgtk-3-dev libraw1394-dev libiec61883-dev libavc1394-dev libv4l-dev libcairo2-dev libcaca-dev libspeex-dev libpng-dev libshout3-dev libjpeg-dev libaa1-dev libflac-dev libdv4-dev libtag1-dev libwavpack-dev libpulse-dev libsoup2.4-dev libbz2-dev libcdaudio-dev libdc1394-22-dev ladspa-sdk libass-dev libcurl4-gnutls-dev libdca-dev libdvdnav-dev libexempi-dev libexif-dev libgme-dev libgsm1-dev libiptcdata0-dev libkate-dev libmms-dev libmodplug-dev libmpcdec-dev libofa0-dev libopus-dev librsvg2-dev librtmp-dev libsndfile1-dev libsoundtouch-dev libspandsp-dev libx11-dev libxvidcore-dev libzbar-dev libzvbi-dev liba52-0.7.4-dev libcdio-dev libdvdread-dev libmad0-dev libmp3lame-dev libmpeg2-4-dev libopencore-amrnb-dev libopencore-amrwb-dev libsidplay1-dev libtwolame-dev libx264-dev

make && make install

以上是关于GStreamer在Linux平台的交叉编译的主要内容,如果未能解决你的问题,请参考以下文章

gstreamer移植qnx:交叉编译qnx版本的gstreamer插件库

gstreamer移植qnx:交叉编译glib

基于arm5718的交叉编译gstreamer移植

基于arm5718的交叉编译gstreamer移植

imx6ull+debian10 构建静态qt交叉编译环境

Linux实现树莓派交叉编译