Author Topic: Problem while building C::B from codeblocks-unix.workspace  (Read 5275 times)

Offline earlgrey

  • Multiple posting newcomer
  • *
  • Posts: 101
Problem while building C::B from codeblocks-unix.workspace
« on: September 14, 2014, 04:17:33 pm »
For debugging http://forums.codeblocks.org/index.php/topic,19618.0.html, I decided to do like this : http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Windows#Compile_Code::Blocks, i.e. building C::B from C::B.

1) what should go in the "cb" global variable ?
2) what should go in the "wx" global variable ?

3) Whatever I do, I end up with no plugins loaded, and a very basic C::B http://imgur.com/BAESn3k

4) Seems like in ConfigManager::InitPaths() the wxStandardPaths stuff always return "/" :

Code
$ ./codeblocks --debug-log --multiple-instance -ns -ni -v -p debug --prefix="/home/gwr/Src/C-C++/codeblocks/svn9916/trunk/src/devel"
> ConfigManager::InitPaths()
  config_folder     :/
  home_folder       :/
  app_path          :/
  res_path          :.
> MainFrame::ScanForPlugins()
Plugin resource not found: .zip
Invalid manifest file for: ofl
Loaded 1 plugins
Scanning for plugins - global in /plugins
...

5) Ended up with a savage replacement
Code
void MainFrame::ScanForPlugins()
{
    m_ScanningForPlugins = true;
    m_PluginIDsMap.clear();

    PluginManager* m_PluginManager = Manager::Get()->GetPluginManager();

    printf("> MainFrame::ScanForPlugins()\n");

    // user paths first

    //wxString path = ConfigManager::GetPluginsFolder(false);
    //printf("  Scanning for plugins - user [%s]\n", path.wx_str());
    //int count = m_PluginManager->ScanForPlugins(path);
    wxString path;
    path.assign((const wxChar*)"/home/gwr/Src/C-C++/codeblocks/svn9857/trunk/src/devel/share/codeblocks/plugins");
    printf("  Scanning for plugins - user [%s]\n", path.wx_str());
    int count = m_PluginManager->ScanForPlugins(path);
* OS = Debian Buster - Linux 4.19.06 x64 SMP
* C::B = svn11267 wx-3.0.4 - Linux, unicode 64 bit

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Problem while building C::B from codeblocks-unix.workspace
« Reply #1 on: September 14, 2014, 04:32:05 pm »
cb and wx are not needed, but cb_release_type should have at least a space or any additonal compiler switches for (almost) all projects.

Do not forget to run the appropriate update-script after build.

And bve aware you have to start C::B with the run.sh-script from either devel or output-folder or from inside C::B (if you want to debug it).

Offline earlgrey

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Problem while building C::B from codeblocks-unix.workspace
« Reply #2 on: September 14, 2014, 05:55:20 pm »
Quote
cb_release_type should have at least a space or any additonal compiler switches for (almost) all projects.
Was set
Quote
Do not forget to run the appropriate update-script after build.
After each compilation ( trunk/src/update )
Quote
And be aware you have to start C::B with the run.sh-script from either devel or output-folder or from inside C::B (if you want to debug it).
run.sh simply modify & export LD_LIBRARY_PATH for ensuring loading trunk/src/devel/libcodeblocks.so & trunk/src/devel/libwxpropgrid.so

Something has to be different between the "autotools - make" build and the "within C::B" build.
* OS = Debian Buster - Linux 4.19.06 x64 SMP
* C::B = svn11267 wx-3.0.4 - Linux, unicode 64 bit

Offline earlgrey

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Problem while building C::B from codeblocks-unix.workspace
« Reply #3 on: September 14, 2014, 06:14:20 pm »
Finally fixed plugins loading by just copying all .so libraries along libcodeblocks.so & libwxpropgrid.so, in trunk/src/devel
Surely misuse of wxStandardPaths stuff. Even with the "autotools - make" build, all paths in ConfigManager::InitPaths() resume to "/".
I could not find any call to wxStandardPaths::SetInstallPrefix() in C::B sources, which may be the explanation.
« Last Edit: September 14, 2014, 06:17:08 pm by earlgrey »
* OS = Debian Buster - Linux 4.19.06 x64 SMP
* C::B = svn11267 wx-3.0.4 - Linux, unicode 64 bit

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Problem while building C::B from codeblocks-unix.workspace
« Reply #4 on: September 14, 2014, 06:17:22 pm »
That is not a fix, it's a hack.
Building C::B inside C::B normally works fine, I do it a lot.

And thank you for telling me what run.sh does, I did not know  ::) .

You must have done something wrong or you have some incompatibility on your system.
Which distro do you use ?

Offline earlgrey

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Problem while building C::B from codeblocks-unix.workspace
« Reply #5 on: September 14, 2014, 06:28:49 pm »
Debian wheezy.
Im gonna dig this.
* OS = Debian Buster - Linux 4.19.06 x64 SMP
* C::B = svn11267 wx-3.0.4 - Linux, unicode 64 bit

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Problem while building C::B from codeblocks-unix.workspace
« Reply #6 on: September 15, 2014, 12:20:06 am »
I just tested on an uptodate wheezy .
There are no such issues.

Did you change any project or global settings before compiling ?

Offline earlgrey

  • Multiple posting newcomer
  • *
  • Posts: 101
Re: Problem while building C::B from codeblocks-unix.workspace
« Reply #7 on: September 15, 2014, 06:33:34 pm »
Got it.

I had an old file called "ofl.so" ( surely an old test for http://forums.codeblocks.org/index.php/topic,19618.0.html ) in "/home/gwr/.codeblocks/share/codeblocks/plugins" that C::B tried to load :
Code
bool PluginManager::LoadPlugin(const wxString& pluginName)
{
    ...
    m_pCurrentlyLoadingLib = LibLoader::LoadLibrary(pluginName);
    ...
}

What is interesting is that after the LoadLibrary call on the dummy file ofl.so, there is apparently a memory write that resets ConfigManager::config_folder & co :

before : http://imgur.com/AaycWMO
after : http://imgur.com/OEEUIAT

( Notice the ConfigManager::config_folder wxString reseted to "" )

Digging further, the switch is done in pluginmanager.cpp :

Code
namespace LibLoader
{
    ...
    inline wxDynamicLibrary* LoadLibrary(const wxString& filename)
    {
        ...
        it->second.lib->Load(filename); <= memory overwrite here
        ...
    }
    ...
};

Which leads finally to obscure casts in
/usr/include/c++/4.7/bits/move.h
and
/usr/include/c++/4.7/bits/stl_tree.h

Removed dummy ofl.so file and all is OK now.

Thanks for having answered.
* OS = Debian Buster - Linux 4.19.06 x64 SMP
* C::B = svn11267 wx-3.0.4 - Linux, unicode 64 bit