User forums > Using Code::Blocks

cbp2make - makefile generation tool

<< < (16/25) > >>

mirai:
Update: (see rev.133)

[+] Fixed reading of virtual targets from project file. All virtual targets but the first one were missing due to a bug.
[+] Implemented build target selection for virtual targets. Previously, target selection with option "-targets" worked only for real build targets, but now it works for virtual targets as well.

Lefteris:
Hello!

This tool is exactly what I was searching for. I am in Windows and I am trying to create a makefile from my .cbp project. The problem is that when I try to do that cbp2make crushes immediately.

I am typing in:

--- Code: ---cbp2make -in foo.cbp
--- End code ---
The output I get is:

--- Code: ---Starting cbp2make rev.133...
Using default configuration.
Loading file 'foo.cbp': [DONE]
Generating makefile(s): foo.cbp.mak:

--- End code ---

After that the crush happens.

Any idea why this might be happening or methods to correct it?
My project is actually cross-platform thanks to CB so, I am gonna go to my Linux pc and try to run cbp2make in the same project from there and see the results.

I tested it in Linux too and the same thing happened. So it must be something inside the .cbp file
I have different build targets in the .cbp project. Should not affect the generation process though right?


Further Edit:
Since I had the source I thought I should try to debug it and maybe see if the seg fault is something easy to fix. After lots of trial and error and updates on this post I found what was happening.

The problem is in line 1098 of src\cbproject.cpp


--- Code: ---     CBuildUnit *unit = m_UnitIndex[i];
     CCompiler *compiler = tc->FindCompiler(unit->Extension());
     /*
     std::cout<<"target "<<target->Name().GetString()
              <<" unit "<<unit->m_FileName.GetString()
              <<" compilable "<<unit->IsCompilable()
              <<" compile "<<unit->m_DoCompile
              <<" link "<<unit->m_DoLink<<std::endl;
     */
     if( compiler !=0) /// Extra check added by Lefteris, so as not to delete the original check
     {
    //if (((0!=compiler)||(!unit->CompilerVariable().IsEmpty()))&&(unit->DoCompile()))//original check
      CString compiler_var = compiler->MakeVariable(); /// SEG FAULT HERE
      if (unit->CompilerVariable().IsEmpty())
      {
       compiler_var = compiler->MakeVariable();
      }

--- End code ---

The original if check allows  the program to get in the compilable unit scope even if the CCompiler* pointers is 0. So for all the header files of my project it was getting in there and was causing a seg fault.

I made a temporary fix of this if check by just checking only for compiler pointer being 0.

Further Edit 2

I discovered another bug. In windows during the linking stage the loading flags were output to the
beginning right after the $(LD). That resulted in undefined referenced during making.

--- Code: ---out_win32_debug_test: $(OBJ_WIN32_DEBUG_TEST) $(DEP_WIN32_DEBUG_TEST)
$(LD)  $(LDFLAGS_WIN32_DEBUG_TEST) $(LIBDIR_WIN32_DEBUG_TEST) $(OBJ_WIN32_DEBUG_TEST) $(LIB_WIN32_DEBUG_TEST) -o $(OUT_WIN32_DEBUG_TEST)
 
--- End code ---
I am not sure if this is an issue of cbp2make or if it is supposed to be okay to put the Loader Flags wherever you want, but moving them to the very end like that solved my problem.

--- Code: ---out_win32_debug_test: $(OBJ_WIN32_DEBUG_TEST) $(DEP_WIN32_DEBUG_TEST)
$(LD) $(LIBDIR_WIN32_DEBUG_TEST) $(OBJ_WIN32_DEBUG_TEST) $(LIB_WIN32_DEBUG_TEST) -o $(OUT_WIN32_DEBUG_TEST) $(LDFLAGS_WIN32_DEBUG_TEST)
 
--- End code ---

mirai:
Thanks for testing the tool. I will recheck this issue and apply a permanent fix. You can help me by sending a sample project file that caused crash in rev.133 to my email.

Considering options order, you can rewrite command line for Windows platform in cbp2make configuration. Just run "cbp2make --config options --local" in project directory and then change defaults in cbp2make.cfg to your corrected version by moving around macros in linkage command. I'm not sure if I have to change defaults, C::B uses just the same order of linker options.

Update: your issue is now registered here: https://sourceforge.net/apps/mantisbt/cbp2make/view_all_bug_page.php

Freem:
If you are the maintainer of the sourceforge's website of cbp2make, you have a problem with your website, you redirect on a php page... and here (opera browser) I can only save it.

mirai:

--- Quote from: Freem on May 07, 2012, 02:53:38 pm ---If you are the maintainer of the sourceforge's website of cbp2make, you have a problem with your website, you redirect on a php page... and here (opera browser) I can only save it.

--- End quote ---
That site is simply a wiki provided by sourceforge, I didn't do anything weird to it and didn't even touched it for a long time. Maybe something is got broken on sf.net side... Now have to contact sf.net administration  :(.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version