Author Topic: Getting started with plugins [resolved]  (Read 12367 times)

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Getting started with plugins [resolved]
« on: February 12, 2007, 11:47:24 am »
To create my first plugin I followed the hints in 'Creating a simple "Hello World" plugin'.

The tutorial is outdated, so I added the following paths

Build options -> Search directories -> Compiler
Code: [Select]
<SOURCE>/src/sdk/propgrid/include
<SOURCE>/src/sdk/scripting/include
<SOURCE>/src/sdk/wxFlatNotebook/include
<SOURCE>/src/sdk/wxscintilla/include


Build options -> Search directories -> Linker
Code: [Select]
<SOURCE>/src/sdk/wxscintilla/include
<INSTALL>/codeblocks/lib

and built the project.

When I try to install the *.cbplugin in the "Plugins->Manage plugins -> Install new" I get a
"One or more plugins were not installed succesfully".

So what did I do wrong...?

I created the plugin with C::B's plugin wizard as Tool plugin under Linux 2.6.13, gcc 4.0.2, binutils 2.16.91.0.2, wx 2.6.1, C::B svn 3593



« Last Edit: March 01, 2007, 03:23: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 TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Getting started with plugins
« Reply #1 on: February 12, 2007, 02:20:55 pm »
Check C::B's debug log for more information. Did you create a resource .zip with a manifest for the plugin?
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2228
Re: Getting started with plugins
« Reply #2 on: February 12, 2007, 02:52:45 pm »

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Getting started with plugins
« Reply #3 on: February 12, 2007, 05:21:36 pm »
Check C::B's debug log for more information. Did you create a resource .zip with a manifest for the plugin?

There is no exception report (at least not in the /tmp where C::B usually puts them).

The resource .zip is there (you mean the MyPlugin.zip, I guess) and contains just the manifest
Code: [Select]
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_plugin_manifest_file>
    <SdkVersion major="1" minor="11"  release="8" />
    <Plugin name="MyPlugin">
        <Value title="MyPlugin" />
        <Value version="0.1" />
        <Value description="" />
        <Value author="Georg-Johann Lay" />
        <Value authorEmail="[email protected]" />
        <Value authorWebsite="" />
        <Value thanksTo="" />
        <Value license="GPL" />
    </Plugin>
</CodeBlocks_plugin_manifest_file>

The plugin dir contains the .so as expected:

Code: [Select]
-rw-rw----  1 georg users    520 2007-02-12 15:18 manifest.xml
-rw-rw----  1 georg users   1086 2007-02-12 15:18 MyPlugin.cbp
-rw-rw----  1 georg users  53482 2007-02-12 15:22 MyPlugin.cbplugin
-rw-rw----  1 georg users   1697 2007-02-12 15:22 MyPlugin.cpp
-rw-rw----  1 georg users   2292 2007-02-12 15:18 MyPlugin.h
-rwxrwx---  1 georg users 160885 2007-02-12 15:22 MyPlugin.so
-rw-rw----  1 georg users    406 2007-02-12 15:22 MyPlugin.zip

http://forums.codeblocks.org/index.php?topic=4290.msg33916#msg33916
Plug-Ins : some suggested "case" conventions

Yes, I followed the case rules.
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 TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Getting started with plugins
« Reply #4 on: February 12, 2007, 06:38:51 pm »
There is no exception report (at least not in the /tmp where C::B usually puts them).
I refer to the "Code::Blocks Debug" tab of C::B's Messages panel. (If it doesn't appear, right-click one of the panel's tabs and select Code::Blocks Debug from the Show/Hide menu.)

Additionally, have you tried copying MyPlugin.zip to share/CodeBlocks and MyPlugin.so to share/CodeBlocks/plugins to see if your plugin works when loaded on startup?
« Last Edit: February 12, 2007, 06:43:38 pm by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2228
Re: Getting started with plugins
« Reply #5 on: February 12, 2007, 07:20:34 pm »
copy the MyPlugin.so to the .../share/codeblocks/plugin directory
copy the MyPlugin.zip to the .../share/codeblocks directory

