PDA

View Full Version : trouble linking custom widgets between different libraries



ichijoji
13th October 2010, 21:28
Hi all,

I'm trying to build up a system where a core library defines system-wide widgets, and various project libraries define project-specific widgets. The project-specific widgets inherit from the system-wide widgets. So it looks something like this:

compiled into system_widgets.so:


class OcuWidget : public QWidget
{
Q_OBJECT
//etc
};


compiled into myproject_widgets.so:


class MyProjectWidget : public OcuWidget
{
Q_OBJECT
//etc
};


I compile all of this against qt 4.5.2 and the system widgets work just fine. As soon as I try to load the project widgets, though, I get a segfault in qt:


Program received signal SIGSEGV, Segmentation fault.
0x010f7f51 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
from /usr/lib/libQtGui.so.4
(gdb)
(gdb) bt
#0 0x010f7f51 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
from /usr/lib/libQtGui.so.4
#1 0x010ff5ca in QApplication::notify(QObject*, QEvent*) ()
from /usr/lib/libQtGui.so.4
#2 0x01bf36cb in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
from /usr/lib/libQtCore.so.4
#3 0x01bf42b2 in QCoreApplicationPrivate::sendPostedEvents(QObject* , int, QThreadData*) () from /usr/lib/libQtCore.so.4
#4 0x01bf447d in QCoreApplication::sendPostedEvents(QObject*, int) ()
from /usr/lib/libQtCore.so.4
#5 0x01c1e3ff in ?? () from /usr/lib/libQtCore.so.4
#6 0x02404e88 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#7 0x02408730 in ?? () from /lib/libglib-2.0.so.0
#8 0x02408863 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#9 0x01c1e02c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#10 0x01198be5 in ?? () from /usr/lib/libQtGui.so.4
#11 0x01bf1c79 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#12 0x01bf20ca in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
from /usr/lib/libQtCore.so.4
#13 0x01bf453f in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#14 0x010f7dd7 in QApplication::exec() () from /usr/lib/libQtGui.so.4
---Type <return> to continue, or q <return> to quit---
#15 0x08049502 in main (argc=1, argv=0xbfffeda4)
at /home/re2/ros/stacks/re2ocu/re2_ocu/src/nodes/ocu.cpp:11
(gdb)


I know that qt does some fancy stuff with building up its own symbols through preprocessing and such, so is there something about linking between different .so's that would cause this to happen, or is there some other issue here I'm not seeing?