January 6, 2011

jonald21 jonald21
Lab Rat
2 posts

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 © 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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:
<http://www.gnu.org/software/gdb/bugs/>…
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/libQtCore.so.4
(gdb) bt
#0 0xb7422542 in QMetaObject::cast(QObject*) const () from /usr/lib/libQtCore.so.4
#1 0xb7bdf9bf in QToolBarLayout::QToolBarLayout(QWidget*) () from /usr/lib/libQtGui.so.4
#2 0xb7bde6ef in ?? () from /usr/lib/libQtGui.so.4
#3 0xb7bded4d in QToolBar::QToolBar(QWidget*) () from /usr/lib/libQtGui.so.4
#4 0×0804ac20 in Ui_MainWindow::setupUi(QMainWindow*) ()
#5 0×0804a8ef in MainWindow::MainWindow(QWidget*) ()
#6 0×0804a67b in main ()
(gdb)

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

4 replies

January 6, 2011

Volker Volker
Ant Farmer
5428 posts

It seems that you use QWidget::qwsEvent() [doc.trolltech.com]. 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.

January 6, 2011

ucomesdag ucomesdag
Lab Rat
243 posts

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

  1. $ echo _ZN7QWidget8qwsEventEP8QWSEvent | c++filt
  2.  
  3. QWidget::qwsEvent(QWSEvent*)

 Signature 

Write “Qt”, not “QT” (QuickTime).

January 6, 2011

jonald21 jonald21
Lab Rat
2 posts

Volker, I think you’re correct. Running ldd shows:
.
libQtGui.so.4 => /usr/lib/libQtGui.so.4 (0xb6e7c000)
libQtNetwork.so.4 => /usr/lib/libQtNetwork.so.4 (0xb6d66000)
libQtCore.so.4 => /usr/lib/libQtCore.so.4 (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

January 6, 2011

Volker Volker
Ant Farmer
5428 posts

You can try to add

  1. 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 http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html

 
  ‹‹ Java/ECMA script error in BrowserNG      Best way to manage UI layout in Qt ››

You must log in to post a reply. Not a member yet? Register here!