Author Topic: Plugin.so: not loaded (missing symbols?) [resolved]  (Read 7081 times)

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Plugin.so: not loaded (missing symbols?) [resolved]
« on: February 28, 2007, 01:45:31 pm »
Hi, as discussed in

http://forums.codeblocks.org/index.php/topic,5290.0.html

I made a plugin (svn release 3648) that changes the menu bar:

Code
#include <sdk.h> // Code::Blocks SDK
#include <configurationpanel.h>

#include <manager.h>
#include <messagemanager.h>

#include "ThirdPlugin.h"


// Register the plugin with Code::Blocks.
// We are using an anonymous namespace so we don't litter the global one.
namespace
{
    PluginRegistrant<ThirdPlugin> reg(_T("ThirdPlugin"));
}

// events handling
BEGIN_EVENT_TABLE (ThirdPlugin, cbPlugin)
// add any events you want to handle here
END_EVENT_TABLE()


// constructor
ThirdPlugin::ThirdPlugin()
{
    // Make sure our resources are available.
    // In the generated boilerplate code we have no resources but when
    // we add some, it will be nice that this code is in place already ;)
    if(!Manager::LoadResource(_T("ThirdPlugin.zip")))
    {
        NotifyMissingFile(_T("ThirdPlugin.zip"));
    }
}

// destructor
ThirdPlugin::~ThirdPlugin()
{
}

void ThirdPlugin::OnAttach()
{
// do whatever initialization you need for your plugin
// NOTE: after this function, the inherited member variable
// m_IsAttached will be TRUE...
// You should check for it in other functions, because if it
// is FALSE, it means that the application did *not* "load"
// (see: does not need) this plugin...
}

void ThirdPlugin::OnRelease(bool appShutDown)
{
// do de-initialization for your plugin
// if appShutDown is false, the plugin is unloaded because Code::Blocks is being shut down,
// which means you must not use any of the SDK Managers
// NOTE: after this function, the inherited member variable
// m_IsAttached will be FALSE...
}
/*
int ThirdPlugin::Execute()
{
// do your magic ;)
NotImplemented(_T("ThirdPlugin::Execute()"));
return -1;
}
*/

int ThirdPlugin::Execute()
{
    if( !IsAttached() )
        return -1;
    Manager::Get()->GetMessageManager()->Log( _("Hello World!") );
    return 0;
}

int ThirdPlugin::Configure()
{
//create and display the configuration dialog for your plugin
cbConfigurationDialog dlg(Manager::Get()->GetAppWindow(), wxID_ANY, _("Your dialog title"));
cbConfigurationPanel* panel = GetConfigurationPanel(&dlg);
if (panel)
{
dlg.AttachConfigurationPanel(panel);
PlaceWindow(&dlg);
return dlg.ShowModal() == wxID_OK ? 0 : -1;
}
return -1;
}

/// Get the "Debug" menu or create it, if not present
wxMenu * getDebugMenu (wxMenuBar * const menuBar)
{
    wxMenu * debugMenu;

    // get "Debug"'s position within main menu bar
int pos = menuBar->FindMenu (_("Debug"));

    // "Debug" missing
if (wxNOT_FOUND == pos)
{
    // no "Debug" menu: get a brand new
        debugMenu = new wxMenu (_("Debug"));

        // look for a reasonable position to insert "Debug"
        pos = menuBar->FindMenu (_("Build"));

        if (wxNOT_FOUND == pos)
            menuBar->Append (debugMenu, _("Debug"));
        else
            menuBar->Insert (pos+1, debugMenu, _("Debug"));
}
else
{
    debugMenu = menuBar->GetMenu (pos);
}

return debugMenu;
}


void ThirdPlugin::BuildMenu(wxMenuBar* menuBar)
{
//The application is offering its menubar for your plugin,
//to add any menu items you want...
//Append any items you need in the menu...
//NOTE: Be careful in here... The application's menubar is at your disposal.

//NotImplemented(_T("ThirdPlugin::BuildMenu()"));



    wxMenu * debugMenu = getDebugMenu (menuBar);
// we now have a "DEBUG" menu and can add MenuItems

    debugMenu->GetMenuItemCount();

    idJTAG    = wxNewId();
    idInsight = wxNewId();
    idPxView  = wxNewId();
    idTsimd   = wxNewId();

    if (0 != debugMenu->GetMenuItemCount())
        debugMenu->AppendSeparator();

    wxMenuItem * itemInsight = new wxMenuItem (debugMenu, idJTAG, _("TriCore Debugger"), _("Start the TriCore Debugger"));
    wxMenuItem * itemJTAG    = new wxMenuItem (debugMenu, idJTAG, _("TriCore JTAG Server"), _("Start the JTAG server"));
    wxMenuItem * itemTsimd   = new wxMenuItem (debugMenu, idJTAG, _("TriCore Simulator v1.3"), _("Start the Simulator tsimd v1.3"));
    wxMenuItem * itemPxView  = new wxMenuItem (debugMenu, idJTAG, _("PxROS-HR JTAG-Server"), _("Start the PxROS-HR JTAG-Server"));
}

