Page 1 of 2

codelite built for new plugin meets fatal error

Posted: Mon Nov 19, 2012 9:31 pm
by leon_lee
Hi,

I want to make a custom plugin inside codelite, i presume that i need to build codelite. The build is fine, but when I try to run codelite, there's a fatal error.
Here's the report by codelite:
-------------------

Error occured on Tuesday, November 20, 2012 at 00:15:07.

d:\linux\linuxkernel\WORKING_DIRECTORY\ango\codlite\codelite\Runtime\codelite.exe caused an Access Violation at location 6ce31beb in module d:\linux\linuxkernel\WORKING_DIRECTORY\ango\codlite\codelite\Runtime\wxmsw294u_core_gcc_cl.dll Reading from location 00000000.

Registers:
eax=00000000 ebx=0022de94 ecx=77d2cc42 edx=0022dd01 esi=10888a70 edi=108ee848
eip=6ce31beb esp=0022dd90 ebp=0022de90 iopl=0 nv up ei pl zr na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010246

Call stack:
6CE31BEB d:\linux\linuxkernel\WORKING_DIRECTORY\ango\codlite\codelite\Runtime\wxmsw294u_core_gcc_cl.dll:6CE31BEB _ZNK8wxWindow13DoGetPositionEPiS0_
1090C218
0022DF50
C3C9FC55


-------------------
I try to trace it. This error happens in codelite\LiteEditor\frame.cpp with this line:
m_theFrame = new clMainFrame( NULL,
wxID_ANY,
title,
inf.GetFramePosition(),
inf.GetFrameSize(),
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE);

But according to the watch, inf's position is (x=30,y=3), which seems to be fine. I don't why the error would happen. Please help me out.

Re: codelite built for new plugin meets fatal error

Posted: Tue Nov 20, 2012 11:07 am
by eranif
It's a Windows problem which means:

You have a mixed plugins build in different configurations
i.e. some of the plugins are built in debug while other are built in release mode

Do not mix them! Windows does not like it ;)

Make sure all of your plugins are built in debug or in release (including codelite itself and its DLLs)
Eran

Re: codelite built for new plugin meets fatal error

Posted: Wed Nov 21, 2012 3:45 am
by leon_lee
eranif wrote:It's a Windows problem which means:

You have a mixed plugins build in different configurations
i.e. some of the plugins are built in debug while other are built in release mode

Do not mix them! Windows does not like it ;)

Make sure all of your plugins are built in debug or in release (including codelite itself and its DLLs)
Eran
I see. Thanks for your reply. I feel that codelite should be easier to develop a new plugin.

Re: codelite built for new plugin meets fatal error

Posted: Wed Nov 21, 2012 6:49 pm
by eranif
leon_lee wrote:I see. Thanks for your reply. I feel that codelite should be easier to develop a new plugin.
Its not a codelite restriction but a Windows one. Nothing that codelite can do about it

Eran

Re: codelite built for new plugin meets fatal error

Posted: Thu Nov 22, 2012 5:57 pm
by leon_lee
eranif wrote:
leon_lee wrote:I see. Thanks for your reply. I feel that codelite should be easier to develop a new plugin.
Its not a codelite restriction but a Windows one. Nothing that codelite can do about it

Eran
Is there any detail info for this restriction? I just want to know the why and see if I can figure out a solution or not.
Take notepad++ as an example, it also offers plugin development, but there's no requirement on building the whole project for a new plugin. For details please refer http://notepad-plus-plus.org/contribute ... howto.html.
Also if even windows does have some restriction on the new plugin development, at lease we can easier the developer by offering a codelite package for developing the new plugin.

Re: codelite built for new plugin meets fatal error

Posted: Fri Nov 23, 2012 12:01 pm
by Rosch
leon_lee wrote:
eranif wrote:
leon_lee wrote:I see. Thanks for your reply. I feel that codelite should be easier to develop a new plugin.
Its not a codelite restriction but a Windows one. Nothing that codelite can do about it

