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:
The output I get is:
Starting cbp2make rev.133...
Using default configuration.
Loading file 'foo.cbp': [DONE]
Generating makefile(s): foo.cbp.mak:
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
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();
}
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.
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)
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.
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)