Code::Blocks

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: jens on July 12, 2008, 08:43:09 pm

Title: Codesnippets cannot be linked with C::B under linux
Post by: jens on July 12, 2008, 08:43:09 pm
"wxscintilla" is missing from "Build options -> Link libraries"
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: MortenMacFly on July 12, 2008, 08:59:30 pm
"wxscintilla" is missing from "Build options -> Link libraries"
Mmmmmh... cannot confirm - it's there, under project options. And it compiles just fine on my Linux (Ubuntu)...?! Mind checking the project options again?
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: MortenMacFly on July 12, 2008, 09:01:54 pm
...nevermind. Forgot to SVN update before... It must have happened during the last 5 commits obviously.

Fixed in SVN. Thanks.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 13, 2008, 01:59:17 pm
"wxscintilla" is missing from "Build options -> Link libraries"

I don't understand this. I'm building fine in Ubuntu with only tinyxml and codeblocks included in the Link Libraries box.

wxScintilla is included in the codeblocks sdk.

Why does your linking process need wxScintilla?


svn build rev 5120 (2008-07-11T23:54:33.667105Z) gcc 4.2.3 Linux/unicode
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: MortenMacFly on July 13, 2008, 03:50:36 pm
BTW: The "codesnippets.exe" stand-alone executable does not work if you have default.conf placed only in the C::B directory (to make C::B portable). In that case you receive a bunch of errors and the application does not start.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 13, 2008, 10:43:51 pm
...The "codesnippets.exe" stand-alone executable does not work...

Thanks, fixed in svn 5126
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: jens on July 13, 2008, 11:14:40 pm
There is another more dangerous bug (at least on my machine with debian sid/experimental 64bit wxWidgets 2.8.8 ):

