PDA

View Full Version : Dependency between pugins - loader failed



Szyk
31st December 2018, 14:35
Hi
I have Qt Creator classic widget project based on shared libraries and plugins:

TEMPLATE = subdirs
SUBDIRS = \
Src/Libs/Common \
Src/Libs/Editor \
Src/Libs/TextprofanLib \
Src/Plugins/TextEditorPlugin \
Src/Plugins/SyntaxHighligterPlugin \
Src/Textprofan

Textprofan is exe project (with main() and Application class). TextprofanLib, Common and Editor are shared libs. Two other are plugins.
Project is good designed and written it is also fully compileable (with out warnings).
The only problem is when I load plugins: TextEditorPlugin load succesfully, but SyntaxHighligterPlugin fail to load due to unresolved dependency from TextEditorPlugin. I checked this with mc that unvisible function realy exists in TextEditorPlugin. So I have no idea why it is not loaded...
Output from my program is as follow:


"QLocalSocket::connectToServer: Invalid name"
"TextEditorPlugin plugin dependency checked. Path: /home/szyk/!-pro/Textprofan4-work/Plugins/libTextEditorPluginD.so"
"SyntaxHighlighterPlugin plugin dependency checked. Path: /home/szyk/!-pro/Textprofan4-work/Plugins/libSyntaxHighlighterPluginD.so"
"TextEditorPlugin plugin dependency checked. Path: /home/szyk/!-pro/Textprofan4-work/Plugins/libTextEditorPluginD.so"
"TextEditorPlugin plugin sucessfuly loaded. Path: /home/szyk/!-pro/Textprofan4-work/Plugins/libTextEditorPluginD.so"
"File: ../../../../Textprofan4/Src/Libs/TextprofanLib/Src/Factories/Plugins.cpp, in line: 140, in function: loadPlugin\nError code: 3, Error message: SyntaxHighlighterPlugin plugin load failed! Path: /home/szyk/!-pro/Textprofan4-work/Plugins/libSyntaxHighlighterPluginD.so\nError message: Cannot load library /home/szyk/!-pro/Textprofan4-work/Plugins/libSyntaxHighlighterPluginD.so: (/home/szyk/!-pro/Textprofan4-work/Plugins/libSyntaxHighlighterPluginD.so: undefined symbol: _ZN16TextEditorPlugin10TextEditor16staticMetaObjec tE)"
Exception occurs! Sender: Textprofan.so, Error code: 3
Message:
File: ../../../../Textprofan4/Src/Libs/TextprofanLib/Src/Factories/Plugins.cpp, in line: 140, in function: loadPlugin
Error code: 3, Error message: SyntaxHighlighterPlugin plugin load failed! Path: /home/szyk/!-pro/Textprofan4-work/Plugins/libSyntaxHighlighterPluginD.so
Error message: Cannot load library /home/szyk/!-pro/Textprofan4-work/Plugins/libSyntaxHighlighterPluginD.so: (/home/szyk/!-pro/Textprofan4-work/Plugins/libSyntaxHighlighterPluginD.so: undefined symbol: _ZN16TextEditorPlugin10TextEditor16staticMetaObjec tE)


Ok. After I just wrote this I realize not link explicity Src/Plugins/TextEditorPlugin to Src/Plugins/SyntaxHighligterPlugin. Program still not running but I make progress...

anda_skoa
31st December 2018, 15:25
Linking against a library in two different ways (as a dynamic library and a plugin), might be problematic in any case.

Maybe you can refactor the common parts needed by both plugins into a separate library and link both plugins against that instead of one plugin against the other.

Cheers,
_