Linux File naming debug/release or --enable-debug not working? Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
tigerbeard
Earned some good credits
Earned some good credits
Posts: 123
Joined: Sat Oct 07, 2006 1:56 pm

Linux File naming debug/release or --enable-debug not working?

Post by tigerbeard »

While compiling wxWidgets in Linux I can see (too) little difference between debug and relaese build.

The first build I did with

Code: Select all

 ../configure ... --enable-debug ...
the second build with

Code: Select all

../configure ... --disable-debug ...
I got different sized files, e.g. 8MN vs 9MB and they have the same filename

Code: Select all

  libwx_baseu-2.9.a
This seems strange, because in Windows those files differ a lot more: 5MB vs. 31MB and the filename differs by "u" vs "ud".

Currently I think they both compiled as release. So I wonder why?
System config: Xubuntu22.04, wxWidgets 3.0.5,gcc, C::B
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Linux File naming debug/release or --enable-debug not working?

Post by DavidHart »

Hi,

It's an intentional platform difference in wx3. See this wx blog post for details, but the short answer is that, on non-Windows platforms, all builds are debug.

Regards,

David
tigerbeard
Earned some good credits
Earned some good credits
Posts: 123
Joined: Sat Oct 07, 2006 1:56 pm

Re: Linux File naming debug/release or --enable-debug not working?

Post by tigerbeard »

OK, thats good to know.

I am seeing this while been compiling 2.9, so would that be the same there?

I would prefer to think of both as "Release" with new bits as wxLogDebug and Dump. Mainly because one may leave it in the deliveries. I wonder if I can trace into the wxFunctions under Linux.

PS: I added that information in the wiki install instruction
Last edited by tigerbeard on Thu Sep 20, 2018 6:20 pm, edited 1 time in total.
System config: Xubuntu22.04, wxWidgets 3.0.5,gcc, C::B
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Linux File naming debug/release or --enable-debug not working?

Post by ONEEYEMAN »

Hi,
You are taking it wrong.
In Windows there is a huge difference between debug and release CRT. Therefore the debug vs. release builds does make sense there - you are linking to essentially different library.
On *nix (OSX) this is not the case. The difference between CRT on those systems are really small. Therefore it just doesn't make sense to do different filenames - you essentially linking to exactly the same CRT.

Now to do the debugging and possibility to step inside the wx code you absolutely should compile the libraries as debug ones. Because compiling as debug means that the libraries will not be stripped (on *nix) and some extra debugging code will be generated (by adding the -g flag). On Windows the debug version will produce the *.pdb file with the debug symbols.

If you have further questions don't hesitate to ask.

Thank you.
tigerbeard
Earned some good credits
Earned some good credits
Posts: 123
Joined: Sat Oct 07, 2006 1:56 pm

Re: Linux File naming debug/release or --enable-debug not working?

Post by tigerbeard »

Excuse my ignorance, but wasn't the -d compiler switch part of the --enable-debug when running configure?

When that is not working (obviously), the files stay small, how would I add the -d when using the configure/make system?
System config: Xubuntu22.04, wxWidgets 3.0.5,gcc, C::B
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Linux File naming debug/release or --enable-debug not working?

Post by ONEEYEMAN »

Hi,
Are you talking about "-g" option? Yes, this is to produce the debug build with the symbols available for debugging - nothing more. It will still link to the same CRT and it will produce the same binary. There is no difference between the program compiled with the -g and without it.
On Windows on the other hand it is different. First of all when producing the debug binaries you are linking to the debug CRT which is not the same as release CRT. So you program - on top of have bigger size has some additional capabilities to produce the debug symbols and everything (whats known to be *.pdb files). So on Windows it is ALWAYS suggested to re-test you program compiled in release mode - basically you will run to different binaries and not just in size.

Or you are talking about that nice "-d" prefix on the file name? In this case you don't need it. You can create 2 different directories - one for building debug and one for building release. But again - I don't know why would you want to do that. The only difference is between debug/release on Linux is that debug build does not strip the symbols from the binaries. But the binaries are exactly bthe same.

Thank you.,
tigerbeard
Earned some good credits
Earned some good credits
Posts: 123
Joined: Sat Oct 07, 2006 1:56 pm

Re: Linux File naming debug/release or --enable-debug not working?

Post by tigerbeard »

you are right, I meant the -g option, "produce debugging symbols". I was not talking about the d prefix.

