1.交叉编译器,我的是友善的
2.下载tslib-1.4.tar.gz
https://download.csdn.net/download/u011171361/10702429
3.安装一些库:
apt-get install automake autogen autoconf libtool
4.配置 gedit /etc/profile
#交叉编译器路径
export PATH=$PATH:/opt/FriendlyARM/toolschain/4.5.1/bin/
#tslib config
#填自己的交叉编译器路径
export TOOLCHAIN=/opt/FriendlyARM/toolschain/4.5.1
export TB_CC_PREFIX=arm-linux-
export PKG_CONFIG_PREFIX=$TOOLCHAIN/arm-linux
export TSLIB_ROOT=/usr/local/tslib
export TSLIB_TSDEVICE=/dev/event0
export POINTERCAL_FILE=/etc/pointercal
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CONSOLEDEVICE=none
export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:/lib:/usr/lib:$LD_LIBRARY
5.解压tslib-1.4.tar.gz,并进入tslib
#我的tslib-1.4.tar.gz放在/home/mysmbshare,解压也在这个目录
jump@mylubuntu:/home/mysmbshare/tslib# tar zxvf tslib-1.4.tar.gz
jump@mylubuntu:/home/mysmbshare/tslib# cd tslib
4.执行以下代码: 注:PLUGIN_DIR=“换成自己解压的路径/plugins” -prefix="是要安装的路径"
jump@mylubuntu:/home/mysmbshare/tslib# ./autogen.sh
jump@mylubuntu:/home/mysmbshare/tslib# echo "ac_cv_func_malloc_0 _nonnull=yes" >arm-linux.cache
jump@mylubuntu:/home/mysmbshare/tslib# ./configure --host=arm--linux- --cache-file=arm-linux.cache --enable-inputapi=no PLUGIN_DIR=/home/mysmbshare/tslib/plugins -prefix=/usr/local/arm/tslib/ -host=arm-linux --cache-file=arm-linux.cache 2>&1 | tee conf_log
jump@mylubuntu:/home/mysmbshare/tslib# make 2>&1 | tee make_log
jump@mylubuntu:/home/mysmbshare/tslib# make install
中间会遇到一个error ----- undefined reference to `rpl_malloc'
执行make时遇到的error:
root@mylubuntu:/home/mysmbshare/tslib# make
...............
ts_test.o: In function `main':
ts_test.c:(.text+0x4d4): undefined reference to `rpl_malloc'
fbutils.o: In function `open_framebuffer':
fbutils.c:(.text+0x108): undefined reference to `rpl_malloc'
collect2: ld returned 1 exit status
Makefile:452: recipe for target 'ts_test' failed
make[2]: *** [ts_test] Error 1
make[2]: Leaving directory '/home/mysmbshare/tslib/tests'
Makefile:481: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/mysmbshare/tslib'
Makefile:392: recipe for target 'all' failed
make: *** [all] Error 2
解决方法:
编辑tslib文件夹下的config.h.in 将文件中的以下两行注释掉
//#undef HAVE_MALLOC 文件中的47行
//#undef malloc 文件中的189行
再次执行步骤4,就ok了。
......................
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/mysmbshare/tslib/tests'
make[1]: Leaving directory '/home/mysmbshare/tslib/tests'
make[1]: Entering directory '/home/mysmbshare/tslib'
make[2]: Entering directory '/home/mysmbshare/tslib'
make[2]: Nothing to be done for 'install-exec-am'.
/bin/mkdir -p '/usr/local/arm/tslib/lib/pkgconfig'
/usr/bin/install -c -m 644 tslib-0.0.pc '/usr/local/arm/tslib/lib/pkgconfig'
make[2]: Leaving directory '/home/mysmbshare/tslib'
make[1]: Leaving directory '/home/mysmbshare/tslib'
5.照葫芦画瓢,网上文章很多,借鉴前辈们的