I've never used the Manage Plugin menu item. I don't know that it works. It says it's experimental.


Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Getting started with plugins
« Reply #6 on: February 13, 2007, 03:12:53 pm »
Additionally, have you tried copying MyPlugin.zip to share/CodeBlocks and MyPlugin.so to share/CodeBlocks/plugins to see if your plugin works when loaded on startup?

I just tried it.

When I start C::B after that a message comes up from the system tray that reports an error durung startup of Code::Blocks and that there is an entry in the logs...

Now, were are these mysterious logs??? I cannot find them in the GUI, browsed the installation tree, looked in /tmp, searched the /var/log ...
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 TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Getting started with plugins
« Reply #7 on: February 13, 2007, 03:21:04 pm »
I cannot find them in the GUI
I refer to the "Code::Blocks Debug" tab of C::B's Messages panel. (If it doesn't appear, right-click one of the panel's tabs and select Code::Blocks Debug from the Show/Hide menu.)
If it isn't there, it may not appear in non-debug builds of C::B. (I don't know whether that's the case or not.) If it is there -- scroll upwards.
« Last Edit: February 13, 2007, 03:22:35 pm by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Getting started with plugins
« Reply #8 on: February 13, 2007, 04:05:46 pm »
I refer to the "Code::Blocks Debug" tab of C::B's Messages panel. (If it doesn't appear, right-click one of the panel's tabs and select Code::Blocks Debug from the Show/Hide menu.)

Oh...sorry. I am not yet very familiar with C::B and these colors cannot be changed (must be somewhere in renderer?), changes to the syntax highlight scheme get lost upon a restart, etc. So blame me, I am still using emacs + console because of that...





Concerning the topic the debug log says

Quote
[15:55:32.132]: ERROR: SDK version mismatch for MyPlugin (1.11.5). Expecting 1.11.8

I updated to svn 3596 and did a rebuild and copied the filed again, but that does not fix it.
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 TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Getting started with plugins
« Reply #9 on: February 13, 2007, 04:51:27 pm »
That message means either that the current C::B SDK version is 1.11.5 and your plugin's manifest reads 1.11.8, or that the current SDK version is 1.11.8 and your manifest reads 1.11.5. Likely the former; change your SdkVersion "release" attribute to 5.

As far as your loathsome colors go, many colors can be changed in the Environment and Editor settings, but the defaults should never be unreadable. You may want to consider poking around in your OS' visual settings, or even changing to a more mainstream distribution such as Ubuntu, Fedora Core, openSUSE, etc.
« Last Edit: February 13, 2007, 04:58:43 pm by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Getting started with plugins
« Reply #10 on: February 14, 2007, 10:30:41 am »
... change your SdkVersion "release" attribute to 5.

You mean the attribute in the manifest.xml? Changing that does not help. The error message is the same. And yes, I rebuilt the plugin and copied the stuff to them folders.

As far as your loathsome colors go, many colors can be changed in the Environment and Editor settings, but the defaults should never be unreadable. You may want to consider poking around in your OS' visual settings
I confirm with you. These colors *are* loathsome. C::B retains the envoronment colors but it does *not* retain the syntax highlight colors. (since several svn versions, I am still on 3596).

In the Management.Projects tab the headers and resouce file name's foreground colors are explicitely set to black without caring for contrast. For the tabs colors I changed the tabAreaColor and it's fine.

Is there a way to change the syntax highlighter's colors by hand in some file and copy it to a location where C::B looks for it on startup? That would be much less annoying then reentering all all these not-retained colors again and again...

, or even changing to a more mainstream distribution such as Ubuntu, Fedora Core, openSUSE, etc.
Yeah, I will bother my admin when I have some days left...
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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2228
Re: Getting started with plugins
« Reply #11 on: February 14, 2007, 03:04:15 pm »
zip up your plugin source and .cbp files (or a minimal example that causes the problem).
Upload them to http://savefile.com, then paste the url here.
We'll have a look at it.

 

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Getting started with plugins
« Reply #12 on: February 15, 2007, 10:17:12 am »

The archive is there. The sdk's subsubversion in manifelst.xml is changed by hand to "8" (was "5").

http://freenet-homepage.de/hightec-rt/MyPlugin.zip
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 Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2228
Re: Getting started with plugins
« Reply #13 on: February 15, 2007, 03:24:06 pm »

