"symbol lookup error" runtime error on Linux
-
Hi,
I have an Qt C++ desktop application named Upfile. I used "Debreate" to create deb file. I created deb file successfully then install it on development computer - Ubuntu 12.1 32 bit, it worked ok. But when I tried to run it on my friend computer - Ubuntu 13.04 32 bit, it crash with error:
@Upfile: symbol lookup error: Upfile: undefined symbol: _ZN26QMessageAuthenticationCodeC1EN18QCryptographicHash9AlgorithmERK10QByteArray@
This is content of Debreate .dpb file
@[DEBREATE-0.7.7]
<<CTRL>>
...
Architecture: i386
Depends: libc6
...<</CTRL>>
<<FILES>>
1
/opt/Qt5.1.1/5.1.1/gcc/lib/libicuuc.so.51* -> libicuuc.so.51 -> /usr/lib/i386-linux-gnu/qt5
/opt/Qt5.1.1/5.1.1/gcc/lib/libicui18n.so.51* -> libicui18n.so.51 -> /usr/lib/i386-linux-gnu/qt5
/opt/Qt5.1.1/5.1.1/gcc/lib/libicudata.so.51* -> libicudata.so.51 -> /usr/lib/i386-linux-gnu/qt5
/opt/Qt5.1.1/5.1.1/gcc/lib/libQt5Widgets.so.5* -> libQt5Widgets.so.5 -> /usr/lib/i386-linux-gnu/qt5
/opt/Qt5.1.1/5.1.1/gcc/lib/libQt5Network.so.5* -> libQt5Network.so.5 -> /usr/lib/i386-linux-gnu/qt5
/opt/Qt5.1.1/5.1.1/gcc/lib/libQt5Gui.so.5* -> libQt5Gui.so.5 -> /usr/lib/i386-linux-gnu/qt5
/opt/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5* -> libQt5Core.so.5 -> /usr/lib/i386-linux-gnu/qt5
/home/tranduythanh/Upfile_Tool_project/upfiletool/deb packaging/upfile.desktop -> upfile.desktop -> /usr/share/applications
/opt/Qt5.1.1/5.1.1/gcc/plugins/platforms/libqxcb.so* -> libqxcb.so -> /usr/lib/i386-linux-gnu/qt5/platforms
/home/tranduythanh/Upfile_Tool_project/upfiletool/deb packaging/Upfile* -> Upfile -> /usr/bin
/home/tranduythanh/Upfile_Tool_project/upfiletool/deb packaging/upfile.sh -> upfile.sh -> /usr/bin
/home/tranduythanh/Upfile_Tool_project/upfiletool/deb packaging/upfile.png -> upfile.png -> /usr/share/pixmaps
<</FILES>>
<[removed]>
<<PREINST>>
0
<</PREINST>>
<<POSTINST>>
0
<</POSTINST>>
<<PRERM>>
0
<</PRERM>>
<<POSTRM>>
0
<</POSTRM>>
<[removed]>
...@And content of .sh file
@#!/bin/sh
appname=basename $0 | sed s,\.sh$,,
dirname=
dirname $0
tmp="${dirname#?}"if [ "${dirname%$tmp}" != "/" ]; then
dirname=$PWD/$dirname
fi
LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/qt5
export LD_LIBRARY_PATH
$dirname/$appname "$@"@I googled and gave some try on this error. Here're what I got:
// On my development computer
@c++filt _ZN26QMessageAuthenticationCodeC1EN18QCryptographicHash9AlgorithmERK10QByteArray
QMessageAuthenticationCode::QMessageAuthenticationCode(QCryptographicHash::Algorithm, QByteArray const&)@@ldd -d -r myapp
linux-gate.so.1 => (0xb7700000)
libQt5Widgets.so.5 => /opt/Qt5.1.1/5.1.1/gcc/lib/libQt5Widgets.so.5 (0xb70d1000)
libQt5Network.so.5 => /opt/Qt5.1.1/5.1.1/gcc/lib/libQt5Network.so.5 (0xb6f78000)
libQt5Gui.so.5 => /opt/Qt5.1.1/5.1.1/gcc/lib/libQt5Gui.so.5 (0xb6b0c000)
libQt5Core.so.5 => /opt/Qt5.1.1/5.1.1/gcc/lib/libQt5Core.so.5 (0xb6689000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xb658f000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xb6571000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb63c7000)
...@// On my friend computer without Qt installed
@ldd -d -r myapp
....
undefined symbol: _ZNK26QMessageAuthenticationCode6resultEv (/usr/bin/Upfile)
undefined symbol: _ZN26QMessageAuthenticationCodeC1EN18QCryptographicHash9AlgorithmERK10QByteArray (/usr/bin/Upfile)
undefined symbol: _ZNK19QAbstractTableModel5flagsERK11QModelIndex (/usr/bin/Upfile)
undefined symbol: _ZN26QMessageAuthenticationCodeD1Ev (/usr/bin/Upfile)
undefined symbol: _ZN26QMessageAuthenticationCode7addDataERK10QByteArray (/usr/bin/Upfile)
undefined symbol: _ZN26QMessageAuthenticationCode6setKeyERK10QByteArray (/usr/bin/Upfile)@I don't know what is the root cause of this problem. Please help.
P/S: Sorry for my bad English. I have cut some info to avoid error "Your post is too large. The maximum number of allowed characters is 6000"
-
Are you saying your friend does not have Qt installed?
-
So, you made and built an application which requires qt, and expected it to run on your friends computer....how, exactly?
And your .sh file is seriously screwed. LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/qt5
There is no way that would run on anyone else's system..
-
Hi t3685 and sreich,
Sorry for my late response.
Hi t3685:
Yes, I want to make sure that my app will work properly on any computer.Hi serich,
Yes.
About my .sh file setting LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/qt5, let me explain my think. As you can see content of my Debreate .dpb file, I think (and checked) that Debreate will help me to copy dynamic dlls too LD_LIBRARY_PATH and I also have this code first in my main() function of main.cpp:
@QApplication::addLibraryPath("/usr/lib/i386-linux-gnu/qt5");@
P/S: I think that setting LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/qt5 is not clear. It will clearer if set LD_LIBRARY_PATH=/usr/lib/i386-linux-gnu/upfile... But generally, I think It will work for my case.Can you all please tell me where I'm wrong.
Thank you all so much.
-
If your application depends on the Qt then it's never going to work on a pc without Qt. (Note: I am talking about the Qt libraries, not the Qt creator)
Check this link:
-
Hi t3685,
Thanks for your information.
As you can see from my posts, I distribute Qt libraries with my application. The Qt libraries and executable are placed in separated folders.
Finally, I found that I set wrong Exec path to start up script in .desktop file so that my destination folder path(LD_LIBRARY_PATH) that contains qt distributed libraries cannot be exported.
@[Desktop Entry]
...
Exec=bash /usr/bin/myapp.sh // wrong path here
...
@Now it works well. But I still cannot run my app directly from executable file. I'm trying on it.
Thank you all so much.