My main focus between debug/release was the debug symbols, though, not so much the differences in CRT. Maybe thats why I was confused by some of the statements before. But I understand the difference with the C-runtime libs. I also understand the differences of the CRTs, maybe I just did not honour those differences high enough.

However, up to now I convinced that the main reason for the huge size difference between a wxWidget debug lib and a runtime lib (5Mb vs. 30Mb) was not due to the differences in CRT release vs. CRT debug, but due to the symbols included.
The only difference is between debug/release on Linux is that debug build does not strip the symbols from the binaries. But the binaries are exactly bthe same.
Yes, but isn't that obvious? And am I wrong to expect this difference to be similar as in Windows (like a ration ~5MB/30MB)?
If it is right, I am lost because that would mean
  1. a) nobody uses wxWidgets debugging symbols and that is the reason the installation instructions to not explain how to build them.
    b) people are using it, but making their live unnecessary difficult by removing an easy way to create them (the --enable-debug option) and an easy way to put them in the same directory as the "normal" libs (aka the "d" prefix").
    c) symbold are included by default and everyone keeps the debugging symbols in and ship them with the production code, because code execution is not changed.
I think c) is wrong, because the files I am getting seem to small. But still a) and b) seem stange to me.

I like this slightly confusing but interesting topic because it shows how much the apporaches differ between developing IDE-based or command line based. I my IDE I would create a new target with the gcc option "Produce debugging symbols (-g)" checked and would not think any more about it. On windows I acutally build me a project file for C::B, but I think Linux woudl be a lot more complex with the dependencies (jpeg, tiff, etc).

What would help me most at this point is to understand the command lines required to build wxWidgets with debugging symbold included.
System config: Xubuntu22.04, wxWidgets 3.0.5,gcc, C::B
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Linux File naming debug/release or --enable-debug not working?

Post by ONEEYEMAN »

Hi,
Unfortunately I am not familiar with the MinGW and all other ports of *nix software on Windows.
I can speak only about MSVC as this is the only tool I have been using.

Sorry about that.
So, if you are interested about this - read on. If not - skip the next paragraph and wait for someone more familiar with different flavours of MinGW to chime in.

AFAIU, MSVC defines the _DEBUG and DEBUG symbols when you are trying to produce the debug builds. When it happens the compiler/linker also does not strip the binaries and as I said before links to the debug CRT. On top of that it generates a special file(s) which has "pdb" extension. Those files contains debugging symbols which allows the developer to do the debugging - step inside the function, inspect the values and so on. How MSVC knows where to look for those files and how to perform the debugging - I don't know. Never worked in M$ and hopefully never will. All I can say is that those pdb files along with the generated binaries allows the developer to perform debugging of the program. Also the presence of those symbols allows the developers to receive the4 assert messsages if something will go avry either in their code from the CRT/OS POV so this scenario can be fixed. But if you switch to release mode (don't define both _DEBUG and DEBUG) you will not receive any and all assert messages and if something goes bad program silently dies or crashes.

Now when it comes to wxWidgets life becomes a little more interesting. Up to version 3.0 that was exactly the case. You have a different builds with the debug and release versions of the library and everything was great. However starting with 3.0 going forward there will be a difference. All those nice and good assert messages you saw in the debug mode are now on by default in the release mode. This is done to help the developer with the code testing. Now this option is configurable of course, because if it is turned on, the code will slow done a little and the size of the binaries will slightly increase. However everything else is still the same.

In terms of shipping the application to the customer with the debug vs release mode - I don't think anybody should do the software release out of the debug binaries, especially on Windows.

So hopefully I did not confuse you even more and hopefully there will be someone else who will talk about debug vs release mode on Windows for non-MSVC toolchain.

Thank you.
tigerbeard
Earned some good credits
Earned some good credits
Posts: 123
Joined: Sat Oct 07, 2006 1:56 pm

Re: Linux File naming debug/release or --enable-debug not working?

Post by tigerbeard »

Thanks for your explanations. In fact, I had been running a non MSVC toolchain in Windows for many years, also running wxWidgets.

The issues I came across where when I am switching over to Linux. Obviously I failed to clarify that enough. So all things below talks about the Linux world.

I managed to compile a version of the library in Linux. I understand that there is no such thing as a debug variant, because the only version also has some debug features in it. But this compilation did not produce debug information required to step into stings (I call that debug symbols, might be wrong term in Linux).

