系统环境:
Distributor ID: Ubuntu
Description: Ubuntu 14.04.1 LTS
Release: 14.04
Codename: trusty
交叉编译工具链:
适用于mini2440开发板的arm-linux-gcc-4.4.3-20100728.tar.gz
源码地址:
https://github.com/kergoth/tslib
下载源码方法:
1.通过git直接下载源码: git clone https://github.com/kergoth/tslib
2.网页下载源码,文件名为 tslib-master.zip,解压源码:unzip tslib-master.zip
编译源码:
1.下载依赖库及工具
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
2.生成configure
执行 ./autogen.sh
遇到错误1:
➜ ~/test/tslib-master: ./autogen.sh
configure.ac:24: 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:25: error: possibly undefined macro: AC_ENABLE_SHARED
configure.ac:26: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
configure.ac:27: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1
原因:是因为没有安装上面的libtool
执行 sudo apt-get install libtool 即可。
安装后重新执行信息如下:
➜ ~/test/tslib-master: ./autogen.sh
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in `m4/internal'.
libtoolize: copying file `m4/internal/libtool.m4'
libtoolize: copying file `m4/internal/ltoptions.m4'
libtoolize: copying file `m4/internal/ltsugar.m4'
libtoolize: copying file `m4/internal/ltversion.m4'
libtoolize: copying file `m4/internal/lt~obsolete.m4'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
configure.ac:18: installing './compile'
configure.ac:27: installing './config.guess'
configure.ac:27: installing './config.sub'
configure.ac:7: installing './install-sh'
configure.ac:7: installing './missing'
plugins/Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
plugins/Makefile.am: installing './depcomp'
tests/Makefile.am:12: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
3.生成Makefile
预先配置好环境变量,交叉工具链arm-linux-gcc路径
./configure --host=arm-linux --prefix=安装路径
网上那个有教程有两种配置方式,但这里暂时没设置也能够编译通过:
1. ./configure --prefix=安装路径 --host=arm-linux ac_cv_func_malloc_0_nonnull=yes
2. echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
./configure --host=arm-linux -cache-file=arm-linux.cache --prefix=安装路径
4.编译源码
make && make install
最后在输出目录下生成 bin etc include lib 四个子目录。
bin目录下面为可执行程序 ts_calibrate ts_harvest ts_print ts_print_raw ts_test
etc目录下面只有一个文件 ts.conf
include目录下面有头文件 tslib.h
lib目录下有 libts-1.0.so.0 libts-1.0.so.0.0.0 libts.la libts.so pkgconfig ts