Build options->dirs
Quote from: "Project->Build Options->Search Directories->Compiler"
#(cb)/include
#(wx.include)

Quote from: "Project->Build Options->Search Directories->Linker"
$(#cb)/lib
$(#wx.lib)

Quote from: "Settings->Global Variables"
cb=/local/source/codeblocks/trunk/src

wx=/usr
wx.include=/usr/include/wx-2.6
wx.lib=/usr/lib

Quote from: "Code::Blocks Debug"
[13:31:46.866]: ERROR: /local/install/codeblocks/share/codeblocks/plugins/ThirdPlugin.so: not loaded (missing symbols?)

This is the build log:
Code
-------------- Build: default in ThirdPlugin ---------------
Compiling: ThirdPlugin.cpp
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,f95,java,ada --disable-checking --with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk --disable-libjava-multilib --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --without-system-libunwind --host=i586-suse-linux
Thread model: posix
gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)
 /usr/lib/gcc/i586-suse-linux/4.0.2/cc1plus -E -quiet -v -I/opt/gnome/include/codeblocks -I/usr/lib/wx/include/gtk2-unicode-release-2.6 -I/usr/include/wx-2.6 -I/local/install/codeblocks/include/codeblocks -I/usr/include/wx-2.6 -I/usr/include -D_GNU_SOURCE -DGTK_NO_CHECK_CASTS -D__WXGTK__ -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1 -DNO_GCC_PRAGMA /local/source/ThirdPlugin/ThirdPlugin.cpp -mtune=pentium -fworking-directory -fpch-preprocess -o ThirdPlugin.ii
ignoring nonexistent directory "/opt/gnome/include/codeblocks"
ignoring duplicate directory "/usr/include/wx-2.6"
ignoring duplicate directory "/usr/include"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/wx/include/gtk2-unicode-release-2.6
 /usr/include/wx-2.6
 /local/install/codeblocks/include/codeblocks
 /usr/include/c++/4.0.2
 /usr/include/c++/4.0.2/i586-suse-linux
 /usr/include/c++/4.0.2/backward
 /usr/local/include
 /usr/lib/gcc/i586-suse-linux/4.0.2/include
 /usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/include
 /usr/include
End of search list.
 /usr/lib/gcc/i586-suse-linux/4.0.2/cc1plus -fpreprocessed ThirdPlugin.ii -quiet -dumpbase ThirdPlugin.cpp -mtune=pentium -auxbase-strip .objs/ThirdPlugin.o -g -version -o ThirdPlugin.s
GNU C++ version 4.0.2 20050901 (prerelease) (SUSE Linux) (i586-suse-linux)
compiled by GNU C version 4.0.2 20050901 (prerelease) (SUSE Linux).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129491
 /usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/as -V -Qy -o .objs/ThirdPlugin.o ThirdPlugin.s
GNU assembler version 2.16.91.0.2 (i586-suse-linux) using BFD version 2.16.91.0.2 20050720 (SuSE Linux)
Linking dynamic library: ThirdPlugin.so
Using built-in specs.
Target: i586-suse-linux
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --libdir=/usr/lib --libexecdir=/usr/lib --enable-languages=c,c++,objc,f95,java,ada --disable-checking --with-gxx-include-dir=/usr/include/c++/4.0.2 --enable-java-awt=gtk --disable-libjava-multilib --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit --without-system-libunwind --host=i586-suse-linux
Thread model: posix
gcc version 4.0.2 20050901 (prerelease) (SUSE Linux)
 /usr/lib/gcc/i586-suse-linux/4.0.2/collect2 --eh-frame-hdr -m elf_i386 -shared -o ThirdPlugin.so /usr/lib/gcc/i586-suse-linux/4.0.2/../../../crti.o /usr/lib/gcc/i586-suse-linux/4.0.2/crtbeginS.o -L/local/install/codeblocks/lib -L/usr/lib -L/opt/gnome/lib -L/usr/X11R6/lib -L/usr/lib/gcc/i586-suse-linux/4.0.2 -L/usr/lib/gcc/i586-suse-linux/4.0.2 -L/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/lib -L/usr/lib/gcc/i586-suse-linux/4.0.2/../../.. .objs/ThirdPlugin.o -lcodeblocks -lwx_gtk2u_xrc-2.6 -lwx_gtk2u_qa-2.6 -lwx_gtk2u_html-2.6 -lwx_gtk2u_adv-2.6 -lwx_gtk2u_core-2.6 -lwx_baseu_xml-2.6 -lwx_baseu_net-2.6 -lwx_baseu-2.6 -lstdc++ -lm -lgcc_s -lpthread -lc -lgcc_s /usr/lib/gcc/i586-suse-linux/4.0.2/crtendS.o /usr/lib/gcc/i586-suse-linux/4.0.2/../../../crtn.o
Running target post-build steps
zip -j9 ThirdPlugin.zip manifest.xml
  adding: manifest.xml (deflated 51%)
zip -j9 ThirdPlugin.cbplugin ThirdPlugin.so ThirdPlugin.zip
updating: ThirdPlugin.so
 (deflated 68%)
updating: ThirdPlugin.zip (deflated 8%)
Process terminated with status 0 (0 minutes, 8 seconds)
0 errors, 0 warnings

My install procedure is:
- Rebuild plugin
- leave c::b
- copy plugin files (.so + .zip)
- lauch c::b

Can you give me some hints? How can I get a more eloquent debug message that tells me the missing symbols' names?

Thanks
« Last Edit: March 01, 2007, 03:19:34 pm by stardust »
Own SVN builds (quite new) • SuSE Linux 10.0 • Linux kernel 2.6.13-15-default
gcc 4.0.2 (20050901)
wxGTK-2.6.1.0-4 • KDE 3.4.2b • gtk2 2.8.3-4

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Plugin.so: not loaded (missing symbols?)
« Reply #1 on: February 28, 2007, 03:05:43 pm »
Quote
Can you give me some hints? How can I get a more eloquent debug message that tells me the missing symbols' names?

You have to comment-out two lines in sdk/pluginmanager.cpp to view the missing symbols:

  • Line 761
  • Line 843

Be patient!
This bug will be fixed soon...

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Plugin.so: not loaded (missing symbols?)
« Reply #2 on: February 28, 2007, 06:03:26 pm »
Ok,

the Symbol is "wxMenuBar" in "ThirdPlugin.getDebugMenu" (_ZN11ThirdPlugin12getDebugMenuEP9wxMenuBar)

ldd told me, that it took libcodeblocks.so.0 from a f***ing old standard installation.

I removed /opt/gnome/lib/libcodeblocks.so.0 and changed the linker search directory from $(#cb)/lib to $(#cb.lib) and cb.lib=<c::b-install-dir>/lib

Now, "ldd -v ThirdPlugin.so" says that libcodeblocks.so.0 cannot be found.

What can I do about that? Must I add -lcodeblocks.so.0 to the linker options? Or reconfigure C::B because of pkg-config stuff?
Own SVN builds (quite new) • SuSE Linux 10.0 • Linux kernel 2.6.13-15-default
gcc 4.0.2 (20050901)
wxGTK-2.6.1.0-4 • KDE 3.4.2b • gtk2 2.8.3-4

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Plugin.so: not loaded (missing symbols?)
« Reply #3 on: March 01, 2007, 12:06:47 pm »
Update:

I added <c::b-install-dir>/lib to LD_LIBRARY_PATH reconfigured/rebuilt c::b, rebuilt/copied the plugin and restarted c::b, but the error is still the same, i.e. wxMenuBar in ThirdPlugin::getDebugMenu cannot be resolved.





Own SVN builds (quite new) • SuSE Linux 10.0 • Linux kernel 2.6.13-15-default
gcc 4.0.2 (20050901)
wxGTK-2.6.1.0-4 • KDE 3.4.2b • gtk2 2.8.3-4

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Plugin.so: not loaded (missing symbols?) [resolved]
« Reply #4 on: March 01, 2007, 03:21:27 pm »
The error was the getDebugMenu instead of ThirdPlugin::getDebugMenu. I an too much into C and Java...

Own SVN builds (quite new) • SuSE Linux 10.0 • Linux kernel 2.6.13-15-default
gcc 4.0.2 (20050901)
wxGTK-2.6.1.0-4 • KDE 3.4.2b • gtk2 2.8.3-4