I am looking for the command lines in Linux to end up with a set of wxWidgets libraries with debug symbols.
System config: Xubuntu22.04, wxWidgets 3.0.5,gcc, C::B
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Linux File naming debug/release or --enable-debug not working?

Post by ONEEYEMAN »

Hi,
How exactly did you configure wxWidgets build?
In order to generate the debug build all you do is add

Code: Select all

--enable-debug
to the configure line.
Unfortunately right now all you should do is to delete the build folder (or create a new one) and re-run configure from it.
This is the default (standard) way of producing debug binaries/libraies under *nix.

You can also add

Code: Select all

--enable-debug_gdb
to generate extra debug information, but it is just an extras.

And you of course should have a gdb (Linux debugger) to perform the debugging. ;-)

Thank you.
tigerbeard
Earned some good credits
Earned some good credits
Posts: 123
Joined: Sat Oct 07, 2006 1:56 pm

Re: Linux File naming debug/release or --enable-debug not working?

Post by tigerbeard »

In order to generate the debug build all you do is add

Code: Select all
--enable-debug
Well, thats what I though before I started this post. When I compiled with that setting and without that setting, the classes were almost exactly the same size. The I was told (see first posts) that --enable-debug is not an option for Linux any more, windows only.

Your statement is closing the circle, sort of.
System config: Xubuntu22.04, wxWidgets 3.0.5,gcc, C::B
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Linux File naming debug/release or --enable-debug not working?

Post by ONEEYEMAN »

Ok, now I see where the confusion is. ;-)
If you are working out of the official *nix repository (remember each flavor of *nix has its own repo), then wx builds are debug by definition. Otherwise it won't be possible to develop a software on *nix.
But if you are building wx by yourself, "--enable-debug" is definitely a way to create a debug build of the library.

And as David said - -d prefix removal on *nix is intentional in 3.0+.

Thank you.
tigerbeard
Earned some good credits
Earned some good credits
Posts: 123
Joined: Sat Oct 07, 2006 1:56 pm

Re: Linux File naming debug/release or --enable-debug not working?

Post by tigerbeard »

Thanks for you patience.

I just redid the whole sequence again, one time with --debug-enable and one time with --debug-disable.

This time, I got the files with the same name, but with very much increased sizes as one would expect when debug symbols are disabled. The first time I was seeing both with about the same sizes - there must have been some error in that. From there began the confusion.

So quoting my first post
I got different sized files, e.g. 8MN vs 9MB and they have the same filename

Code: Select all

  libwx_baseu-2.9.a
This seems strange, because in Windows those files differ a lot more: 5MB vs. 31MB and the filename differs by "u" vs "ud".
Currently I think they both compiled as release. So I wonder why?
The answer is: That is wrong. Doing what you did will cause 2 files with the same name but size differences in the order of 10x. Just as you expected. There must have been an error somewhere.


Now, a complete separate discussion (and I things that caused the confusion) is the issue that the distinction between those different versions is there in Windows (for V2.9.3), but not in Linux. And I must admit, even when undestanding the rationale of the difference in the underlying Clib, IMHO the debug symbols still are enough of a difference to allow for a distinction.
What I find not so good is actually not the fact that the the "d" prefix is removed, but rather that its being handled differently between Windows/Linux. But thats an argument that pops up at many more places, e.g. the differnt file naming conventions of the libs (got feedback on that in another post).

Fortunately one can use the wx-config scipt (never used it before), to make that confusion totally invisible in the compiler setup in the IDE because the wx-config scropt is selecting the libs by itself. It just remains complicated under the hood.

Well it took long, but I think I got my arms around it. What remains seems more matter of opition than question. @ONEEYEMAN, I'll mark your last answer as Accepted, because it caused me to re-run the whole thing and discover the initial problem. Thanks
System config: Xubuntu22.04, wxWidgets 3.0.5,gcc, C::B
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Linux File naming debug/release or --enable-debug not working?

Post by ONEEYEMAN »

No pronlem.
Glad I could help and clear the confusion.

Also, you could look at it this way: if yiou try to build a debug version of GTK+, Qt, Motif or any other library the naming of resulting binaries will not have any suffixes. So in essense this change for wx is to try and bring library closer to the platform standard.

Thank you.
Post Reply