The archive is there. The sdk's subsubversion in manifelst.xml is changed by hand to "8" (was "5").

http://freenet-homepage.de/hightec-rt/MyPlugin.zip

Your plugin is NOT compiling. You should have told us of your errors.


The plugin wizard is producing an incorrect .cbp file.
Insert the following into Build Options/Search Directories

Re-compile, re-install. Note any compile errors.



Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Getting started with plugins
« Reply #14 on: February 15, 2007, 03:30:04 pm »
Quote
The plugin wizard is producing an incorrect .cbp file.
Insert the following into Build Options/Search Directories

Pecan, these are the old directories. The new ones use include/ instead of sdk/...
Be patient!
This bug will be fixed soon...

Offline TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Getting started with plugins
« Reply #15 on: February 15, 2007, 03:37:03 pm »
stardust: Since there have been changes made to the directory structure of the C::B sources recently, please make sure you're running and compiling against a version of Code::Blocks at or beyond revision 3604. Regenerate your plugin project and, if it still doesn't work, post the new sources.

As a side note: the manifests for C::B's standard plugins all use 1.10.0, so that's what I'd been using in my manifest.xml without problems.
« Last Edit: February 15, 2007, 03:38:58 pm by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Getting started with plugins
« Reply #16 on: February 15, 2007, 04:03:33 pm »
Quote
As a side note: the manifests for C::B's standard plugins all use 1.10.0, so that's what I'd been using in my manifest.xml without problems.

For the time being, the version number in the XML is not taken into account.
Be patient!
This bug will be fixed soon...

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2228
Re: Getting started with plugins
« Reply #17 on: February 15, 2007, 04:26:07 pm »
Quote
The plugin wizard is producing an incorrect .cbp file.
Insert the following into Build Options/Search Directories

Pecan, these are the old directories. The new ones use include/ instead of sdk/...

Acknowledged

@Stardust,
Just make sure your compiler search directories point to the include files for where ever the sdk headers are on your codeblocks system.

You should be able to compile without errors (except for the pkg-config error, which I removed from my copy of your MyPlugin.cbp because it was producing incorrect results).
« Last Edit: February 15, 2007, 04:28:53 pm by Pecan »

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Getting started with plugins
« Reply #18 on: February 19, 2007, 04:15:29 pm »
Your plugin is NOT compiling. You should have told us of your errors.

Äh... The plugin project did compile without warnings and errors (svn 3596):
Quote
Code: [Select]
-------------- Build: default in MyPlugin ---------------
Compiling: MyPlugin.cpp
Linking dynamic library: MyPlugin.so
Running target post-build steps
zip -j9 MyPlugin.zip manifest.xml
updating: manifest.xml (deflated 52%)
zip -j9 MyPlugin.cbplugin MyPlugin.so MyPlugin.zip
updating: MyPlugin.so (deflated 67%)
updating: MyPlugin.zip (deflated 8%)
Process terminated with status 0 (0 minutes, 5 seconds)
0 errors, 0 warnings

I now switched to svn 3615 and when I start c::b there is a "Global Variable Editor" dialog popping up for "cb" with the fields base, include, lib, obj, cflags, lflags. For "cb.base"  I entered the c::b source folder, i.e. where bootstrap is located.

For "wx" I am clueless. I entered
wx.base=/usr
wx.include=include/wx-2.6
wx.lib=lib

Is that correct?

Building the MyPlugin yields the same as above: no errors, no warnings

restarting c::b, the error in the logs is still the same
Code: [Select]
[16:26:44.282]: ERROR: SDK version mismatch for MyPlugin (1.11.5). Expecting 1.11.8
« Last Edit: February 19, 2007, 04:28:53 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 TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Getting started with plugins
« Reply #19 on: February 19, 2007, 04:42:13 pm »
Since the version in the manifest is being ignored, my next guess would be that you're compiling the plugin against a different version of C::B than the version you're trying to use the plugin with. Make sure that the version you compile against is the version you test with.
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Getting started with plugins
« Reply #20 on: February 19, 2007, 05:09:42 pm »
Make sure that the version you compile against is the version you test with.

