Error at run time

  • I am getting this error trying to run a simple embedded test program:

    symbol lookup error: /devel/work/embedTest-build-desktop/embedTest: undefined symbol: _ZN7QWidget8qwsEventEP8QWSEvent

    I installed an embedded version (4.6.3) along side my desktop version (also 4.6.3) and added the qte version to the my QtCreator instance. Then created a very simple test, just a ui with a label in it. It builds ok, but fails with the error message above.

    I'm sure it must be something simple that I am over looking. Can anyone give me a clue.

    System is Ubuntu 9.1 on toshiba laptop
    Qt 4.6.3
    (And yes, qvfb is running)

    Here is the gdb output:

    jon@lapdog:/devel/work/embedTest$ gdb --args embedTest -qws
    GNU gdb (GDB) 7.0-ubuntu
    Copyright (C) 2009 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law. Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i486-linux-gnu".
    For bug reporting instructions, please see:
    Reading symbols from /devel/work/embedTest/embedTest...done.
    (gdb) run
    Starting program: /devel/work/embedTest/embedTest -qws
    [Thread debugging using libthread_db enabled]

    Program received signal SIGSEGV, Segmentation fault.
    0xb7422542 in QMetaObject::cast(QObject*) const () from /usr/lib/
    (gdb) bt
    #0 0xb7422542 in QMetaObject::cast(QObject*) const () from /usr/lib/
    #1 0xb7bdf9bf in QToolBarLayout::QToolBarLayout(QWidget*) () from /usr/lib/
    #2 0xb7bde6ef in ?? () from /usr/lib/
    #3 0xb7bded4d in QToolBar::QToolBar(QWidget*) () from /usr/lib/
    #4 0x0804ac20 in Ui_MainWindow::setupUi(QMainWindow*) ()
    #5 0x0804a8ef in MainWindow::MainWindow(QWidget*) ()
    #6 0x0804a67b in main ()

    Hmmm, what is line #2 trying to tell me?

    Here is the build output:

    on@lapdog:/devel/work/embedTest$ make
    /opt/qt/qte-4.6.3/bin/uic MainWindow.ui -o ui_MainWindow.h
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/qt/qte-4.6.3/mkspecs/qws/linux-x86-g++ -I. -I/opt/qt/qte-4.6.3/include/QtCore -I/opt/qt/qte-4.6.3/include/QtNetwork -I/opt/qt/qte-4.6.3/include/QtGui -I/opt/qt/qte-4.6.3/include -I. -I. -o main.o main.cpp
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/qt/qte-4.6.3/mkspecs/qws/linux-x86-g++ -I. -I/opt/qt/qte-4.6.3/include/QtCore -I/opt/qt/qte-4.6.3/include/QtNetwork -I/opt/qt/qte-4.6.3/include/QtGui -I/opt/qt/qte-4.6.3/include -I. -I. -o MainWindow.o MainWindow.cpp
    /opt/qt/qte-4.6.3/bin/moc -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/qt/qte-4.6.3/mkspecs/qws/linux-x86-g++ -I. -I/opt/qt/qte-4.6.3/include/QtCore -I/opt/qt/qte-4.6.3/include/QtNetwork -I/opt/qt/qte-4.6.3/include/QtGui -I/opt/qt/qte-4.6.3/include -I. -I. MainWindow.h -o moc_MainWindow.cpp
    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/qt/qte-4.6.3/mkspecs/qws/linux-x86-g++ -I. -I/opt/qt/qte-4.6.3/include/QtCore -I/opt/qt/qte-4.6.3/include/QtNetwork -I/opt/qt/qte-4.6.3/include/QtGui -I/opt/qt/qte-4.6.3/include -I. -I. -o moc_MainWindow.o moc_MainWindow.cpp
    g++ -Wl,-O1 -o embedTest main.o MainWindow.o moc_MainWindow.o -L/opt/qt/qte-4.6.3/lib -lQtGui -L/opt/qt/qte-4.6.3/lib -lQtNetwork -lQtCore -lpthread

  • It seems that you use "QWidget::qwsEvent() ": According to the docs this is not available in non-embedded linux environments. It could be that you linked against embedded Qt version but try to run against desktop Qt version. The libs have the same name and the desktop version is in the library search path. You might bypass this with setting LD_LIBRARY_PATH.

  • Install c++filt (apt-get install c++filt) very useful with those cryptic error messages ;)

    @$ echo _ZN7QWidget8qwsEventEP8QWSEvent | c++filt


  • Volker, I think you're correct. Running ldd shows:
    . => /usr/lib/ (0xb6e7c000) => /usr/lib/ (0xb6d66000) => /usr/lib/ (0xb6b32000)
    which are all desktop library versions.

    Having to dork around with LD_LIBRARY_PATH seems like a kludgy way to deal with this issue. Surely other people have both embedded and desktop versions on the same box. More google.

    And thanks to ucomedag, I will get c++filter

  • You can try to add

    LIBS += -Wl,-rpath,/opt/qt/qte-4.6.3/lib

    This adds the lib path to your binary. See the end of the section 3.4 of

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.