error while loading shared libraries: libts.so.0
-
I now create a signature capture function on the below environment.
- unbutu 18.04
- qt4.8.5
- cross compile : arm-linux-gnueabihf-7.3
I have built the finger paint example in the qt 4.8.5 like the following step.
1. tslib intall- configuration
./configure CC=/home/Toolchain/arm-linux-gnueabihf-7.3/bin/arm-linux-gnueabihf-gcc --prefix=/usr/local/tslib --host=arm-linux-gnueabihf
2. qt4.8.5 install
- qmake configuration(mkspecs/qws/linux-arm-gnueabihf-g++/qmake.conf) for building with linux-arm-gnueabihf-g++
# modifications to g++.conf QMAKE_CC = /home/Toolchain/arm-linux-gnueabihf-7.3/bin/arm-linux-gnueabihf-gcc QMAKE_CXX = /home/Toolchain/arm-linux-gnueabihf-7.3/bin/arm-linux-gnueabihf-g++ QMAKE_LINK = /home/Toolchain/arm-linux-gnueabihf-7.3/bin/arm-linux-gnueabihf-g++ QMAKE_LINK_SHLIB = /home/Toolchain/arm-linux-gnueabihf-7.3/bin/arm-linux-gnueabihf-g++ # modifications to linux.conf QMAKE_AR = /home/Toolchain/arm-linux-gnueabihf-7.3/bin/arm-linux-gnueabihf-ar cqs QMAKE_OBJCOPY = /home/Toolchain/arm-linux-gnueabihf-7.3/bin/arm-linux-gnueabihf-objcopy QMAKE_STRIP = /home/Toolchain/arm-linux-gnueabihf-7.3/bin/arm-linux-gnueabihf-strip QMAKE_CXXFLAGS += $$QMAKE_CFLAGS QMAKE_INCDIR += /usr/local/tslib/include QMAKE_LIBDIR += /usr/local/tslib/lib QMAKE_LFLAGS += -Wl,-rpath-link,/usr/local/tslib/lib
- configuration
./configure -prefix /usr/local/Qt4.8.5 -embedded arm -platform qws/linux-x86-g++ -xplatform qws/linux-arm-gnueabihf-g++ -static -no-mmx -no-rpath -no-3dnow -no-sse -no-sse2 -no-glib -no-cups -no-largefile -no-accessibility -no-openssl -no-gtkstyle -little-endian -qt-gfx-linuxfb -fontconfig -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-webkit -no-qt3support -nomake examples -nomake demos -nomake docs -nomake translations -qt-freetype -qt-libjpeg -qt-libpng -qt-kbd-tty -qt-kbd-linuxinput -qt-mouse-linuxinput -qt-mouse-tslib -no-pch
3. Qt creator environment setting and Project build
- Setting : compiler path, target device, kits(compiler, device, Qt version) etc.
- Project building : example/touch/fingerprint project build
4. Taget Setting
- tslib copy
: copy the tslib of the host(/usr/local/tslib) into the target(/usr/local/tslib) - path export
export QT_QWS_FONTDIR=/usr/local/Trolltech/QtEmbedded-4.8.5/lib/fonts export TSLIB_ROOT=/Qt/tslib export TSLIB_CONSOLEDEVICE=none export TSLIB_TSDEVICE=/dev/input/event0 export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf export TSLIB_CALIBFILE=/mnt/nand/pointercal export QWS_MOUSE_PROTO=Tslib:/dev/input/event0 export QWS_DISPLAY=LinuxFb:/dev/fb0
5. fingerpaint run
I have run the fingerpaint on the target board.
But the follwing error is displayed../fingerpaint: error while loading shared libraries: libts.so.0: cannot open shared object file: No such file or directory
Which point should I check to resolve this problem?
Thanks.
-
@Andy117
Your target machine apparently requireslibts.so.0
at runtime, so do you havelibts.so
-anything anywhere on that? If it came from: copy the tslib of the host(/usr/local/tslib) into the target(/usr/local/tslib)
check if it is there. And that the runtime looks there. Maybe that copy is not enough. If it is there and found check with
ldd
that it does not have further missing dependencies, that can give the (slightly misleading) message which you see. -
The tslib is located in the following directory.
ls /usr/local/tslib -al total 0 drwxr-xr-x 7 root root 480 Jul 5 14:21 . drwxr-xr-x 4 root root 368 Jul 5 14:21 .. drwxr-xr-x 2 root root 936 Jul 5 14:21 bin drwxr-xr-x 2 root root 224 Jul 5 14:21 etc drwxr-xr-x 2 root root 224 Jul 5 14:21 include drwxr-xr-x 4 root root 584 Jul 5 14:21 lib drwxr-xr-x 3 root root 224 Jul 5 14:21 share
But the libts.so.0 is not found
ldd -v fingerpaint linux-vdso.so.1 (0xbeb24000) libts.so.0 => not found libdl.so.2 => /lib/libdl.so.2 (0xb6ef2000) librt.so.1 => /lib/librt.so.1 (0xb6edc000) libpthread.so.0 => /lib/libpthread.so.0 (0xb6eb8000)
================================================================
Why libts.so.0 is not found?How can I build the fingerpaint statically?
The tslib, by the way, is built in dynamic link.
file /usr/local/tslib/bin/ts_calibrate
/usr/local/tslib/bin/ts_calibrate: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=d0a7cbe0bf957de18b1932a262be2d3ba25f56db, with debug_info, not stripped
-
@Andy117 said in error while loading shared libraries: libts.so.0:
The tslib is located in the following directory.
Clearly you need to look in the
lib
subdirectory there (or maybe evenshare
). And if found the directory needs to be on yourLD_LIBRARY_PATH
orRPATH
or similar, somewhere the system looks for.so
files.Why libts.so.0 is not found?
Because it does not exist, or if it is a soft link and what it points to does not exist, or is not in a location which is searched.
-
Dear JobB
The libts.so.0 is located in the /usr/local/tslib/lib and hard linked.
ls /usr/local/tslib/lib/ -al total 76 drwxr-xr-x 4 root root 584 Jul 5 18:14 . drwxr-xr-x 7 root root 480 Jul 5 14:21 .. -rwxr-xr-x 1 root root 924 Jul 1 15:30 libts.la -rwxr-xr-x 3 root root 20700 Jul 1 15:30 libts.so -rwxr-xr-x 3 root root 20700 Jul 1 15:30 libts.so.0 -rwxr-xr-x 3 root root 20700 Jul 1 15:30 libts.so.0.10.5 drwxr-xr-x 2 root root 232 Jul 5 14:21 pkgconfig drwxr-xr-x 2 root root 2272 Jul 5 14:21 ts
Thanks
-
@Andy117
So as I said then nothing is telling the system when running your executable to look in the directory/usr/local/tslib/lib
. It has no automatic reason to look these. Look atLD_LIBRARY_PATH
for a runtime solution to alter the search path or possibly atRPATH
for a link-time solution to embed the desired target path (I don't know whether that works in a cross-compile context).If you are "lazy" and just want to check that this is the runtime issue, you could temporarily soft link to
/usr/local/tslib/lib/libts.so.0
from the directory where your executable lives on the target machine.I don't do cross-compilation, but am slightly concerned by
: copy the tslib of the host(/usr/local/tslib) into the target(/usr/local/tslib)
The target is ARM, the host is not(?), not sure how this step results in target having correct tslib stuff for its architecture, but you probably know better than I.
-