Author Topic: Python plugin  (Read 2764 times)

Offline crobar

  • Multiple posting newcomer
  • *
  • Posts: 15
Python plugin
« on: January 08, 2019, 01:50:31 pm »
I attempted to build the python plugin, i.e.

https://github.com/spillz/codeblocks-python

(which looks awesome). However, build fails with the following error:

Code: [Select]
XmlRpcEvents.cpp -o .objs/XmlRpcEvents.o
rm -f libXmlRpcEmbedder.a
ar -r -s libXmlRpcEmbedder.a .objs/ExecHiddenMSW.o .objs/XMLRPC/src/XmlRpcClient.o .objs/XMLRPC/src/XmlRpcDispatch.o .objs/XMLRPC/src/XmlRpcServer.o .objs/XMLRPC/src/XmlRpcServerConnection.o .objs/XMLRPC/src/XmlRpcServerMethod.o .objs/XMLRPC/src/XmlRpcSocket.o .objs/XMLRPC/src/XmlRpcSource.o .objs/XMLRPC/src/XmlRpcUtil.o .objs/XMLRPC/src/XmlRpcValue.o .objs/xmlrpc_embedder.o .objs/XmlRpcEvents.o
/home/rcrozier/src/codeblocks-python-git/XmlRpcEmbedder/xmlrpc_embedder.cpp: In member function void XmlRpcInstance::OnEndProcess(wxProcessEvent&):
/home/rcrozier/src/codeblocks-python-git/XmlRpcEmbedder/xmlrpc_embedder.cpp:463:37: error: virtual void wxEvtHandler::AddPendingEvent(const wxEvent&) is inaccessible within this context
         m_parent->AddPendingEvent(ce);
                                     ^
In file included from /usr/include/wx-3.0/wx/app.h:19:0,
                 from /home/rcrozier/src/codeblocks-python-git/XmlRpcEmbedder/xmlrpc_embedder.h:4,
                 from /home/rcrozier/src/codeblocks-python-git/XmlRpcEmbedder/xmlrpc_embedder.cpp:3:
/usr/include/wx-3.0/wx/event.h:3387:18: note: declared here
     virtual void AddPendingEvent(const wxEvent& event)
                  ^~~~~~~~~~~~~~~
Process terminated with status 1 (0 minute(s), 2 second(s))
1 error(s), 2 warning(s) (0 minute(s), 2 second(s))

I then googled and found this

https://forums.wxwidgets.org/viewtopic.php?t=22962

However, (some time ago) I tried fixing this and then found other errors, I guess this is generally due to changes in wxWidgets (plugin depends on v2?). In general, does anyone know if anyone is working on this plugin? I left a github issue but the author never responded. I feel like someone experienced with the plugin system, codeblocks and wxWidgets could probably fix this in about 20 minutes.

Offline crobar

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Python plugin
« Reply #1 on: January 08, 2019, 03:22:18 pm »
I made a fork and began making some fixes here:

https://github.com/crobarcro/codeblocks-python

one of the issues with the plugin is the definition of some constants is missing:

