qt5.7交叉编译gstreamer-1.0

2/10/2017来源:ASP.NET技巧人气:1347

一、交叉编译glib 1.提前需先交叉编译libffi CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure --PRefix=/home/mjl/build/libffi-3.2.1/install/arm/ --host=arm-linux-gnueabihf 2.提前需先交叉编译zlib CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/home/mjl/build/zlib-1.2.8/install/arm/ --host=arm-linux-gnueabihf 3.交叉编译glib至本地 CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/home/mjl/build/glib-2.45.3/install/arm/ --host=arm-linux-gnueabihf LIBFFI_CFLAGS="-I/home/mjl/build/libffi-3.2.1/install/arm/lib/libffi-3.2.1/include"  LIBFFI_LIBS="-lffi -L/home/mjl/build/libffi-3.-I/2.1/install/lib" ZLIB_CFLAGS="-I/home/mjl/build/zlib-1.2.8/install/arm/include" ZLIB_LIBS="-lz -L/home/mjl/build/zlib-1.2.8/install/lib" 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 4.checking gcc ...no (config.log libstdc++.so.6: cannot open shared object file: No such file or directory) 解决方法 sudo apt-get install lib32stdc++6  lib32z1 5.接着执行会出现clock_gettime... 看网上说,export LDFLAGS=" lrt "(不能用) 用下边的方法LDFLAGS=" -lrt " CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure LDFLAGS=" -lrt " --prefix=/home/mjl/build/gstreamer1.0/install/arm/ --host=arm-linux-gnueabihf LIBFFI_CFLAGS="-I/home/mjl/build/libffi-3.2.1/install/arm/lib/libffi-3.2.1/include"  LIBFFI_LIBS="-lffi -L/home/mjl/build/libffi-3.-I/2.1/install/lib" ZLIB_CFLAGS="-I/home/mjl/build/zlib-1.2.8/install/arm/include" ZLIB_LIBS="-lz -L/home/mjl/build/zlib-1.2.8/install/lib" 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 6.安装glib 时出现glib msgfmt.. no (这个问题极易出现在Ubuntu 上) 解决方案:apt-get install gettest 7.安装glib 时出现 error: Could not find a glib-genmarshal in your PATH, 解决方案:先在主机安装 apt-get install libglib2.0-dev 8.make -j 4 9.make install 10.交叉编译至树莓派 ①.CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure LDFLAGS=" -lrt " --prefix=/mnt/rasp-pi-rootfs/home/mjl/build/gstreamer1.0/install/arm/ --host=arm-linux-gnueabihf LIBFFI_CFLAGS="-I/home/mjl/build/libffi-3.2.1/install/arm/lib/libffi-3.2.1/include"  LIBFFI_LIBS="-lffi -L/home/mjl/build/libffi-3.-I/2.1/install/lib" ZLIB_CFLAGS="-I/home/mjl/build/zlib-1.2.8/install/arm/include" ZLIB_LIBS="-lz -L/home/mjl/build/zlib-1.2.8/install/lib" 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 -j 4 ③.make install ×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 二、交叉编译gstreamer1.0 安装gstreamer-1.10.1 1.交叉编译至树莓派 ①.export PKG_CONFIG_PATH=/home/mjl/build/zlib-1.2.8/install/arm/lib/pkgconfig:/mnt/rasp-pi-rootfs/home/mjl/build/gstreamer1.0/install/arm/lib/pkgconfig:/home/mjl/build/libxml2-2.6.26/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH ②.CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/mnt/rasp-pi-rootfs/home/mjl/build/gstreamer1.0/install/arm/ --host=arm-linux-gnueabihf  --disable-registry --disable-loadsave --disable-gtk-doc ac_cv_func_register_printf_function=no --disable-tests --disable-valgrind --disable-debug --disable-gst-debug  3.提示缺少什安装什么 4.cannot find -lgobject-2.0 lgmodule-2.0 lglib-2.0 解决办法:export PKG_CONFIG_PATH=/home/mjl/build/glib-2.45.3/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH 5.warning: libgstbase-1.0.so.0, needed by ../../libs/gst/net/.libs/libgstnet-1.0.so, not found 解决办法,查找sudo find / -name libgstnet-1.0.so 我的在之前安装的地方,/home/mjl/build/gstreamer-1.10.0/libs/gst/net/.libs/libgstnet-1.0.so   cd /home/mjl/build/gstreamer-1.10.0/libs/gst/base/.libs cp libgstbase-1.0.so libgstbase-1.0.so.0 libgstbase-1.0.so.0.1000.0 /home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/arm-linux-gnueabihf/libc/lib/arm-linux-gnueabihf 重新./configure 6.make -j 4 7.sudo make install 8.交叉编译至本地 ①export PKG_CONFIG_PATH=/home/mjl/build/zlib-1.2.8/install/arm/lib/pkgconfig:/home/mjl/build/gstreamer1.0/install/arm/lib/pkgconfig:/home/mjl/build/libxml2-2.6.26/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH ②CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/home/mjl/build/gstreamer1.0/install/arm/ --host=arm-linux-gnueabihf  --disable-registry --disable-loadsave --disable-gtk-doc ac_cv_func_register_printf_function=no --disable-tests --disable-valgrind --disable-debug --disable-gst-debug  ③make -j 4 ④sudo make install ×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 三、交叉编译gst-plugins-base 1.交叉编译至树莓派 ①.export PKG_CONFIG_PATH=/home/mjl/build/zlib-1.2.8/install/arm/lib/pkgconfig:/mnt/rasp-pi-rootfs/home/mjl/build/gstreamer1.0/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH ②CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/mnt/rasp-pi-rootfs/home/mjl/build/gstreamer1.0/install/arm/ --host=arm-linux-gnueabihf  --disable-valgrind --disable-x --disable-gnome_vfs --disable-alsa --disable-ogg --disable-pango --disable-theora --disable-vorbis --disable-examples   ③make -j 4 ④sudo make install 2.交叉编译至本地 ①.export PKG_CONFIG_PATH=/home/mjl/build/zlib-1.2.8/install/arm/lib/pkgconfig://home/mjl/build/gstreamer1.0/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH ②CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/home/mjl/build/gstreamer1.0/install/arm/ --host=arm-linux-gnueabihf  --disable-valgrind --disable-x --disable-gnome_vfs --disable-alsa --disable-ogg --disable-pango --disable-theora --disable-vorbis --disable-examples   ③make -j 4 ④sudo make install ×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 四、交叉编译gst-plugins-good 1.交叉编译至树莓派 ①export PKG_CONFIG_PATH=/home/mjl/build/zlib-1.2.8/install/arm/lib/pkgconfig:/mnt/rasp-pi-rootfs/home/mjl/build/gstreamer1.0/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH ②CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/mnt/rasp-pi-rootfs/home/mjl/build/gstreamer1.0/install/arm/ --host=arm-linux-gnueabihf  -disable-x --disable-xshm --disable-cairo --disable-xvideo --disable-esd --disable-shout2 --disable-gconf --disable-gdk_pixbuf --disable-hal --disable-libpng --disable-oss --disable-oss4 ③make -j 4 ④sudo make install 2.交叉编译至本地 ①export PKG_CONFIG_PATH=/home/mjl/build/zlib-1.2.8/install/arm/lib/pkgconfig:/home/mjl/build/gstreamer1.0/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH ②CC=/home/mjl/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc ./configure --prefix=/home/mjl/build/gstreamer1.0/install/arm/ --host=arm-linux-gnueabihf  -disable-x --disable-xshm --disable-cairo --disable-xvideo --disable-esd --disable-shout2 --disable-gconf --disable-gdk_pixbuf --disable-hal --disable-libpng --disable-oss --disable-oss4 ③make -j 4 ④sudo make install ×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××× 五、交叉编译qt5 1.mkdir /mnt/rasp-pi-rootfs 2.sudo mount -o loop,offset=70254592 2016-11-25-raspbian-jessie.img /mnt/rasp-pi-rootfs 3.当挂载完成后,请进入cd /mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf/查看两个so文件,命令ls -l libdl.so 和ls -l libm.so,看清其指向的文件是否如lrwxrwxrwx 1 root root 13 Jan 10 15:30 libdl.so -> libdl-2.19.so ,如果不是,先删除原来的软连接(sudo rm libdl.so),执行sudo ln -s libdl-2.19.so libdl.so(重新建立软连接),如果arm-linux-gnueabihf文件夹下不存在libdl-2.19.so,看看刚才ls命令其指向的文件在哪(或者sudo find /mnt/rasp-pi-rootfs -name libdl-2.19.so我的是在/mnt/rasp-pi-rootfs/lib/arm-linux-gnueabihf/下),拷贝至此(/mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf)即可,执行sudo ln -s libdl-2.19.so libdl.so,对于libm同样操作,原因:防止出现:undefined reference to `__dlopen’等问题,参照http://blog.csdn.net/scylhy/article/details/52818779。 4.cd ~/opt/cross-compile-tools 5.sudo ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/ ~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc 6.export PKG_CONFIG_PATH=/home/mjl/build/gstreamer1.0/install/arm/lib/pkgconfig:$PKG_CONFIG_PATH (本地和树莓派各有一个gstreamer1.0,因为如果本地没有的话,export pkgconfig无法识别,如果树莓派没有的话,因为sysroot 前缀,导致其编译时候找不到本地文件(会多了前缀),如果去掉sysroot的话,许多自带的库无法使用,如egl等等,所以折中的办法是树莓派和本地的gstreamer1.0各编译一次) 7.cd ~/opt/qt-everywhere-opensource-src-5.7.1/qtbase 8../configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi -gstreamer 1.0 -v 0.make -j 4 10.sudo make install 11.cd ~/opt/qt-everywhere-opensource-src-5.7.1/ 12.执行如下命令     for MODULE in qtimageformats qtsvg  qtscript qtxmlpatterns qtdeclarative qtsensors qt3d qtgraphicaleffects  qtlocation ; do  cd $MODULE;  /usr/local/qt5pi/bin/qmake .;  make -j4;  sudo make install;  cd ..; done 13. cd~/opt/ 14.sync; sudo umount /mnt/rasp-pi-rootfs (取消挂载) 15.sudo dd bs=1M if=2016-11-25-raspbian-jessie.img of=/dev/sdb; sync (烧录至内存卡)(看清of后的地址,可用命令fdisk -l 查看,我就是直接用的sdb,然后系统都没了,要不然也没机会再熟悉一遍,也没机会把经验总结一下--!) 到此就完成了交叉编译的环境配置,其他配置参照我之前的交叉编译的文章。 16.声明一下,因为树莓派板子烧了也不确定,交叉编译的gstreamer1.0能不能使用,等我新板子回来我再验证一下。 17.其实我觉得如果嫌交叉编译麻烦,可以在树莓派上安装gstreamer及gst-plugins-..然后交叉编译qt5.7时,export PKG_CONFIG_PATH=...,其实我有多少次都有种使用此种方法的冲动,但是不服输的心态让我觉得明知山有虎偏向虎山行! 引用链接:http://blog.csdn.net/water_cow/article/details/8728111

http://blog.csdn.net/water_cow/article/details/8728216

http://blog.csdn.net/xueyeguiren8/article/details/54345013