本文参考原来博客地址:https://www.cnblogs.com/Jasonsblog/p/3757985.html
tslib编译与安装:
准备工作:安装以下三个软件
sudo apt-get install automake sudo apt-get install autogen sudo apt-get install libtool
安装完上面的3个软件以后,将下载的tarlib-1.4源码解压编译安装
# tar -zxvf tslib-1.4.tar.gz # cd tslib # ./autogen.sh #./configure --host=arm-linux ac_cv_func_malloc_0_nonnull=yes --cache-file=arm-linux.cache -prefix=/usr/local/tslib # make # make install
编译过程中,有两个问题,
1.在执行./configure --host=arm-linux ac_cv_func_malloc_0_nonnull=yes --cache-file=arm-linux.cache -prefix=/usr/local/tslib 时。提示checking for arm-linux-g++... no
。。。
configure: error: C++ compiler cannot create executables
See `config.log' for more details
解决方法:
原因是缺少C++编译器,yum install gcc gcc-c++即可(ubuntu系统下是apt-get install gcc g++)
2.在make时出错,提示
In function ‘open’,
inlined from ‘main’ at ts_calibrate.c:229:11:
/usr/include/bits/fcntl2.h:51:24: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[2]: *** [ts_calibrate.o] Error 1
解决方法:
这是因为open函数的语法不符合最新的gcc,在/tests/ts_calibrate.c中加入open的第三个参数0777:
#cd tests/ #vi ts_calibrate
修改如下
if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) { cal_fd = open (calfile, O_CREAT | O_RDWR, 0777); } else { cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR, 0777); }
执行make install 结束后,会在/usr/local生成tslib文件夹;
Qt4.8.4交叉编译
1.下载Qt 下载地址:http://download.qt.io/archive/qt/4.8/4.8.4/qt-everywhere-opensource-src-4.8.4.tar.gz
2.将下载好的压缩包拷贝到虚拟机某个目录下解压
3.cd qt-everywhere-opensource-src-4.8.4/
4.首先配置,同样是通过运行./configure来生成Makefile,由于配置项较多,所以把它写成一个脚本,如下
#!/bin/sh
./configure \
--prefix=/usr/local/Trolltech/QtEmbedded-4.8.4-arm/ \
-opensource -release -shared \
-Declarative \
-importdir /opt/imports \
-fast -no-largefile -qt-sql-sqlite \
-qt3support \
-exceptions \
-xmlpatterns -no-glib \
-no-phonon -no-mmx -no-3dnow -no-sse -no-sse2 \
-svg -no-webkit -qt-zlib -qt-libtiff -qt-libpng \
-qt-libjpeg -make libs -make tools -nomake examples \
-nomake docs -nomake demo -no-nis -no-cups \
-iconv -no-dbus \
-xplatform qws/linux-arm-gnueabi-g++ \
-embedded arm \
-little-endian \
-qt-freetype \
-depths 16,24,32 \
-qt-sql-sqlite \
-qt-gfx-linuxfb -qt-gfx-transformed -qt-gfx-multiscreen \
-no-gfx-vnc -no-gfx-qvfb \
-qt-kbd-linuxinput \
-no-kbd-qvfb \
-armfpa \
-no-mouse-qvfb \
-no-mouse-linuxtp \
-qt-mouse-linuxinput \
-no-mouse-tslib \
-no-pch \
-DQT_QLOCALE_USES_FCVT \
-confirm-license
运行脚本
#chmod +x autoconfig #./autoconfig
成功后会出现如下信息
Qt is now configured for building. Just run 'make'. Once everything is built, you must run 'make install'. Qt will be installed into /usr/local/Trolltech/QtEmbedded-4.8.4-arm To reconfigure, run 'make confclean' and 'configure'.
接下来执行make进行编译
编译完后执行make install 进行安装。
可以在文件夹/usr/local/Trolltech/下看到刚刚编译好的Qt文件夹