if codesnippets is installed (no matter if it's enabled or disabled) the CheckForModifiedFiles-event does not work.

I have no time to look into the code, but it starts with svn r5118 and including of ThreadSearch and great parts of editor and editormanager into codesnippets.

And if I uninstall codesnippets, uninstalling is done (menu-update etc) but C::B crashes with a segfault.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 14, 2008, 12:26:50 am
There is another more dangerous bug (at least on my machine with debian sid/experimental 64bit wxWidgets 2.8.8 ):

if codesnippets is installed (no matter if it's enabled or disabled) the CheckForModifiedFiles-event does not work.

I have no time to look into the code, but it starts with svn r5118 and including of ThreadSearch and great parts of editor and editormanager into codesnippets.

And if I uninstall codesnippets, uninstalling is done (menu-update etc) but C::B crashes with a segfault.

I don't know what to do about CheckForModifiedFiles since it works for me on both Windows XP and Ubuntu 8.04

The only thing I can do is revert to the previous version which neither uses CB editor or ThreadSearch.

I can fix the "release" crash If I can get it to happen.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: jens on July 14, 2008, 09:05:56 am
I don't know what to do about CheckForModifiedFiles since it works for me on both Windows XP and Ubuntu 8.04

The only thing I can do is revert to the previous version which neither uses CB editor or ThreadSearch.
I don't know how it can work for you on linux, but on windows you are right. I just found the problem and it's might be not so difficult to solve.
Have you checked it only for codesnippets, or also for normal editor ?

When I compiled codesnippets-plugin on my w2k kvm-box it warns me about redeclaration of "ID_NBEditorManager", "ID_EditorManager" , "idEditorManagerCheckFiles" and "ID_EditorManagerCloseButton" without "dllimport" and that the compiler ignores the previous declaration.

That means the four id's from C::B's "editormanager.h" and the redeclared id's from "seditormanager.h" are in the same scope.
On linux the "DLLIMPORT"-macro is empty and so the redeclaration uses the same physical memory (that's what extern is for if used without initialization).

In "seditormanager.cpp" you have the following lines:
Code: [Select]
int ID_NBEditorManager = wxNewId();
int ID_EditorManager = wxNewId();
int idEditorManagerCheckFiles = wxNewId();

This code changes the values of the id's and therefore breaks the event-binding that were made by the main-app before.

If you rename the id's to e.g. "ID_NBSEditorManager", etc. (folllowing your naming-scheme for the source- and headerfiles) the "CheckForModifiedFiles"-event in C::B works as before.

I don't know if codesnippets-plugin will still work as expected or if you only need the editormanager-functions for the standalone-version.
But you know your code and how it works.
I hope there would be a possibility to overwork it, without removing the new functionallity.

I can fix the "release" crash If I can get it to happen.
I don't know how it can work for you

It might be because of a type mismatch, because I use 64bit linux and if there are e.g. "long"s and "int"s mixed, it might crash as it happens with wxSmith (changed in svn some revisions ago).
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 14, 2008, 02:08:18 pm
When I compiled codesnippets-plugin on my w2k kvm-box it warns me about redeclaration of "ID_NBEditorManager", "ID_EditorManager" , "idEditorManagerCheckFiles" and "ID_EditorManagerCloseButton" without "dllimport" and that the compiler ignores the previous declaration.

Thanks Jens. I'll make the changes.

How do you manage to get these warning messages? I certainly would have paid attenttion to such warnings.  I'd like to turn on any flags that would show them to me also. I'm using gcc 3.4.5

If you're using a .cbp other than then one provided with svn, could you insert it in a message here.

Thanks

svn build  rev 5124 (2008-07-13T10:48:20.603685Z)   gcc 3.4.5 Windows/unicode
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: jens on July 14, 2008, 03:34:17 pm
I used a clean svn-checkout.

But I use MinGW 4.2.1.

I did not find a commandline-switch to turn this warning "on" or "off".
So I don't know if some defaults have changed from MinGW 3.4.5 to 4.2.1 .
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: killerbot on July 14, 2008, 03:36:33 pm
4.X series has much better warning reports than the 3.4.x.
Just be willing to fix them ;-)
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 14, 2008, 06:39:44 pm
4.X series has much better warning reports than the 3.4.x.
Just be willing to fix them ;-)

Code: [Select]
mingw32-g++.exe -Lbase\tinyxml -LC:\Usr\Proj\wxWidgets287\lib\gcc_dll -Lbase\tinyxml -Lc:\usr\mingw431\bin\lib -LC:\Usr\mingw431\bin\lib\gcc\mingw32\4.3.1  -o build_tools\autorevision\autorevision.exe .objs\build_tools\autorevision\autorevision.o   -s  -ltxml c:\usr\mingw431\bin\lib c:\usr\mingw431\bin\lib\gcc\mingw32\4.3.1
ld: crt2.o: No such file: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

I've tried for 3 hrs to get past this problem: crt2.o can't be found.
The soluctions I've found on Google don't work, and the one on this board is unclear, and the dev says not to use it.

So I guess I'm backed into a corner. Without gcc 3.4.5 I have no usable CodeBlocks.

This version of gcc 4.3.1 came from the TDM site. Is there another I should try?

Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: jens on July 14, 2008, 06:57:47 pm
I use MinGW "4.2.1-dw2" on w2k and on XP I use "4.2.1-sjlj -2", what is still a Technological preview, but seems to be quiet stable.

Both give me the described warnings and compile C::B without problems.

The mingw.org servers seem to be down since some hours, but the download page on sf.net still works: http://sourceforge.net/project/showfiles.php?group_id=2435 (http://sourceforge.net/project/showfiles.php?group_id=2435)
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 14, 2008, 10:41:55 pm
Thanks Jens. I'll make the changes.

Fixed in SVN 5127

CodeSnippets 1 3.69 2008/07/14
- Jens' fix for broken CheckForModifiedFiles


I'm still unsuccessful running mingw 4.x on XP, so I'll have to depend on other users to report the warnings.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: jens on July 15, 2008, 01:02:19 am
"CheckForModifiedFiles" works now (again) .
Tested on Linux 64bit and on w2k (32bit).

The crash on uninstall occurs on Linux and on Windows.
On Linux it's a segfault in the destructor of the "wxBusyCursor" used in "void PluginsConfigurationDlg::OnUninstall(wxCommandEvent& event)".

It might be that uninstalling codesnippets-plugin does something harmfull to the stack.

I don't know if the crash happens in the same piece of code in Windows.
Perhaps I try it ou tomorrow.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 15, 2008, 01:34:20 am
I don't know if the crash happens in the same piece of code in Windows.
Perhaps I try it ou tomorrow.

Yes, the crash does happen on XP with gcc345 also. This seems to happen to me when I use a wxEVT_IDLE routine. Usually, I have to disable the plugin first, then restart CB, then the uninstall runs ok.

I've never found the root of the problem.
Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
0x101b17fb in wxAppBase::SendIdleEvents ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
(gdb) bt
#0  0x101b17fb in wxAppBase::SendIdleEvents ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#1  0x101b1828 in wxAppBase::SendIdleEvents ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#2  0x101b16fe in wxAppBase::ProcessIdle ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#3  0x101e253f in wxEventLoopManual::Run ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#4  0x1015b79b in wxDialog::ShowModal ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#5  0x618aaa51 in PluginManager::Configure (this=0x1bacb08)
    at c:/Usr/Proj/cbBeta/trunk/src/sdk/pluginmanager.cpp:1431
#6  0x00446fc5 in MainFrame::OnSettingsPlugins (this=0x14b9bb0,
    [email protected]) at c:/Usr/Proj/cbBeta/trunk/src/src/main.cpp:4067
