Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: Ganbito on November 29, 2008, 07:19:50 pm

Title: [Solved] Developing wxSmith extension in linux get error
Post by: Ganbito on November 29, 2008, 07:19:50 pm
I'm developing an application and I want some items that not exists in wxSmith right now (like wxStyledTextCtrl or wxPropertyGrid).

By now, I'm adding then in code without wxSmith, but I want them on it for working with it more easily, so I think about creating the appropriate wxSmith extensions.

Then I went to the wiki and started the plugin development tutorials and  I installed the -dev packages for Code::Blocks and wxSmith (from jens' repository). With little modifications for linux in the project build options my first C::B plugin work.

Problems started with wxSmith extensions because wxsmith headers were not installed, only wxsmith development library. So I have to download codeblocks from svn (the same revision of jens' repository).

At the first time I didn't install it, just make and added to the project the include dirs of wxsmith and wxpropgrid from the codeblocks tree. At this time I could build my first wxsmith extension but, when I try to add it to the codeblocks plugins I get some errors (detailed on the image) and in the application log:
Code
~/.codeblocks/share/codeblocks/plugins/wxSmithChartItem.so: not loaded (missing symbols?)
Loaded 0 plugins

Then I try to uninstall jens' nightly and install C::B from source with the same result. I also try with another item, wxStyledTextCtrl, and few more things and I always get the same error, so I think that it is because wxsmith headers are not installed with it's library.

Any idea about how to solve this?

I also attach the test extension, note that I use an wxChartCtrl downloaded from wxCode and put to a third directory.

My development system:
-Ubuntu 8.04.1 x86_64
-Code::Blocks svn5323
-wxWidgets 2.8.9

[attachment deleted by admin]
Title: Re: Developing wxSmith extension in linux get error
Post by: byo on December 02, 2008, 11:27:11 pm
Please turn on extra logging by commenting this line (it's around 436 line in src/src/app.cpp):

Code
    wxLog::EnableLogging(false);

You'll need to recompile c::b from source to make it working. After that change you will have some annoying logs on startup but you'll also have name of missing symbol. That will help trace the problem.

Regards
   BYO
Title: Re: Developing wxSmith extension in linux get error
Post by: Ganbito on December 03, 2008, 01:03:01 am
Thank you, I'll go try.
Title: Re: Developing wxSmith extension in linux get error
Post by: MortenMacFly on December 03, 2008, 10:15:48 am
Code
wxLog::EnableLogging(false);
I once voted for enabling logging automatically if you use the --safe-mode command line switch. I would like to bring this up again. This is way easier than re-compiling C::B. In addition if I run "Safe Mode" I usually want to debug somehting so it makes sense... at least to me.

Any objections???
Title: Re: Developing wxSmith extension in linux get error
Post by: Ganbito on December 03, 2008, 12:15:02 pm
I finally installed codeblocks from source (I always get trouble installing it from sorce with all plugins).

You're right, byo, I have some annoying logs at startup but also the missing symbol.

First of that, as I start the Plugins Manager I get this error:
Code
Failed to create a temporary file name (error 13: Permission denied)
It is not the missing symbol, but as I get it in the Plugins Manager, I decided to report it.

Then, when I try to install the plugin, in addition to the already mentioned, I get this missing symbol:
Code
/home/cesar/.codeblocks/share/codeblocks/plugins/wxSmithChartItem.so: undefined symbol: _ZN7wxsItem20OnGetPropertiesFlagsEv

In addition to that, I started codeblocks from the command line, but I don't see nothing related to this problem.

I don't know how to get it defined, so I still need your help.
Title: Re: Developing wxSmith extension in linux get error
Post by: byo on December 03, 2008, 11:04:18 pm
I once voted for enabling logging automatically if you use the --safe-mode command line switch. I would like to bring this up again. This is way easier than re-compiling C::B. In addition if I run "Safe Mode" I usually want to debug somehting so it makes sense... at least to me.

Any objections???

True, I vote for this too. Currently I keep development sources with logging always enabled and release sources I to see the svn version running. Such option would ease the development process.

Then, when I try to install the plugin, in addition to the already mentioned, I get this missing symbol:
Code
/home/cesar/.codeblocks/share/codeblocks/plugins/wxSmithChartItem.so: undefined symbol: _ZN7wxsItem20OnGetPropertiesFlagsEv

It looks like you don't link your plugin with wxsmithlib. This is required when you want to extend wxSmith's functionality

BTW wxChartCtrl is already included in wxSmithContribItems plugin, do you want to extend it's functionality? Or is this just an research project ?

Regards
   BYO
Title: Re: Developing wxSmith extension in linux get error
Post by: Ganbito on December 04, 2008, 02:07:00 am
Yes, that's my fault.

I'm relatively new to linux programming and to codeblocks and I'm used to include libs with linux commands like `wx-config --libs` and I forget to include them as it has been added by `pkg-config --libs codeblocks`.

After linking wxsmithlib I get another symbol missed error, this time about the control, but I think that I can now manage it.

You're right, this is only an research project for testing that it works and I am just follow the wiki article. In the first post I mention two of the items I want to include, bur they aren't really important, because I can use them with an wxCustomCtrl, but they help me practice with wxsmith extensions for items of wxAui that are more difficult to manage with an wxCustomCtrl.

Code gurus can say to me that good developers write it all (and, really, that is the best way for learn). But, having an UI editor like wxsmith, I prefer not to mix UI created by wxsmith and UI coded by hand.

If finally I create any good extension, I will report them in this forum.

Thank you so much.

Edit: I think that the actual behavior of wxsmith of installing only the .so lib and not the headers (at least in linux) is confusing and a bit annoying because it makes people like me to include the lib from a linux dir (/usr/lib or /usr/local/lib) and headers from its source.
Title: Re: Developing wxSmith extension in linux get error
Post by: Ganbito on December 04, 2008, 01:09:31 pm
I still getting the last error.

As it seems that the undefined symbol belongs to the component, I link the .so of the component, but I get the same missing symbol.

Then, I think that it could be an error derived from my build of wxChartCtrl, so I try with one of the included with wxWidgets, wxStyledTextCtrl, but I get the same error, this time, the missing symbol seems to be from wxStyledTextCtrl, so I add that .so (after see that it is no called by wx-config --libs), but the error persists.
Title: Re: Developing wxSmith extension in linux get error
Post by: Jenna on December 04, 2008, 01:42:18 pm
What's the errormessage ?

Edit: I think that the actual behavior of wxsmith of installing only the .so lib and not the headers (at least in linux) is confusing and a bit annoying because it makes people like me to include the lib from a linux dir (/usr/lib or /usr/local/lib) and headers from its source.

I will have a look on it (maybe this weekend), at least for my debian repo.
Title: Re: Developing wxSmith extension in linux get error
Post by: Ganbito on December 04, 2008, 02:15:03 pm
For wxStyledTextCtrl, undefined symbol: wxSTCNameStr. I search for it in wx/stc/stc.h:
Code
1802 #ifndef SWIG
1803 extern WXDLLIMPEXP_STC const wxChar* wxSTCNameStr;
1804 class  WXDLLIMPEXP_STC wxStyledTextCtrl;
1805 class  WXDLLIMPEXP_STC wxStyledTextEvent;
1806 #endif
So, if it isn't defined linking "libwx_gtk2u_stc_2.8.so", I don't know how to solve it.

For wxChartItem, undefined symbol: _ZTV16wxPieChartPoints. This time I link "libwxchart.so", but I get that codeblocks can't find "libwxchart.so.0". I think this is because I can't install wxChart due to a error in the sample program included with wxChart, but I have itself build in it's source directory, so I linked that .so.
Title: Re: Developing wxSmith extension in linux get error
Post by: Ganbito on December 07, 2008, 08:33:32 pm
I finally can install wxStyledTextCtrl extension for wxSmith.

I had to add to my "Build options->Search directories->Linker":
Code
/usr/lib/wx
/usr/lib

The order is important. I also try to add them in reverse order or only one of them to test wich is necesary, and I get that both or them are necessary and in that order to allow codeblocks to install the plugin correctly.
Title: Re: [Solved] Developing wxSmith extension in linux get error
Post by: Jenna on December 14, 2008, 10:44:33 am
wxSmith developping headers are now included in linux-builds generated with automake-system (my nightlies for example).
Just wait for the next nightlies.
Title: Re: [Solved] Developing wxSmith extension in linux get error
Post by: Ganbito on December 14, 2008, 09:04:20 pm
Thank you, jens, I'm waiting for them.

By the way, I'm developing a plugin for wxAui. Add the wxAuiNotebook was too easy, most copy and paste from wxNotebook for wxSmith coded by byo. Now I'm working in wxAuiManager integration, wich is more difficult. I plan make it work like a sizer.
Title: Re: [Solved] Developing wxSmith extension in linux get error
Post by: byo on December 14, 2008, 10:05:38 pm
By the way, I'm developing a plugin for wxAui. Add the wxAuiNotebook was too easy, most copy and paste from wxNotebook for wxSmith coded by byo. Now I'm working in wxAuiManager integration, wich is more difficult. I plan make it work like a sizer.

Great to hear :) Do not hesitate to share the results with us :)

And of course if you see any missing features in wxSmith's api (or maybe even defects in it's design) I'm open for your comments.

Regards
   BYO
Title: Re: [Solved] Developing wxSmith extension in linux get error
Post by: Ganbito on December 17, 2008, 12:21:50 am
jens

I have installed codeblocks svn5336 from source, and I miss "wxsadvqppchild.h" in wxSmith installed include files. The other headers seems to be OK.

byo

Don't worry, when I have the plugin at a minimun degree, i'll share it.
Title: Re: [Solved] Developing wxSmith extension in linux get error
Post by: Jenna on December 17, 2008, 07:17:45 am
jens

I have installed codeblocks svn5336 from source, and I miss "wxsadvqppchild.h" in wxSmith installed include files. The other headers seems to be OK.

I just added this one and some other, that most likely are missing to the list of installed headers used for pkg-config (svn r5338).
Title: Re: [Solved] Developing wxSmith extension in linux get error
Post by: Ganbito on December 17, 2008, 04:19:19 pm
Well done, this time I can build my plugin with installed headers and pkg-config only.