这些天在交叉编译Qt源码。了解到编译之前须编译tslib库 在编译tslib库时遇到过很多问题。这里说出我出过的问题及解决方案。
参考 http://blog.csdn.net/zijie_xiao/article/details/50740950
blog.csdn.net/a1299600490/article/details/51346256
编译源码:
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 即可。
预先配置好环境变量,交叉工具链arm-linux-gcc路径
./configure --host=arm-hisiv400-linux --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
Linux下编译tslib,configure之前都正常,但make后就出现错误啦,求解。。
分享| 2012-03-18 23:14 hc07124988 | 浏览1218次 悬赏:5
编程语言
终端里最后的内容如下:
In function ‘open’,
inlined from ‘main’at ts_calibrate.c:227:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’declared with attribute error: open with O_CREAT in second argument needs 3 arguments
In function ‘open’,
inlined from ‘main’at ts_calibrate.c:229:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[2]: *** [ts_calibrate.o] 错误 1
make[2]:正在离开目录 `/opt/qt/tslib/tests'
make[1]: *** [all-recursive] 错误 1
make[1]:正在离开目录 `/opt/qt/tslib'
make: *** [all] 错误 2
2013-12-14 10:07 网友采纳
gcc 新版本编译器对语法检查严格,在源文件 ./tests/ts_calibrate.c中
// 源文件
// if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
// cal_fd = open (calfile, O_CREAT | O_RDWR);
// } else {
// cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR);
// }
// 需要更改成如下形式
if ((calfile = getenv("TSLIB_CALIBFILE")) != NULL) {
cal_fd = open (calfile, O_CREAT | O_RDWR, 0777);
} else {
cal_fd = open ("/etc/pointercal", O_CREAT | O_RDWR, 0777);
}保存后重新编译即可
make 出现错误:undefined reference 'rpl_malloc'
解决:将config.h.in中的
#undef malloc 行注释掉