#7  0x100c70d5 in wxEvtHandler::ProcessEventIfMatches ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#8  0x100c742c in wxEventHashTable::HandleEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#9  0x100c83f9 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#10 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#11 0x100c8399 in wxEvtHandler::ProcessEvent ()
---Type <return> to continue, or q <return> to quit---
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#12 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#13 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#14 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#15 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#16 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#17 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#18 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#19 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#20 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#21 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
#22 0x100c8399 in wxEvtHandler::ProcessEvent ()
   from c:\usr\bin\wxmsw28u_gcc_custom.dll
---Type <return> to continue, or q <return> to quit---
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: MortenMacFly on July 15, 2008, 11:09:39 am
...The "codesnippets.exe" stand-alone executable does not work...
Thanks, fixed in svn 5126
I saw the changes and it's working now. ;-)

But... You quote all over the files that C::B is lying when it comes to GetConfigFolder(), but C::B is *not*. This method returns the current path of config files, which really is the one returned. What you are looking for is a special file, named [personality].conf under a special case, in the case of relocation (portable C::B). If you want to retrieve this file then the C::B documentation states what you have to do. You need to do something like:

Code: [Select]
    PersonalityManager* PersMan = Manager::Get()->GetPersonalityManager();
    wxString personality = PersMan->GetPersonality();
    ConfigManager* CfgMan = Manager::Get()->GetConfigManager(_T("app"));
    wxString current_conf_file = CfgMan->LocateDataFile(personality+_T(".conf"), sdAllKnown);

This way, current_conf_file is retrieved "the right way". Hence the config folder may be different. This is just a special case if ConfigManager::relo is true.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 15, 2008, 03:15:19 pm
...The "codesnippets.exe" stand-alone executable does not work...
Thanks, fixed in svn 5126
I saw the changes and it's working now. ;-)

But... You quote all over the files that C::B is lying when it comes to GetConfigFolder(), but C::B is *not*. This method returns the current path of config files, which really is the one returned. What you are looking for is a special file, named [personality].conf under a special case, in the case of relocation (portable C::B). If you want to retrieve this file then the C::B documentation states what you have to do. You need to do something like:

Code: [Select]
    PersonalityManager* PersMan = Manager::Get()->GetPersonalityManager();
    wxString personality = PersMan->GetPersonality();
    ConfigManager* CfgMan = Manager::Get()->GetConfigManager(_T("app"));
    wxString current_conf_file = CfgMan->LocateDataFile(personality+_T(".conf"), sdAllKnown);

This way, current_conf_file is retrieved "the right way". Hence the config folder may be different. This is just a special case if ConfigManager::relo is true.


Ok, I give...

I've spent an hour searching Google, the forum, the web site, and the wiki for "::relo",  "documentation", "sdk documentation", "CodeBlocks documentation",etc.

The info mentioned must be under a different search term.

Could you point me to "the C::B documentation" that  "states what you have to do."
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: MortenMacFly on July 15, 2008, 04:15:16 pm
Could you point me to "the C::B documentation" that  "states what you have to do."
Sure thing: ;-)

Take a look at SDK documentation of the ConfigManager class, especially the description of ConfigManager::LocateDataFile(). The SDK docu which you can d/l from BerliOS should have this included, too (obviously).

