Please nominate your Qt Champions for 2021!

"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
    Architecture: i386
    Depends: libc6

    /opt/Qt5.1.1/5.1.1/gcc/lib/* -> -> /usr/lib/i386-linux-gnu/qt5
    /opt/Qt5.1.1/5.1.1/gcc/lib/* -> -> /usr/lib/i386-linux-gnu/qt5
    /opt/Qt5.1.1/5.1.1/gcc/lib/* -> -> /usr/lib/i386-linux-gnu/qt5
    /opt/Qt5.1.1/5.1.1/gcc/lib/* -> -> /usr/lib/i386-linux-gnu/qt5
    /opt/Qt5.1.1/5.1.1/gcc/lib/* -> -> /usr/lib/i386-linux-gnu/qt5
    /opt/Qt5.1.1/5.1.1/gcc/lib/* -> -> /usr/lib/i386-linux-gnu/qt5
    /opt/Qt5.1.1/5.1.1/gcc/lib/* -> -> /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/* -> -> /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/ -> -> /usr/bin
    /home/tranduythanh/Upfile_Tool_project/upfiletool/deb packaging/upfile.png -> upfile.png -> /usr/share/pixmaps

    And content of .sh file
    appname=basename $0 | sed s,\.sh$,,

    dirname=dirname $0

    if [ "${dirname%$tmp}" != "/" ]; then
    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 => (0xb7700000) => /opt/Qt5.1.1/5.1.1/gcc/lib/ (0xb70d1000) => /opt/Qt5.1.1/5.1.1/gcc/lib/ (0xb6f78000) => /opt/Qt5.1.1/5.1.1/gcc/lib/ (0xb6b0c000) => /opt/Qt5.1.1/5.1.1/gcc/lib/ (0xb6689000) => /usr/lib/i386-linux-gnu/ (0xb658f000) => /lib/i386-linux-gnu/ (0xb6571000) => /lib/i386-linux-gnu/ (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, 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,
    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:
    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/ // 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.

Log in to reply