Qt5无法加载模块tslib,因为pthres.so

时间:2014-03-04 15:25:18

标签: qt5 embedded-linux

我在嵌入式设备上遇到了一个奇怪的问题。当我运行qt5

someQt5App -platform eglfs -plugin tslib

QIconvCodec::convertFromUnicode: using Latin-1 for conversion, iconv_open failed
QIconvCodec::convertToUnicode: using Latin-1 for conversion, iconv_open failed
EGLFS: Unable to query physical screen size, defaulting to 100 dpi.
EGLFS: To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
QTsLibMouseHandler "tslib" "" 
Loading module /usr/lib/ts//input.so
Loading module /usr/lib/ts//pthres.so
Couldnt load module pthres
Error configuring
: No such file or directory

所以这首先让我觉得没有pthres.so,但有,我查了一下。我认为pthres无法正确加载,我不知道为什么。我有一些strace输出

write(1, "Loading module /usr/lib/ts//pthr"..., 38) = 38
open("/usr/lib/ts//pthres.so", O_RDONLY|O_CLOEXEC) = 13
read(13, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0p\5\0\0004\0\0\0"..., 512) = 512
fstat64(13, {st_mode=S_IFREG|0755, st_size=3940, ...}) = 0
mmap2(NULL, 35424, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 13, 0) = 0x2aae4000
mprotect(0x2aae5000, 28672, PROT_NONE)  = 0
mmap2(0x2aaec000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 13, 0) = 0x2aaec000
close(13)                               = 0
munmap(0x2aae4000, 35424)               = 0
write(2, "Couldnt load module pthres\n", 27) = 27
close(12)                               = 0
munmap(0x2aae0000, 4096)                = 0
write(2, "Error configuring\n: No such file"..., 46) = 46
write(5, "\1\0\0\0\0\0\0\0", 8)         = 8

所以在这里我可以看到模块已加载,无论出于什么原因关闭,我不知道为什么关闭。

Pthres可用

# ls -l /usr/lib/ts/pthres.so 
-rwxr-xr-x    1 root     root          3940 Feb 24  2014 /usr/lib/ts/pthres.so

仅供参考我移动了pthres,这是尝试的strace

write(1, "Loading module /usr/lib/ts//pthr"..., 38) = 38
open("/usr/lib/ts//pthres.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
write(2, "Couldnt load module pthres\n", 27) = 27
close(12)                               = 0
munmap(0x2abaa000, 4096)                = 0
write(2, "Error configuring\n: No such file"..., 46) = 46

设备环境(适用于qt4 / qws)

# env
TSLIB_TSDEVICE=/dev/input/event2
USER=root
OLDPWD=/
HOME=/
PAGER=/usr/bin/less
TERM=vt102
PATH=/sbin:/usr/sbin:/bin:/usr/bin
TSLIB_CONFFILE=/etc/ts.conf
MANPAGER=/usr/bin/less
SHELL=/bin/sh
PWD=/usr/lib/ts
TZ=US/Eastern
POINTERCAL_FILE=/thermo/pointercal
TSLIB_CALIBFILE=/thermo/pointercal

2 个答案:

答案 0 :(得分:0)

想出来,事实证明tslib的错误是误导性的。这是与pthres的链接错误,有人在某处有一个补丁。

diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index c54a690..4aedac2 100644
@@ -107,15 +107,19 @@ pluginexec_LTLIBRARIES = \

 variance_la_SOURCES    = variance.c
 variance_la_LDFLAGS    = -module $(LTVSN)
+variance_la_LIBADD = $(top_builddir)/src/libts.la

 dejitter_la_SOURCES    = dejitter.c
 dejitter_la_LDFLAGS    = -module $(LTVSN)
+dejitter_la_LIBADD = $(top_builddir)/src/libts.la

 linear_la_SOURCES  = linear.c
 linear_la_LDFLAGS  = -module $(LTVSN)
+linear_la_LIBADD   = $(top_builddir)/src/libts.la

 pthres_la_SOURCES  = pthres.c
 pthres_la_LDFLAGS  = -module $(LTVSN)
+pthres_la_LIBADD   = $(top_builddir)/src/libts.la

 # hw access
 corgi_la_SOURCES   = corgi-raw.c

答案 1 :(得分:0)

您可以像Kevin提到的那样修改makfile.am,也可以运行以下命令并在没有任何麻烦的情况下运行您的应用程序。

export LD_PRELOAD=/usr/lib/libts-x.x.so.x.x.x

其中x是您正在使用的tslib的版本