PDA

View Full Version : libraries in plugins



KShots
1st May 2007, 00:53
Hello all,

I have a plugin that I'm attempting to use that links to a library that my main application makes no use of. When run in my application, it crashes (seg-fault). When run as a standard application (built an application to use the plugin as a normal class rather than a plugin), it works fine.

How do I convince my Qt plugins that are linked to other libraries to work?

KShots
2nd May 2007, 15:00
When compiled as a standard application, the core is linked with SDL. When compiled as a plugin, the core knows nothing of SDL and relies on the plugin to do all the linking. In order for this to function, do I need to link the core to SDL, even though the core itself for the most part has nothing to do with SDL?

Do I need to link the core to all obscure libraries because some plugin developer might eventually use them? I'm trying to think of a viable solution - there must be some way to link the library to the plugin that will survive QPluginLoader.

bmesing
2nd May 2007, 19:08
I am not sure how things work in Windows, but in Linux that should not be a problem.
E.g. ldd libaptplugin.so (one of my plugins) gives me the following list:

> ldd libaptplugin.so
libapt-pkg-libc6.3-6.so.3.11 => /usr/lib/libapt-pkg-libc6.3-6.so.3.11 (0x00002b6283ab6000)
libz.so.1 => /usr/lib/libz.so.1 (0x00002b6283c78000)
libsigc-2.0.so.0 => /usr/lib/libsigc-2.0.so.0 (0x00002b6283d8e000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00002b6283e93000)
libQt3Support.so.4 => /usr/lib/libQt3Support.so.4 (0x00002b6283fa9000)
....


Did you have a look at http://doc.trolltech.com/4.2/deployment-windows.html? There is a description for deploying plugins for Windows.

KShots
2nd May 2007, 20:18
Ah, I forgot about ldd.

Using ldd, I found that my plugin wasn't linking to SDL... then I noticed a libxxxxxx_debug.so, which was linked to SDL. Then I promptly smacked myself and re-built the plugin in release mode. Apparently I was working with an old plugin and thinking it was the one I just built. There is no inherrant problem in Qt in linking to plugins that link to libraries. I feel slightly stupid, now.

One thing that may help this sort of thing is if I can find some way of debugging my plugins. Whenever I step into a function of my plugin, my debugger simply steps over that function. I don't get to see exactly what's going on inside.

My primary target is linux. While my main core application should run under windows, there's a high probability that a large amount of my plugins won't, due to non-portable libraries that I'll be forced to use (for example, ALSA for an audio mixer capability).

fullmetalcoder
2nd May 2007, 22:02
One thing that may help this sort of thing is if I can find some way of debugging my plugins. Whenever I step into a function of my plugin, my debugger simply steps over that function. I don't get to see exactly what's going on inside.
Sounds weird... What debugger are you using??? I've been playing with plugins since quite a while and sometimes relied on gdb to track errors and never noticed such a behaviour... maybe because I'm using CLI...

KShots
3rd May 2007, 01:18
I'm using kdbg

high_flyer
3rd May 2007, 14:06
Then I promptly smacked myself and re-built the plugin in release mode.
Any thing you compile with out debug information, your debugger will have hard time stepping thorugh...