Code: [Select]
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp:177:39: error: wxSCI_KEYMOD_CTRL was not declared in this scope
         CmdKeyAssign(wxSCI_KEY_LEFT,  wxSCI_KEYMOD_CTRL,                   wxSCI_CMD_WORDPARTLEFT);
                                       ^~~~~~~~~~~~~~~~~
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp:179:57: error: wxSCI_KEYMOD_SHIFT was not declared in this scope
         CmdKeyAssign(wxSCI_KEY_LEFT,  wxSCI_KEYMOD_CTRL|wxSCI_KEYMOD_SHIFT, wxSCI_CMD_WORDPARTLEFTEXTEND);
                                                         ^~~~~~~~~~~~~~~~~~
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp:184:39: error: wxSCI_KEYMOD_CTRL was not declared in this scope
         CmdKeyAssign(wxSCI_KEY_LEFT,  wxSCI_KEYMOD_CTRL,                   wxSCI_CMD_WORDLEFT);
                                       ^~~~~~~~~~~~~~~~~
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp:186:57: error: wxSCI_KEYMOD_SHIFT was not declared in this scope
         CmdKeyAssign(wxSCI_KEY_LEFT,  wxSCI_KEYMOD_CTRL|wxSCI_KEYMOD_SHIFT, wxSCI_CMD_WORDLEFTEXTEND);
                                                         ^~~~~~~~~~~~~~~~~~
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp:201:38: error: wxSCI_KEYMOD_NORM was not declared in this scope
         CmdKeyAssign(wxSCI_KEY_END,  wxSCI_KEYMOD_NORM,                  wxSCI_CMD_LINEENDWRAP);
                                      ^~~~~~~~~~~~~~~~~
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp:202:38: error: wxSCI_KEYMOD_ALT was not declared in this scope
         CmdKeyAssign(wxSCI_KEY_END,  wxSCI_KEYMOD_ALT,                   wxSCI_CMD_LINEEND);
                                      ^~~~~~~~~~~~~~~~
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp:203:38: error: wxSCI_KEYMOD_SHIFT was not declared in this scope
         CmdKeyAssign(wxSCI_KEY_END,  wxSCI_KEYMOD_SHIFT,                 wxSCI_CMD_LINEENDWRAPEXTEND);
                                      ^~~~~~~~~~~~~~~~~~
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp:224:38: error: wxSCI_KEYMOD_ALT was not declared in this scope
         CmdKeyAssign(wxSCI_KEY_END,  wxSCI_KEYMOD_ALT,                   wxSCI_CMD_LINEENDWRAP);
                                      ^~~~~~~~~~~~~~~~
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp:225:38: error: wxSCI_KEYMOD_SHIFT was not declared in this scope
         CmdKeyAssign(wxSCI_KEY_END,  wxSCI_KEYMOD_SHIFT|wxSCI_KEYMOD_ALT, wxSCI_CMD_LINEENDWRAPEXTEND);
                                      ^~~~~~~~~~~~~~~~~~

I presume at some point these were defined somewhere in the code provided by codeblocks, but are no longer present. Can anyone tell me if there are appropriate replacements for these?

Offline crobar

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Python plugin
« Reply #2 on: January 08, 2019, 04:09:40 pm »
Ok, I realised I needed to change _KEYMOD_ to _SCMOD_

Now I get the following errors:

Code: [Select]
-------------- Build: cbplugin in PythonInterpreter (compiler: GNU GCC Compiler)---------------

g++ -Wall -ansi -g -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -DcbDEBUG -DCB_PRECOMP -std=c++11 -g -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I/usr/local/include/codeblocks -I/usr/local/include/codeblocks/tinyxml -I/usr/local/include/codeblocks/scripting/include -I/usr/local/include/codeblocks/scripting/bindings -I/usr/local/include/codeblocks/scripting/sqplus -I/usr/local/include/codeblocks/wxscintilla/include -I../XmlRpcEmbedder -I../XmlRpcEmbedder/XMLRPC/include -c /home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/PythonInterpCtrl.cpp -o .objs/PythonInterpCtrl.o
g++ -shared -L../XmlRpcEmbedder .objs/PythonInterpCtrl.o .objs/PythonInterpreter.o .objs/ShellCtrlBase.o  -o PythonInterpreter.so -L/usr/lib/x86_64-linux-gnu -pthread   -lwx_gtk2u_xrc-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_qa-3.0 -lwx_gtk2u_adv-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu_xml-3.0 -lwx_baseu_net-3.0 -lwx_baseu-3.0  -Wl,-z,defs -L/usr/local/lib -lcodeblocks  -lXmlRpcEmbedder
.objs/ShellCtrlBase.o: In function `ShellManager::LaunchProcess(wxString const&, wxString const&, wxString const&, wxArrayString const&)':
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/ShellCtrlBase.cpp:161: undefined reference to `wxAuiNotebook::InsertPage(unsigned long, wxWindow*, wxString const&, bool, wxBitmap const&)'
.objs/ShellCtrlBase.o: In function `ShellManager::ShellManager(wxWindow*)':
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/ShellCtrlBase.cpp:261: undefined reference to `wxAuiNotebook::AddPage(wxWindow*, wxString const&, bool, wxBitmap const&)'
.objs/ShellCtrlBase.o: In function `__static_initialization_and_destruction_0(int, int)':
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/ShellCtrlBase.cpp:88: undefined reference to `wxEVT_AUINOTEBOOK_PAGE_CLOSE'
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/ShellCtrlBase.cpp:88: undefined reference to `wxEVT_AUINOTEBOOK_PAGE_CLOSE'
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/ShellCtrlBase.cpp:89: undefined reference to `wxEVT_AUINOTEBOOK_PAGE_CHANGING'
/home/rcrozier/src/codeblocks-python-crobarcro-git/PythonInterpreter/ShellCtrlBase.cpp:89: undefined reference to `wxEVT_AUINOTEBOOK_PAGE_CHANGING'
.objs/ShellCtrlBase.o: In function `wxAuiNotebook::wxAuiNotebook(wxWindow*, int, wxPoint const&, wxSize const&, long)':
/usr/include/wx-3.0/wx/aui/auibook.h:258: undefined reference to `vtable for wxAuiNotebook'
/usr/include/wx-3.0/wx/aui/auibook.h:258: undefined reference to `vtable for wxAuiNotebook'
/usr/include/wx-3.0/wx/aui/auibook.h:258: undefined reference to `wxAuiManager::wxAuiManager(wxWindow*, unsigned int)'
/usr/include/wx-3.0/wx/aui/auibook.h:258: undefined reference to `wxAuiTabContainer::wxAuiTabContainer()'
/usr/include/wx-3.0/wx/aui/auibook.h:259: undefined reference to `wxAuiNotebook::Init()'
/usr/include/wx-3.0/wx/aui/auibook.h:260: undefined reference to `wxAuiNotebook::Create(wxWindow*, int, wxPoint const&, wxSize const&, long)'
/usr/include/wx-3.0/wx/aui/auibook.h:258: undefined reference to `wxAuiTabContainer::~wxAuiTabContainer()'
/usr/include/wx-3.0/wx/aui/auibook.h:258: undefined reference to `wxAuiManager::~wxAuiManager()'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 2 second(s))
15 error(s), 0 warning(s) (0 minute(s), 2 second(s))
 

