QT tslib安装编译

这篇博客介绍了在Ubuntu环境下编译tslib库时遇到的AC_PROG_LIBTOOL宏未定义问题,以及解决方法。通过复制m4文件到正确路径解决了配置错误。随后,博主详细阐述了编译、安装tslib的过程,并将其移植到开发板上,配置了相关环境变量。最后,提到了如何通过Qt支持鼠标和键盘设备。
摘要由CSDN通过智能技术生成

1.下载源码

git clone https://github.com/libts/tslib.git

2.安装其他工具

 sudo apt-get install automake

sudo apt-get install autogen autoconf

sudo apt install automake libtool m4 autoconf

3.进入目录,配置

ubuntu@ubuntu:~/Downloads/tslib$ ./autogen.sh 

报错

configure.ac:64: error: possibly undefined macro: AC_DISABLE_STATIC
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:65: error: possibly undefined macro: AC_ENABLE_SHARED
configure.ac:66: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
configure.ac:67: error: possibly undefined macro: AC_PROG_LIBTOOL
configure:5988: error: possibly undefined macro: AC_MSG_ERROR
autoreconf: /usr/bin/autoconf failed with exit status: 1
解决

 sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/

原因

一般通过apt-get安装的软件都会在/usr目录下,既然提示无法找到AC_PROG_LIBTOOL,那么分析一般有两个原因:

1.安装包失败或者其他原因比如版本问题导致没有定义AC_PROG_LIBTOOL;

2.寻找路径有问题。

从这两点出发,可以在/usr目录下全局查找AC_PROG_LIBTOOL

可以看到在m4文件中能找到AC_PROG_LIBTOOL,那么就可能是路径问题;

大多数m4文件都在/usr/share/aclocal/目录下,但实际上configure的默认aclocal路径为/usr/local/share/aclocal,
那么可以有两种方法,
第一,将/usr/share/aclocal/下的*.m4文件都拷贝到usr/local/share/aclocal/目录下;
第二,指定aclocal的安装路径;

sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/

再次./autogen.sh,就通过了。

此处参考报错"configure.ac: error: possibly undefined macro"的解决方案 - 朱果果 - 博客园 (cnblogs.com)

重新 ./autogen.sh

4.配置

./configure --host=mips64el-linux --cache-file=arm-linux.cache  --prefix=/opt/tslib/

5.编译安装

sudo make -j8

sudo make install -j8

6.拷贝生成的整个文件夹到开发板/usr目录下

7.配置开发板环境

export TSLIB_CONSOLEDEVICE=none

export TSLIB_FBDEVICE=/dev/fb0

export TSLIB_TSDEVICE=/dev/input/event0

export TSLIB_CONFFILE=/usr/tslib/etc/ts.conf

export TSLIB_PLUGINDIR=/usr/tslib/lib/ts

export TSLIB_CALIBFILE=/etc/pointercal

7.11

1.进入目录,ts.conf拷贝之开发板/etc下
# cd tslib
# ls
bin      etc      include  lib      share
# cd etc
# ls
ts.conf
# vi ts.conf
# cp ts.conf /etc

2.进入lib目录除pkgconfig,全部拷贝到开发板/lib下

# cd tslib
# ls
bin      etc      include  lib      share
# cd lib
# ls
libts.la         libts.so.0       pkgconfig
libts.so         libts.so.0.10.4  ts
# cp libts.la /lib
# cp libts.so.0 /lib
# cp libts.so /lib
# cp libts.so.0.10.4  /lib
# cp -R ts/  /lib
#

配置文件/etc/profile修改为

#export TSLIB_TSDEVICE=/dev/input/touchscreen0
#export TSLIB_CONFFILE=/etc/ts.conf
#export TSLIB_PLUGINDIR=/lib/ts

#export TSLIB_CALIBFILE=/etc/pointercal
#export TSLIB_CONSOLEDEVICE=none
#export TSLIB_FBDEVICE=/dev/fb0


有报错,但因为手边没有触摸屏,暂时不能继续下去

8.关于鼠标键盘的支持

cat/dev/input/event0 回车后按键盘终端有反应则键盘对应这个设备,鼠标同理

在/etc/profile中添加

export QT_QPA_GENERIC_PLUGINS=tslib,evdevkeyboard:/dev/input/event0,evdevmouse:/dev/input/mouse0

以此支持鼠标键盘

如有报错No such plugin for spec "tslib"
,则修改为

export QT_QPA_GENERIC_PLUGINS=evdevkeyboard:/dev/input/event0,evdevmouse:/dev/input/mouse0

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值