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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章