Eran
Is there any detail info for this restriction? I just want to know the why and see if I can figure out a solution or not.
Take notepad++ as an example, it also offers plugin development, but there's no requirement on building the whole project for a new plugin. For details please refer http://notepad-plus-plus.org/contribute ... howto.html.
Also if even windows does have some restriction on the new plugin development, at lease we can easier the developer by offering a codelite package for developing the new plugin.
Well... Dealing with different compiler versions is always tricky. To avoid strange problems it is always needed to meet as closely as possible the compiler environment of a parent project. Just some points you wanted to hear:
  • C++ name mangling. It is not regulated how c++ class names are stored inside of executables (eg. DLLs)
    so each compiler plays its own game here. Therefore it is (at present) impossible for C++ code compiled with
    Visual studio to work with gcc compiled code in the sense of direct calling from a VS C++ class into a gcc C++ class.
  • C++ exception handling. When you use GCC you have 2 choices. DW2 or SJLJ. If you want to handle exceptions
    without hassle you should not mix them. Traditionally mingw uses DW2 while mingw-w64 (which I prefer) uses SJLJ.
    DW2 and SJLJ have both it's pros and cons,but if you want to safely catch exceptions over DLL borders you are strongly
    adviced to use SJLJ.
  • STL differences. libstdc++ of one compilerversion might behave differently than others due to version/ABI differences.
    I wouldn't eg. mix code compiled with gcc 4.2 with 4.6. Makes no fun....
  • a bunch more
This is no limitation of codelight. You will face these problems with every C++ development on windows. But that is not only limited to windows alone. On linux/mac there are also pitfalls if you mix compiler environments, even they are not so frequent there.

I always try to be in the same compiler environment for a project it saves me some heartakes....

Roland

Re: codelite built for new plugin meets fatal error

Posted: Sat Nov 24, 2012 9:00 am
by leon_lee
eranif wrote:It's a Windows problem which means:

You have a mixed plugins build in different configurations
i.e. some of the plugins are built in debug while other are built in release mode

Do not mix them! Windows does not like it ;)

Make sure all of your plugins are built in debug or in release (including codelite itself and its DLLs)
Eran
I figure out this is because the following projects shows error like "undefined reference to `_imp___ZN16wxStyledTextCtrlC1EP8wxWindowiRK7wxPointR", and no wxmsw294ud_stc_gcc_cl.dll in the lib of the project file causes this. Then I use wxmsw294u_stc_gcc_cl.dll instead. So when I change the linker config, it's all right now.

CodeFormatter.project
CppChecker.project
Subversion2.project
Outline.project
git.project
DatabaseExplorer.project
LiteEditor.project

Re: codelite built for new plugin meets fatal error

Posted: Sat Nov 24, 2012 9:36 am
by eranif
I figure out this is because the following projects shows error like "undefined reference to `_imp___ZN16wxStyledTextCtrlC1EP8wxWindowiRK7wxPointR"
Libraries should not be added directly to the projects, instead, you should be using the wx-config like this:

Code: Select all

wx-config --libs std,stc
Important: Make sure you are using the latest wx-config from here:
see here: http://forums.codelite.org/viewtopic.ph ... sd=a#p8082

Eran

Re: codelite built for new plugin meets fatal error

Posted: Sat Nov 24, 2012 5:36 pm
by leon_lee
eranif wrote:
I figure out this is because the following projects shows error like "undefined reference to `_imp___ZN16wxStyledTextCtrlC1EP8wxWindowiRK7wxPointR"
Libraries should not be added directly to the projects, instead, you should be using the wx-config like this:

Code: Select all

wx-config --libs std,stc
Important: Make sure you are using the latest wx-config from here:
see here: http://forums.codelite.org/viewtopic.ph ... sd=a#p8082

Eran
Yes, it seems to be the wx-config issue. My plugin now shows in the plugin manager. Thanks for your guide.
If I want make a plugin to act like the notepad++ "find all in current document"(find out all the lines with the find target, and list them in the output view search, and reach the line in editor by simply double click in that line in the output view.), which plugin should I follow?

Re: codelite built for new plugin meets fatal error

Posted: Sat Nov 24, 2012 6:15 pm
by eranif
leon_lee wrote:If I want make a plugin to act like the notepad++ "find all in current document"(find out all the lines with the find target, and list them in the output view search, and reach the line in editor by simply double click in that line in the output view.), which plugin should I follow?
Have you tried this:

- Select a word in the document
- Ctrl-Shift-G

Eran