嵌入式学习之QT学习---12交叉编译Qt源码以及编译触摸
原先的gcc版本是4.4.7,编译总失败。编译提示错误:unrecognized command line option “-std=c++11”root@ubuntu:/home/qt/qt_source/qt-everywhere-opensource-src-5.7.0# gcc --versiongcc (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7Copyrig
还是根军手册做的,记录一下遇到的问题。最近配置环境啥的,遇到的问题还是蛮多的,但也都不是大问题,需要静下来慢慢分析和解决。
gcc的版本问题—升级为gcc- -5
原先的gcc版本是4.4.7,编译脚本文件./autoconfigure.sh
总失败。编译提示错误:unrecognized command line option “-std=c++11”以及“invalid configuration…”出现这个错误的原因是:gcc版本不行,需要升级版本
。
root@ubuntu:/home/qt/qt_source/qt-everywhere-opensource-src-5.7.0# gcc --version
gcc (Ubuntu/Linaro 4.4.7-8ubuntu1) 4.4.7
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@ubuntu:/home/qt/qt_source/qt-everywhere-opensource-src-5.7.0# g++ --version
root@ubuntu:/home/qt/qt_source/qt-everywhere-opensource-src-5.7.0#add-apt-repository ppa:ubuntu-toolchain-r/test
root@ubuntu:/home/qt/qt_source/qt-everywhere-opensource-src-5.7.0# apt-get update
root@ubuntu:/home/qt/qt_source/qt-everywhere-opensource-src-5.7.0# apt-get install g++-5
//执行完这条信息之后仍然有报错,执行下面那条语句
root@ubuntu:/home/qt/qt_source/qt-everywhere-opensource-src-5.7.0# apt-get install g++-5 --fix-missing
//然后安装成功,进入usr下的local进行文件链接
root@ubuntu:/home/qt/qt_source/qt-everywhere-opensource-src-5.7.0# cd /usr/bin/
root@ubuntu:/usr/bin# ls
root@ubuntu:/usr/bin# ln -s /usr/bin/gcc-5 ./gcc
ln: 无法创建符号链接'./gcc': 文件已存在
root@ubuntu:/usr/bin# ln -s /usr/bin/g++-5 ./g++
ln: 无法创建符号链接'./g++': 文件已存在
//删除原来的链接文件
root@ubuntu:/usr/bin# rm ./gcc
root@ubuntu:/usr/bin# rm ./g++
root@ubuntu:/usr/bin# ln -s /usr/bin/gcc-5 ./gcc
root@ubuntu:/usr/bin# ln -s /usr/bin/g++-5 ./g++
root@ubuntu:/usr/bin# gcc --version
gcc (Ubuntu 5.5.0-12ubuntu1~16.04) 5.5.0 20171010
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
root@ubuntu:/usr/bin# g++ --version
g++ (Ubuntu 5.5.0-12ubuntu1~16.04) 5.5.0 20171010
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++的版本更新过来之后,又重新编译./autoconfigure.sh
啦,本来以为这次编译应该就成功了,结果又报错了,报错信息如下:
The test for linking against libxcb and support libraries failed!
You might need to install dependency packages, or pass -qt-xcb.
See src/plugins/platforms/xcb/README.
根据报错信息的提示,看了一下src/plugins/platforms/xcb/README
里面是怎么说的,README的详细信息如下:
Requires libxcb >= 1.5.
PACKAGE DEPENDENCIES
Required packages:
libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev libxcb-xinerama0-dev
On Ubuntu 11.10 icccm1 is replaced by icccm4 and xcb-render-util is not available:
libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev libxcb-xinerama0-dev
The packages for xcb-render-util can be installed manually from http://packages.ubuntu.com/natty/libxcb-render-util0 and http://packages.ubuntu.com/natty/libxcb-render-util0-dev
On Ubuntu 12.04 icccm1 is replaced by icccm4 and xcb-render-util can be installed automatically:
libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-glx0-dev libxcb-xinerama0-dev
On Fedora, the following packages are required:
libxcb libxcb-devel libXrender libXrender-devel xcb-util-wm xcb-util-wm-devel xcb-util xcb-util-devel xcb-util-image xcb-util-image-devel xcb-util-keysyms xcb-util-keysyms-devel
REDUCING RUNTIME DEPENDENCIES
The '-qt-xcb' configure option can be used to get rid of most xcb- dependencies. Only libxcb will
still be linked dynamically, since it will be most likely be pulled in via other dependencies anyway.
This should allow for binaries that are portable across most modern Linux distributions.
没有看的特别清楚明白,但是大概意思知道了,就是缺少一些依赖,也不差几十兆的内存,干脆使用命令apt-get install libxcb*
全部下载了。
在这条语句之后再执行./autoconfigure.sh
,这样这个创建的脚本就可以执行成功啦。
经过这一番折腾,再次执行make
的时候才编译成功了,粗略估计,编译的过程历时一个半小时,太难辽。编译成功的界面如下图所示:
编译成功之后,在/usr/local下找到了文件夹Qt-5.7.0
tslib1.4、vmtools以及Qt-5.7.0这三个文件夹在之后会用到
配置文件的说明
执行完脚本文件之后,会显示一些信息
“yes”就表示已经成功配置上了;no的就代表还没配置上。
#!/bin/sh
./configure //用的configure来生成的makefile
\ -v \ //在配置期间输出详细的信息
-prefix /opt/qt5.7.0 //安装的路径(我的还在/usr/local/Qt-5.7.0下 不知道为什么没改过来)
-release \ //关闭调试版本的qt
-opensource \ //构建qt的开源版本
-make libs \ //执行make的时候要添加的组件
-xplatform linux-arm-gnueabi-g++ \ //要用这个路径下的qmake.config
-optimized-qmake \ //在调试版本中构建优化主机的工具
-pch \ // 使用预编译的头文件
-qt-sql-sqlite \ //使用qt自带的sql-sqlite
-qt-libjpeg \ //使用qt自带的 libjpeg
-qt-zlib \
-no-opengl \ //不使用opengl
-skip qt3d \
-skip qtcanvas3d \
-skip qtpurchasing \ //跳过这三个东西
-no-sse2 \ //不使用sse2
-no-openssl \
-no-nis \ //nis类似于防火墙
-no-cups \
-no-glib \
-no-iconv \
-nomake examples \ // 不生成例程代码
-nomake tools \ //不生成工具
-skip qtvirtualkeyboard \
-I/opt/tslib1.4/include \
-L/opt/tslib1.4/lib exit //指定触摸的头文件和库(这一块如果改过路径也要改成实际路径)
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)