It seems like the correct library is not being linked, all errors are related to wxAUI. Can anyone tell me what I need to link to to get rid of these undefined reference errors?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5226
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Python plugin
« Reply #3 on: January 08, 2019, 04:16:32 pm »
Our developer dmoore is the maintainer of this plugin, so hope he can help. :)
« Last Edit: January 08, 2019, 05:01:40 pm by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline tigerbeard

  • Multiple posting newcomer
  • *
  • Posts: 89
Re: Python plugin
« Reply #4 on: March 13, 2019, 11:39:18 am »
It seems like the correct library is not being linked, all errors are related to wxAUI. Can anyone tell me what I need to link to to get rid of these undefined reference errors?
@crobar

Just saw the Github readme on that plugin and I also thingk that it looks great. I greatly appreciate your efforts and saw that you had cloned the project to get it working. I had been checking wiki, the original github and the posts in the forum but I have found not trace of information that proved someone was actually working with that pluing(sadly).
 
So when I read your post, the reason might be that its impossible to acually compile in the first place. So I really appreciate your efforts and stammina to resolve that and I hope you will succeed!
Just now I tired to download and compile it myself. I could open the workspace but then got stuck at multiple places. The descriptions and files raise so many additional questions for me (just a mid range programmer) that it seems like a week long detective journey to follow all leads down to the basics to get it to run. Additonally I am totally new to Python which seems a bad prerequisite  :(

So should you ever succeeded to get the plugin running I would be very interested to lean how to do it myself. Juding from your posts above you have come quite far already.
Sadly, I can not offer much to help. However I will volunteer to update the wiki with full step-by-step usable instructions on how to get that plagin running for others, if you would be ready to help me though after you know how to do it. I would use as target CB 16.01 under win7 as target (not self compiled) with a python installation by the standard python 2.14 msi installer. 


PS: Maybe in that process I understand why it is so difficult to distribute a CB plugin as independent binaries from the CB versions (for me that was the whole point about plugins). But maybe this one is very special.

Offline Krice

  • Almost regular
  • **
  • Posts: 130
Re: Python plugin
« Reply #5 on: April 04, 2019, 09:37:44 am »
I presume at some point these were defined somewhere in the code provided by codeblocks, but are no longer present. Can anyone tell me if there are appropriate replacements for these?

Definitions starting with wx is wxwidgets and SCI is I guess scintilla. The current github version of wxwidgets doesn't even have wxscintilla.h so make sure everything is correct with wxwidgets version. My guess is that wxscintilla.h has (should have) those definitions so check it.