Author Topic: Debug with custom makefile  (Read 8503 times)

Offline oZZ

  • Multiple posting newcomer
  • *
  • Posts: 30
Debug with custom makefile
« on: October 05, 2006, 07:23:00 pm »
I'm bringing a project over that I previously developed on Eclipse so I'm using an existing makefile.

Everything compiles perfectly, but when I try to debug inside C::B sometimes it works, sometimes it just hangs at "Compiling:" in the Debugger window.  My process view shows make running, but it just hangs.

Why does the debugger have to recompile after I've already regularly compiled it? (with -g) is it because I use a custom makefile? and if that's the case is there a setting somewhere that lets the debugger just use the existing binary file?

Thanks.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Debug with custom makefile
« Reply #1 on: October 05, 2006, 10:39:56 pm »
I'm bringing a project over that I previously developed on Eclipse so I'm using an existing makefile.
You completely forgot to add what version/OS you are using C::B with. So I can only guess:
If you are using a recent nightly be aware, that there are recent changes that may have broken the Makefile functionality. This hasn't yet been fuully tested so far. However: I can only strongly suggest to switch to the C::B build system instead of using Makefiles. You will then benefit from all the advantages C::B ships with in contrast to "makefile only".
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oZZ

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Debug with custom makefile
« Reply #2 on: October 05, 2006, 11:05:36 pm »
Thanks for the quick response.  I switched to C::B's make system in the meantime, and it's working fine.  I'm using nightly build on Windows.

I pretty much need to be using my makefile as I have a script that generates it for all compiling platforms, so I think I'm going to have to go back to Eclipse CDT (which has no/poor code completion, and that's what made me try C::B.  Actually I have a fairly lengthy list of issues that I came across in C::B that I'm going to post in another thread.

If there's solutions to many of these right now then I can probably live with C::B's build system and not the Makefile.

-Shawn.

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Debug with custom makefile
« Reply #3 on: October 09, 2006, 02:48:29 am »
You will then benefit from all the advantages C::B ships with in contrast to "makefile only".

Yes but CB's project files aren't really any better than makefiles.  If you wish your project to be cross platform you have to either develop multiple project files or maintain another build system in parallel, both of which the Code::Blocks project does itself.  From the sound of if it looks as if the OP is using something like CMake.  It might be advantageous for the OP to tweak his script to generate CB project files, to format is a pretty simple xml.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Debug with custom makefile
« Reply #4 on: October 09, 2006, 08:18:01 am »
Yes but CB's project files aren't really any better than makefiles.
No, I wouldn't say this for several reasons:
1.) The C::B build sytem is much faster than with Makefiles
2.) You not neccesarily need several project files to be cross-platform compatible. In fact I have quite some projects that compile just fine under Windows and Linux with a single project file. This is only different if libraries require different settings on different platforms. But with global variables and/or user variables you can even work-around this.
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Debug with custom makefile
« Reply #5 on: October 09, 2006, 09:16:51 am »
Let me add my two cents since I 'm quite familiar with C::B and Makefiles.
You might be using a Makefile driven build but when it comes to the debugger C::B acts like you have used the C::B build system (it will try to locate object files sources etc to the foldes declared in the C::B project file).
Generally Makefiles initiate the build from the target's folder while C::B from the project's folder. You can't say which is the right approach it's just different. This though leads to some problems, if you have targets in sub directories of the project's top level directory then if you build them with a Makefile C::B won't be able to find the correct path to the sources etc. (for the Makefile it will be foo.cpp, for c::b <target dir>/foo.cpp). Keep the above in mind when you create Makefiles and you will be able to tweek your Makefiles in order to work with C::B
Life would be so much easier if we could just look at the source code.

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Debug with custom makefile
« Reply #6 on: October 10, 2006, 07:26:20 am »
No, I wouldn't say this for several reasons:
1.) The C::B build sytem is much faster than with Makefiles
2.) You not neccesarily need several project files to be cross-platform compatible. In fact I have quite some projects that compile just fine under Windows and Linux with a single project file. This is only different if libraries require different settings on different platforms. But with global variables and/or user variables you can even work-around this.
With regards, Morten.

