Tuesday, May 5, 2009

tslib的编译

tslib在用户层对触摸屏的数据进行滤波、去抖、校准等,同时提供给应用程序统一的接口。常见的GUI,如Qt,MiniGUI等一般都支持tslib接口。
首先在编译tslib之前需要确保安装了autoconf, automake, libtool这几个工具,否则会在编译的时候报错。错误信息如下:
1、如果autoconf和automake未安装,对于tslib-1.4会指示无法识别autogen.sh文件第4行的autoreconf指令。
2、如果未安装libtool工具,则会提示
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 186.
Use of uninitialized value $libtoolize in pattern match (m//) at /usr/bin/autoreconf line 186.
configure.ac:25: 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:26: error: possibly undefined macro: AC_ENABLE_SHARED
configure.ac:27: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
configure.ac:28: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1
因此,可以在以下步骤之前先执行以下两条指令:
apt-get install autoconf automake
apt-get install libtool

一、tslib-1.3
1. cd tslib-1.3
2. export PREFIX=$PWD/build
3. export CC=arm-linux-gcc
4. ./autogen.sh
5. ./configure --host=arm-linux --prefix=$PREFIX --cache-file=arm-linux.cache --enable-inputapi=no
6. vi plugins/Makefile
LDFLAGS :=$(LDFLAGS) -rpath $(PLUGIN_DIR)修改为
LDFLAGS :=$(LDFLAGS) -rpath `cd $(PLUGIN_DIR) && pwd`
如果没有此步骤,在make的时候会出现libtool:link: only absolute run-paths are allowed错误
7. make
8. make install

二、tslib-1.4
1. cd tslib-1.4
2. ./tslib-compile.sh
将tslib-1.4的编译过程写成脚本tslib-compile.sh 以方便编译。
附: tslib-compile.sh
export PREFIX=$PWD/build
export CC=arm-linux-gcc
#/*
# *autogen.sh is an important .sh file£?it produce ./configure file according to current env setting
# */
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache

#/*(it is better to see what parameter that the ./configure program take,use "./configure --help")
# *you can add "--enable-debug"([default=no]),and/or "--enable-static"([default=no])
# */
./configure --host=arm-linux --prefix=$PREFIX --cache-file=arm-linux.cache --enable-inputapi=no
make
make install

ps: 需要注意系统使用的libtool的版本不能太低,可以使用libtool --version查看。如在Red Hat 9里面的libtool版本为1.4.3,编译tslib-1.3没问题,但是编译tslib-1.4时会出现错误:
configure.ac:57: error: possibly undefined macro: AS_HELP_STRING

测试环境:
VMware 5.5.1 & Ubuntu 8.10 & arm-linux-gcc-3.4.6-glibc-2.3.6 & libtool 2.2.4

No comments:

Post a Comment