There is only one instance (source and an installation generated from it) of c::b in my system so that should be ok. At the moment this is svn 3615.

The plugin's source directory is not located in the c::b plugins directory. Does that matter?
« Last Edit: February 19, 2007, 05:12:09 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 TDragon

  • Lives here!
  • ****
  • Posts: 943
    • TDM-GCC
Re: Getting started with plugins
« Reply #21 on: February 19, 2007, 05:22:23 pm »
The plugin's source directory is not located in the c::b plugins directory. Does that matter?
It shouldn't...

All I can say is make sure everything matches up. Ensure that the revision displayed on C::B's start page matches the revision shown by the "svn info" command. Delete your plugin .so and make sure that it's created where it should be when you compile it (so that you aren't inadvertently using an older version). Make sure you aren't mistakenly using an older version of C::B that's floating around on your system somewhere.

In my limited knowledge of the C::B sdk, the relevant areas of code appear to be sdk/pluginmanager.cpp in the PluginManager::RegisterPlugin function and include/cbplugin.h in PluginRegistrant's SDKVersion function. As far as I can see, your versions would only fail to match when the PLUGIN_SDK_VERSION_* constants change between revisions and you rebuild C::B but not your plugin, or vice versa.
« Last Edit: February 19, 2007, 05:29:36 pm by TDragon »
https://jmeubank.github.io/tdm-gcc/ - TDM-GCC compiler suite for Windows (GCC 9.2.0 2020-03-08, 32/64-bit, no extra DLLs)

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Getting started with plugins
« Reply #22 on: February 20, 2007, 05:21:14 pm »
Ok, I threw away all c::b sources, checked out svn 3627, rebuilt c::b from scratch, had the project wizard generated a brand new plugin "SecondPlugin", entered #cb and #wx stuff and built it:

Code: [Select]
Process terminated with status 0 (0 minutes, 5 seconds)
0 errors, 0 warnings

copied the files to the mentioned locations, quit and resterted c::b (the same as I generated the plugin with) and the problem is still the same:

Code: [Select]
[16:55:15.929]: ERROR: SDK version mismatch for SecondPlugin (1.11.5). Expecting 1.11.10

Are my settings of #cb and #wx correct?

SecondPlugin->Build Options->default->Search Directories->Compiler
$(#cb)/include
$(#wx.include)
$(#cb)/sdk/scintilla/include

SecondPlugin->Build Options->default->Search Directories->Linker
$(#cb)/lib

Anyway, as the project builds without errors (i.e. no missing include files, no unresolved references) these settings should do resp. are not used at all...

The SecondPlugin is there:

http://freenet-homepage.de/hightec-rt/SecondPlugin.zip

I did not change the sdk version entry in the manifest. Everything is untouched and comes right from c::b.
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: 4291
    • Code::Blocks IDE
Re: Getting started with plugins
« Reply #23 on: February 20, 2007, 05:46:26 pm »
Quote
I did not change the sdk version entry in the manifest. Everything is untouched and comes right from c::b.

As stated above, the version in the manifest is currently ignored.
Anyway, the version number your plugin uses is "created" at compile-time with the help of the PluginRegistrant class (in cbPlugin.h). This uses the PLUGIN_SDK_VERSION_* macros (located in the same file). So, if your plugin is still built for the wrong SDK version, this can only mean one thing: you have installed the C::B SDK globally (e.g. /usr/include or /usr/local/include) and the compiler picks up that version, that is the wrong one.
So, uninstall any C::B headers from global dirs and rebuild your plugin. This will work.
Be patient!
This bug will be fixed soon...

Offline stardust

  • Multiple posting newcomer
  • *
  • Posts: 55
    • http://www.hightec-rt.com
Re: Getting started with plugins
« Reply #24 on: February 21, 2007, 05:40:13 pm »
*ARRGGH*

Yes, there *were* remains from an ancient standard installation of c::b in
/usr/local/include/codeblocks and /opt/gnome/include/codeblocks.

Thanks!

Now it runs and says "Hello World!"!!!! :D

By the way...

why are crtn.o, crtbeginS.o etc. put into a .so?

Quote from: build log
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
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