Edit: Forgotten to add the link:
http://prdownload.berlios.de/codeblocks/codeblocks_sdk_doc_r5046.chm
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: PsYhLo on July 16, 2008, 02:19:14 pm
Code: [Select]
g++ -DHAVE_CONFIG_H -I. -I../../../../../src/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 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1   -I../../../../../src/include -I../../../../../src/include/wxscintilla/include -I../../../../../src/plugins/contrib/codesnippets -I../../../../../src/plugins/contrib/codesnippets/Search -I../../../../../src/plugins/contrib/codesnippets/editor -I../../../../../src/include/wxFlatNotebook/include  -Ulinux -Uunix  -O2 -ffast-math -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT editproperties.o -MD -MP -MF .deps/editproperties.Tpo -c -o editproperties.o `test -f '../editor/editproperties.cpp' || echo './'`../editor/editproperties.cpp
mv -f .deps/editproperties.Tpo .deps/editproperties.Po
make[1]: *** No rule to make target `../prefs.cpp', needed by `prefs.o'.  Stop.
make[1]: Leaving directory `/home/psyhlo/devel/cb-src/src/plugins/contrib/codesnippets/resources'
make: *** [all-recursive] Error 1

latest svn 5129

linux Ubuntu 8.04 gcc ver 4.2.3
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 16, 2008, 03:13:15 pm
Code: [Select]
g++ -DHAVE_CONFIG_H -I. -I../../../../../src/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 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/pixman-1   -I../../../../../src/include -I../../../../../src/include/wxscintilla/include -I../../../../../src/plugins/contrib/codesnippets -I../../../../../src/plugins/contrib/codesnippets/Search -I../../../../../src/plugins/contrib/codesnippets/editor -I../../../../../src/include/wxFlatNotebook/include  -Ulinux -Uunix  -O2 -ffast-math -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT editproperties.o -MD -MP -MF .deps/editproperties.Tpo -c -o editproperties.o `test -f '../editor/editproperties.cpp' || echo './'`../editor/editproperties.cpp
mv -f .deps/editproperties.Tpo .deps/editproperties.Po
make[1]: *** No rule to make target `../prefs.cpp', needed by `prefs.o'.  Stop.
make[1]: Leaving directory `/home/psyhlo/devel/cb-src/src/plugins/contrib/codesnippets/resources'
make: *** [all-recursive] Error 1

latest svn 5129

linux Ubuntu 8.04 gcc ver 4.2.3

pref.h is now in the ..\editor directory. Make sure you do a clean.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: killerbot on July 16, 2008, 05:10:22 pm
haha, i have the same issue, make clean, even a new ./configure does NOT help

Seems like the only option might be do a fresh svn checkout and delete the existing stuff. Enjoy :-(
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: Pecan on July 16, 2008, 05:30:58 pm
haha, i have the same issue, make clean, even a new ./configure does NOT help

Seems like the only option might be do a fresh svn checkout and delete the existing stuff. Enjoy :-(

Would you clarify that for me?

When I did an svn update on Ubuntu 8.02 it automatically deleted the old editor files for me. Why didn't it do that for you?

I then did a make clean to get rid of old .o files, then ./bootstrap, ./configure ..., make. It worked.

What's different here?
What can I do to make the process smoother?
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: jens on July 16, 2008, 05:45:18 pm
... , even a new ./configure does NOT help

Did you also run "./bootstrap" ?

I'm not sure, but I guess the directory/file-structure might go into "Makefile.in" and therefore into "Makefile" when doing "./configure".
And if that's right you need to run "./bootstrap" to generate a new "Makefile.in" first.

I cannot test in the moment, because I only have my USB-Stick with very rudimentary build-tools at wok today.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: killerbot on July 16, 2008, 06:47:19 pm
I have just tried, the chain starting from ./boostrap  --> no luck
how joly nice, time for a fresh svn checkout
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: PsYhLo on July 16, 2008, 07:33:36 pm
after the fresh svn it compiles without any problem
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: killerbot on July 16, 2008, 07:48:01 pm
same for me: fresh svn checkout --> OK
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: keenblade on July 17, 2008, 08:02:25 pm
I have just tried, the chain starting from ./boostrap  --> no luck
how joly nice, time for a fresh svn checkout
svn rev:5133 and C::B still doesn't compile. Isn't it possible without a fresh svn checkout?
This seems a little odd to me why the fresh svn checkout needed for some of us.
Is it a svn bug? I think a git repo would be cool.
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: killerbot on July 17, 2008, 08:49:36 pm
note that another build issue got introduced which is solved in rev v5135
Title: Re: Codesnippets cannot be linked with C::B under linux
Post by: keenblade on July 17, 2008, 09:09:59 pm
Thanks. rev v5135 compiled successfully.