Author Topic: HelloWorld Plugin on Ubuntu 11.04  (Read 13523 times)

Offline hibbity

  • Multiple posting newcomer
  • *
  • Posts: 41
HelloWorld Plugin on Ubuntu 11.04
« on: May 27, 2011, 10:52:18 pm »
Ubuntu 11.04,  Codeblocks 10.05 installed from apt sources.

Plugin compiles and installs without errors, however:
    Plugin does not show up in Contrib pallette
    Plugin does not show up in Plugins drop down menu
    Zip file contains the manifest.xml file *only*.

I have checked similar threads for example:
   Getting started with plugins [resolved] http://forums.codeblocks.org/index.php/topic,5166.0.html
   
If I follow the wiki tutorial:  http://wiki.codeblocks.org/index.php?title=Managing_Plug-in_Resources
    verbatim, specifically the section, "Tutorial: Creating a New Plugin and Examining Its Structure"
    then add /usr/local/include/wx-2.8 to Project-->Build Options-->Search Directories-->Compiler
    and compile, then it compiles with 0 errors and 0 warnings.

    But the HelloWorld.zip file only contains the "manifest.xml" file, and nothing else.
 
    This result is easily repeatable with the above defined steps.
     What have I missed to get a different result than the wiki tutorial?


Offline hibbity

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #1 on: May 27, 2011, 11:41:53 pm »
Here is the Build Log:

-------------- Build: default in HelloWorld ---------------

Compiling: HelloWorld.cpp
Linking dynamic library: HelloWorld.so
Output size is 243.68 KB
Running target post-build steps
zip -j9 HelloWorld.zip manifest.xml
updating: manifest.xml (deflated 53%)
zip -j9 HelloWorld.cbplugin HelloWorld.so HelloWorld.zip
updating: HelloWorld.so (deflated 70%)
updating: HelloWorld.zip (deflated 12%)
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings
 

Offline hibbity

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #2 on: May 27, 2011, 11:50:02 pm »
Executing from the command line:

zip -j9 HelloWorld.cbplugin HelloWorld.so HelloWorld.zip
    updating: HelloWorld.so (deflated 70%)
    updating: HelloWorld.zip (deflated 12%)

ls -la HelloWorld.zip
    -rw-r--r-- 1 guest users 409 2011-05-27 14:33 HelloWorld.zip

less HellowWorld.zip

Archive:  HelloWorld.zip
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
     500  Defl:X      235  53% 2011-05-27 13:35 0b802f01  manifest.xml
--------          -------  ---                            -------
     500              235  53%                            1 file
HelloWorld.zip (END)

[off topic] BTW does anyone know what Font-Face to select for a fixed font in a posting?
Assigning font=Courier (using the standard format for font, e.g. [ f o n t = F o n t N a m e ] Some Text Here [ / f o n t ]) does not provide the expected result.
« Last Edit: May 27, 2011, 11:55:24 pm by hibbity »

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2228
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #3 on: May 28, 2011, 03:06:12 pm »
A ".cbplugin" file simply packages the plugin for distribution. It does not of itself install the plugin.

To install the plugin,

the .zip file containing the .xml file must be copied to
...\share\CodeBlocks\

and the .so or .dll must be copied to ...\share\CodeBlocks\plugins\

Set your logging to "full command line" via Menu>Settings>Compiler and Debugger>Other Settings>Compiler Logging.

You can use the post build steps to doing the copying.


OR:

You can use Menu>Plugins>Manage plugins>Install new

then navigate to the .cbplugin file and click on it.
« Last Edit: May 28, 2011, 03:11:16 pm by Pecan »

Offline hibbity

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #4 on: May 30, 2011, 03:59:53 pm »
To install the plugin,

the .zip file containing the .xml file must be copied to
...\share\CodeBlocks\

and the .so or .dll must be copied to ...\share\CodeBlocks\plugins\


These directories do not exist on my system. 
I am developing on Ubuntu, and all software has been installed from apt sources.

What I do have is /usr/lib/codeblocks/plugins/  which contains lib*.so files,
and /usr/share/codeblocks/  which contains *.zip files.

Are these the relevant directories I should be using?

Perhaps you could refer me to the developer's guide where all this is documented
in detail.  There is a developer's guide, right?

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12597
    • Travis build status
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #5 on: May 30, 2011, 04:05:37 pm »
No there isn't :)
Some notes on the wiki and there is a sticky topic on the top of this subforum.

The directory you're looking for is ~/.codeblocks/share/...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #6 on: May 30, 2011, 04:42:02 pm »
Doing what Pecan told you as second possibility is the normal way:
OR:

You can use Menu>Plugins>Manage plugins>Install new

then navigate to the .cbplugin file and click on it.


Offline hibbity

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #7 on: May 30, 2011, 04:45:28 pm »
Okay thank you.   Now I have:
~/.codeblocks/share/codeblocks/HelloWorld.zip
~/.codeblocks/share/codeblocks/plugins/HelloWorld.so

meaning the plugin has been installed in its expected location.

How can I make HelloWorld plugin show up in Menu-->Plugins list, or more importantly, make it visible in the Contrib widgets toolbar pallette?

Offline hibbity

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #8 on: May 30, 2011, 11:48:55 pm »
Gave up on the HelloWorld plugin, at least for now.

Compiled wxthings (wxscustombutton)

/usr/bin/codeblocks --debug-log

-------------- Build: default in CustomButton ---------------
Compiling: wxscustombutton.cpp
Linking dynamic library: custombutton.so
Output size is 458.84 KB
Running target post-build steps
zip -j9 custombutton.zip manifest.xml
updating: manifest.xml (deflated 52%)
zip -j9 custombutton.cbplugin custombutton.so custombutton.zip
updating: custombutton.so
 (deflated 68%)