The speed is an excellent point.  But you can also do the same level of variable switching with makefiles.  The real issue is that external build systems, scons, CMake, can handle the configuration automatically, without the need for user intervention.  I don't think CB needs autoconf like functionality it would probably be best to add CB project file generation to CMake and/or scons.  So you get all the benefits of CB project files while having firmer cross platform support.  Not to mention not inventing another auto configuration tool.

yop-  So if you tweak you the makefiles object file output directories to match codeblocks, then everything should work fine?
« Last Edit: October 11, 2006, 02:37:58 am by Game_Ender »

Offline yop

  • Regular
  • ***
  • Posts: 387
Re: Debug with custom makefile
« Reply #7 on: October 10, 2006, 08:41:55 am »
yop-  So if you tweak you the makefiles object file output directories to match codeblocks, then everything should work fine?
Or the other way around, tweek your codeblocks project. But still if you have to dive into subdirs to find sources then there are no guaranties. I haven't lately tried it though (knowing the limitations I try to keep both parties happy make and c::b).
Life would be so much easier if we could just look at the source code.

paparazzi

  • Guest
Re: Debug with custom makefile
« Reply #8 on: November 02, 2006, 06:52:00 pm »
Hi!

I'm evaluating the possibility to switch from Eclipse to C::B also. And yes I'm also using custom makefiles for cross-platform build. The difference is I'm not using any tools like autoconf whatsoever, instead I have a pretty complex "master" makefile, which is referenced from all the (very simple) end-projects makefiles, and the master does all the magic. So generating a C::B project file here is not the option.

Yet there is another problems. One of the platforms I have to support is AIX, and I have only a relatively slow remote access to all of the available AIX machines. As far as I understand, I need to have a graphical desktop available in order to use the C::B build system, but the only option available is ssh console. I have once tried to use the X desktop on AIX, but due to the connection limitations it was not usable. And of course I am not sure I will be able to build the C::B itself on AIX. In contrast I can not name the OS for which a prebuilt gmake binary would not be available.

To sum up. I understand that my case is far from being a common case, yet I'm sure I'm not the only guy
on the earth with such requirements. To make C::B a viable option for those like me either external makefiles should be fully supported, or a command line tool capable of building the projects based on the  C::B project files should be implemented. And it should be written in a way it will be possible to compile it on nearly any imaginable OS.

Thanks.
Andrey.

takeshimiya

  • Guest
Re: Debug with custom makefile
« Reply #9 on: November 02, 2006, 06:57:59 pm »
...or a command line tool capable of building the projects based on the  C::B project files should be implemented. And it should be written in a way it will be possible to compile it on nearly any imaginable OS.
The only compromise you have if you want something working right now, is to use premake, which generates makefiles (no autoconf stuff), codeblocks projects, msvc projects, etc.
The syntax is very nice and it's far easier than to write a makefile by hand. :)

Offline Game_Ender

  • Lives here!
  • ****
  • Posts: 551
Re: Debug with custom makefile
« Reply #10 on: November 02, 2006, 09:17:13 pm »
It looks like a mix of scons (A good interface language ) and CMake (generates build files, doens't run the build).

takeshimiya

  • Guest
Re: Debug with custom makefile
« Reply #11 on: November 02, 2006, 09:42:25 pm »
It looks like a mix of scons (A good interface language ) and CMake (generates build files, doens't run the build).
Yes, or a mix of lua (easy embeddable language) and bakefile (generates makefiles and projects).

But premake it's actually the first one I really like, and the only one to support CodeBlocks output as of now.

Look how easy is to create a project which compiles the minimal wx sample (works at least from gnu makefiles and codeblocks),

Full source:
Code: lua
-- Creates a project for the minimal wx sample
project.name = "minimal"

package = newpackage()
package.language = "c++"
package.files = { "minimal.cpp" }
package.buildoptions = { "`wx-config --cxxflags`" }
package.linkoptions = { "`wx-config --libs`" }
« Last Edit: November 02, 2006, 10:04:44 pm by takeshi miya »