tslib.1.19 移植安装的问题和步骤

tslib-1.19.tar.gz 可以去官网下载

1.解压、配置

$ tar zxvf tslib-1.19.tar.gz
$ cd tslib-1.19/
$ CC=arm-hisiv100nptl-linux-gcc ./configure --prefix=`pwd`/res_tslib --host=arm-hisiv100nptl-linux  --enable-static=yes --enable-shared=no

配置的具体信息可以执行 ./configure -h 进行查看,这里说一下上面的配置:
CC=arm-hisiv100nptl-linux-gcc : 指定 gcc 编译器,没指定的话会使用系统默认的编译器
--prefix=`pwd`/res_tslib : 指定make install时要安装的目录
--host=arm-hisiv100nptl-linux : 指定交叉编译后的程序要运行的 host
--enable-static=yes : 编译成静态库
--enable-shared=no : 禁止编译动态库


2.编译

解压和配置之后,执行 make 编译,报错如下:

$ make
...
make[2]: 正在进入目录 `/home/samba/tslib/tslib-1.19/tests'
  CCLD     ts_test
../src/.libs/libts.a(ts_setup.o): In function `scan_devices':
ts_setup.c:(.text+0xbc): undefined reference to `EVIOCGPROP'
ts_setup.c:(.text+0x148): undefined reference to `EVIOCGPROP'
ts_setup.c:(.text+0x1c8): undefined reference to `EVIOCGPROP'
ts_setup.c:(.text+0x244): undefined reference to `EVIOCGPROP'
collect2: ld returned 1 exit status
make[2]: *** [ts_test] 错误 1
make[2]:正在离开目录 `/home/samba/tslib/tslib-1.19/tests'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/home/samba/tslib/tslib-1.19'
make: *** [all] 错误 2

报错:EVIOCGPROP 没有定义。


3.排错

(1)先试一下是不是配置的问题,直接全部按照默认的配置,编译一下

$ ./configure --prefix=`pwd`/res_tslib
$ make clean
$ make

结果:make编译通过,说明是配置的参数问题或编译器的问题。

(2)只使用默认编译器,其他配置参数全跟之前一样

$ ./configure --prefix=`pwd`/res_tslib --enable-static=yes --enable-shared=no
$ make clean
$ make

结果:make编译通过,说明很大可能是编译器的问题。

(3)使用其他的交叉编译器 arm-hisiv400-linux-gcc

$ CC=arm-hisiv400-linux-gcc ./configure --prefix=`pwd`/res_tslib --host=arm-hisiv400-linux  --enable-static=yes --enable-shared=no
$ make clean
$ make

结果:make编译通过,进一步确定可能是编译器问题。


(4)定位问题,并修改

①结合报错原因 “EVIOCGPROP 没定义”,猜测 EVIOCGPROP 可能是在编译器的头文件定义的,所以去安装编译器的目前搜索一下

  • 找到 arm-hisiv400-linux-gcc 的目录,搜索 “EVIOCGPROP”,找到在 input.h 有该定义
$ which is arm-hisiv400-linux-gcc
/opt/hisi-linux/x86-arm/arm-hisiv400-linux/target/bin/arm-hisiv400-linux-gcc
$ cd /opt/hisi-linux/x86-arm/arm-hisiv400-linux
$ grep "EVIOCGPROP" -rn ./                 
./target/usr/include/linux/input.h:110:#define EVIOCGPROP(len)          _IOC(_IOC_READ, 'E', 0x09, len)         /* get device properties */
$ 
  • 找到 arm-hisiv100nptl-linux-gcc 的目录,搜索 “EVIOCGPROP”,找不到相关定义
$ which is arm-hisiv100nptl-linux-gcc
/opt/hisi-linux-nptl/arm-hisiv100-linux/target/bin/arm-hisiv100nptl-linux-gcc
$ cd /opt/hisi-linux-nptl/arm-hisiv100-linux/
$ grep "EVIOCGPROP" -rn ./
$

解决方法

  • 打开 src/tslib.h
$ vi src/tslib.h
  • 加入下面这行定义
#define EVIOCGPROP(len)          _IOC(_IOC_READ, 'E', 0x09, len)         /* get device properties */

在这里插入图片描述

  • 重新配置、编译通过、安装
$ CC=arm-hisiv100nptl-linux-gcc ./configure --prefix=`pwd`/res_tslib --host=arm-hisiv100nptl-linux  --enable-static=yes --enable-shared=no
$ make clean
$ make
$ make install

完成后,在当前目录会生成一个res_tslib目录

$ ls res_tslib/
bin  etc  include  lib  share
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wkd_007

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值