updating: custombutton.zip
 (deflated 12%)
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings

Then, with Menu-->Plugins-->Manage plugins-->Install new
installed the plugin.  But with error message, see attached image file.

There were no command line messages printed to accompany this failed install.
So I don't know why it failed.

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12597
    • Travis build status
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #9 on: May 31, 2011, 12:52:37 am »
Most of the time the library on linux should be called libsomething.so, so try to add the lib prefix to the name.
Also you can try to use the "-z defs" linker option.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline hibbity

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #10 on: May 31, 2011, 04:33:58 pm »
wxthings (wxscustombutton) was authored in 2009, but it should still work as-is even after the most recent release.  I don't understand why it will not install.  I'm linking against unicode libraries (wxWidgets 2.8.12), could that be a problem?

 /usr/bin/codeblocks -d
-------------- Build: default in CustomButton ---------------
g++  -g -I/usr/include/codeblocks -I/usr/include/codeblocks/tinyxml -I/usr/include/codeblocks/scripting/include -I/usr/include/codeblocks/scripting/bindings -I/usr/include/codeblocks/scripting/sqplus -I/usr/include/codeblocks/wxscintilla/include    -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread   -march=i586   -I/usr/local/include/wx-2.8 -I/usr/include/wxsmith/contrib/include -Iwxthings/include -I/usr/local/include/wx-2.8 -I/usr/include/wxsmith/contrib/include -Iwxthings/include  -c /home/guest/custom_widgets/wxlinux/wxthings/custombutton.cpp -o .objs/custombutton.o
g++  -g -I/usr/include/codeblocks -I/usr/include/codeblocks/tinyxml -I/usr/include/codeblocks/scripting/include -I/usr/include/codeblocks/scripting/bindings -I/usr/include/codeblocks/scripting/sqplus -I/usr/include/codeblocks/wxscintilla/include    -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread   -march=i586   -I/usr/local/include/wx-2.8 -I/usr/include/wxsmith/contrib/include -Iwxthings/include -I/usr/local/include/wx-2.8 -I/usr/include/wxsmith/contrib/include -Iwxthings/include  -c /home/guest/custom_widgets/wxlinux/wxthings/wxscustombutton.cpp -o .objs/wxscustombutton.o
g++ -shared  .objs/custombutton.o .objs/wxscustombutton.o   -o custombutton.so -z def -lcodeblocks    -pthread -Wl,-Bsymbolic-functions  -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
Output size is 458.84 KB
Running target post-build steps
zip -j9 custombutton.zip manifest.xml
updating: manifest.xml (deflated 52%)
zip -j9 custombutton.cbplugin custombutton.so custombutton.zip
updating: custombutton.so
 (deflated 68%)
updating: custombutton.zip (deflated 11%)
Process terminated with status 0 (0 minutes, 3 seconds)
0 errors, 0 warnings

Not sure what "-z defs" is intended for?  It does not show up as an option for g++.
Adding it to Linker settings (Other options) causes 50 link errors:
e.g.
.objs/wxscustombutton.o: In function `wxsCustomButton':
/home/guest/custom_widgets/wxlinux/wxthings/wxscustombutton.cpp:68: undefined reference to `wxsWidget::wxsWidget(wxsItemResData*, wxsItemInfo const*, wxsEventDesc const*, wxsStyleSet const*, long)'
.objs/wxscustombutton.o: In function `wxsCustomButton::OnBuildCreatingCode()':
/home/guest/custom_widgets/wxlinux/wxthings/wxscustombutton.cpp:129: undefined reference to `wxsItem::Codef(wchar_t const*, ...)'
/home/guest/custom_widgets/wxlinux/wxthings/wxscustombutton.cpp:132: undefined reference to `wxsBitmapIconData::IsEmpty()'
/home/guest/custom_widgets/wxlinux/wxthings/wxscustombutton.cpp:134: undefined reference to `wxsItem::Codef(wchar_t const*, ...)'
/home/guest/custom_widgets/wxlinux/wxthings/wxscustombutton.cpp:137: undefined reference to `wxsBitmapIconData::IsEmpty()'
/home/guest/custom_widgets/wxlinux/wxthings/wxscustombutton.cpp:139: undefined reference to `wxsItem::Codef(wchar_t const*, ...)'

etc.
« Last Edit: May 31, 2011, 04:46:08 pm by hibbity »

Online oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12597
    • Travis build status
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #11 on: May 31, 2011, 04:47:12 pm »
It is a linker options and it is defs not def!

http://www.computerhope.com/unix/uld.htm
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7253
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #12 on: May 31, 2011, 04:50:22 pm »
If I see it right, you do not link against the wxSmith library.

Offline hibbity

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #13 on: May 31, 2011, 05:08:37 pm »
Added the wxsmithlib library to the Project-->Build options-->Linker settings-->Link libraries
then rebuilt (0 errors and 0 warnings) then Plugins-->Manage plugins...-->Install new
and result was the same as before.

Offline hibbity

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: HelloWorld Plugin on Ubuntu 11.04
« Reply #14 on: May 31, 2011, 05:13:21 pm »
ld -z defs:  

"Force a fatal error if any undefined symbols remain at the end of the link. This is the default when an executable is built. It is also useful when building a shared object to assure that the object is self-contained, that is, that all its symbolic references are resolved internally."

Makes sense.  But, in this case I cannot see 'ld' being invoked.  Could it be that g++ performs the linking?