Results 1 to 7 of 7

Thread: libraries in plugins

  1. #1
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default libraries in plugins

    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?
    Life without passion is death in disguise

  2. #2
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: libraries in plugins

    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.
    Life without passion is death in disguise

  3. #3
    Join Date
    Feb 2006
    Posts
    32
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: libraries in plugins

    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:
    Qt Code:
    1. > ldd libaptplugin.so
    2. libapt-pkg-libc6.3-6.so.3.11 => /usr/lib/libapt-pkg-libc6.3-6.so.3.11 (0x00002b6283ab6000)
    3. libz.so.1 => /usr/lib/libz.so.1 (0x00002b6283c78000)
    4. libsigc-2.0.so.0 => /usr/lib/libsigc-2.0.so.0 (0x00002b6283d8e000)
    5. libpthread.so.0 => /lib/libpthread.so.0 (0x00002b6283e93000)
    6. libQt3Support.so.4 => /usr/lib/libQt3Support.so.4 (0x00002b6283fa9000)
    7. ....
    To copy to clipboard, switch view to plain text mode 

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

  4. #4
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: libraries in plugins

    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).
    Life without passion is death in disguise

  5. #5
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: libraries in plugins

    Quote Originally Posted by KShots View Post
    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...
    Current Qt projects : QCodeEdit, RotiDeCode

  6. #6
    Join Date
    Feb 2006
    Location
    USA
    Posts
    142
    Thanks
    24
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: libraries in plugins

    I'm using kdbg
    Life without passion is death in disguise

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: libraries in plugins

    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...
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Combining Qt with other libraries (Boost, ...)
    By Raistlin in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2007, 06:28
  2. Hot to define the directory for the dynamic libraries?
    By Dark_Tower in forum Qt Programming
    Replies: 5
    Last Post: 28th December 2006, 22:15
  3. Qt 3.3 libraries
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st December 2006, 17:25
  4. Standardization on libraries
    By brcain in forum General Discussion
    Replies: 13
    Last Post: 16th August 2006, 22:56
  5. Replies: 4
    Last Post: 7th March 2006, 08:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.