Recent

Author Topic: Build modes / release - debug  (Read 3430 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10788
  • Debugger - SynEdit - and more
    • wiki
Build modes / release - debug
« on: June 23, 2020, 09:52:41 pm »
EDIT: Split out from https://forum.lazarus.freepascal.org/index.php/topic,50298.msg366915.html#msg366915





3- reduce the exe file directly when deploy no need for stip exe
Well, you need two build modes.

There are tools to help setting them up (there is a button when you enter the build modes dialog).

I don't know why they are not always there by default with any new project. Maybe some people did not like them, maybe no one took the time to implement it....

Afaik, you can save them as default for new projects. (lower left corner of project options)


The project options have a checkbox "strip exe" -Xs. Does this work for you?
Otherwise you can add the strip command explicitly to the "run after compile" part. (of course for release only)

As I said, not sure why (or how much of)  this one time setup is still needed.

If someone wants to improve this, start by searching why it was not done (i.e. complaints about build modes).
« Last Edit: June 23, 2020, 11:33:39 pm by Martin_fr »

RAW

  • Hero Member
  • *****
  • Posts: 868
Re: We are planning the next release: Lazarus 2.0.10
« Reply #1 on: June 23, 2020, 10:43:00 pm »
Quote
I don't know why they are not always there by default with any new project.
This is definitely overdue !!!
DEBUG and RELEASE should out of the box be enabled and set to RELEASE, so everybody will be happy again...

PROS:
- Beginners don't ask questions about the file size
- Beginners know there is something like DEBUG and RELEASE
- Professionals who don't wanna waste time can compile directly with RELEASE mode
- DEBUG mode is one click away, just a little switch

CONS:
- Nothing !!! At least I cannot see anything ...

I always thought that this is stupid not to enable it out of the box, ideally show the mode in the program (form) caption.  :)
AND by the way I tried this DEFAULT checkbox a couple of times, but on my system nothing changes ...
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10788
  • Debugger - SynEdit - and more
    • wiki
Re: We are planning the next release: Lazarus 2.0.10
« Reply #2 on: June 23, 2020, 11:14:49 pm »
DEBUG and RELEASE should out of the box be enabled and set to RELEASE, so everybody will be happy again...
Setting to release is not an advantage. Most people will have plenty of debug builds / debug-run before they compile a release.

But buildmodes could have settings:
 Name for run menu entry: Creates a run menu entry "Build <mode-name>" (so you can build release, via: run > build release)

The run button would still compile the current build mode, by default "debug". Because running a none debug build in the IDE (in the debugger) is really pointless.

Only needs a person willing to work on it.


EDIT:
Adding build mode to the output directury would maybe help too. If the files are in lib/debug/x86-64/  most people will realize.
If you set the exe to go into the project folder then maybe it should be named project1-debug.exe
(Or whatever the buildmode name is)
<< End EDIT


Quote
ideally show the mode in the program (form) caption.  :)
Issue of its own.
Though at this stage, I would say that adding another checkbox, for what goes into the caption, is the wrong way.
If someone wants to give it a go, I think the IDE caption should be build-able from macros:
$(ProjecName) - $(BuildMode) in folder $(ProjectDir)

just my 2 cents

Quote
AND by the way I tried this DEFAULT checkbox a couple of times, but on my system nothing changes ...
I haven't tested it, but sounds like it could be a bug.
I guess you have to leave the dialog with "ok" when this is checked. But not sure.
« Last Edit: June 23, 2020, 11:27:10 pm by Martin_fr »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10788
  • Debugger - SynEdit - and more
    • wiki
Re: We are planning the next release: Lazarus 2.0.10
« Reply #3 on: June 23, 2020, 11:20:34 pm »
- Professionals who don't wanna waste time can compile directly with RELEASE mode

Just to say:
Any code I write will first run in debug-mode.
Even, if there is no need to debug it.

Debug mode also contains -Criot -Sa -gh -gt and others. No code can ever go release, if it has not been run in this mode.
Yes, of course those debug runs are happening in test cases.
But they also happen whenever I run any of my projects local. All my builds that I use for myself (unless they are time critical number crunching...) are build with those flags. So they get as much testing as they can.

I would expect any "professional" to adhere to a similar standard.

RAW

  • Hero Member
  • *****
  • Posts: 868
Re: Build modes / release - debug
« Reply #4 on: June 23, 2020, 11:57:34 pm »
Quote
I guess you have to leave the dialog with "ok" when this is checked. But not sure.
Yes, tried it a couple of times, but nothing changed. I guess the last version I checked was 2.0.4. For me it's not a big deal though. I don't know why this isn't working.

Quote
Any code I write will first run in debug-mode.Even, if there is no need to debug it.
Me too, definitely ...  :)

Quote
I would expect any "professional" to adhere to a similar standard.
I thought there must be a reason why the DEFAULT mode is always enabled first. There must be something that's better than the RELEASE mode ... I don't know what by the way. That's why I wrote "professionals", I had the DEFAULT mode in mind even if I don't understand this mode ...  :)
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Build modes / release - debug
« Reply #5 on: June 24, 2020, 12:31:03 pm »
I thought there must be a reason why the DEFAULT mode is always enabled first. There must be something that's better than the RELEASE mode ... I don't know what by the way. That's why I wrote "professionals", I had the DEFAULT mode in mind even if I don't understand this mode ...  :)

The "Default" mode is like "Debug" but with a few less debugging options enabled (mainly "Checks and assertions"), which makes it kind of the "sweet spot" between "full debug" and "release". That makes it the ideal mode for normal development and "normal" (read: reasonably seasoned) programmers.

I always thought that this is stupid not to enable it out of the box, ideally show the mode in the program (form) caption.  :)

Not really the same, but "Tools->Options->Environment->IDE shows selected build mode" does it for you. Unless what you want is to show it in your project's caption at run-time

Oh, to enable the modes for all your (future) projects just set a dummy project as you want and check "Set compiler options as default". Or is that what is not working for you?
« Last Edit: June 24, 2020, 12:41:29 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

RAW

  • Hero Member
  • *****
  • Posts: 868
Re: Build modes / release - debug
« Reply #6 on: June 24, 2020, 04:29:47 pm »
Quote
The "Default" mode is like "Debug" but with a few less debugging options enabled (mainly "Checks and assertions"), which makes it kind of the "sweet spot" between "full debug" and "release". That makes it the ideal mode for normal development and "normal" (read: reasonably seasoned) programmers.
Thanks for the info. In my eyes such a mode is pretty useless (not full DEBUG and not RELEASE), but I don't need to use it so it doesn't bother me in any way ... Very often I start a new project from an old one and change or delete things, so normally I don't see much of this DEFAULT mode.  :)  I always liked the LAZARUS IDE otherwise I wouldn't use it and there are other ways ...

Quote
Not really the same, but "Tools->Options->Environment->IDE shows selected build mode" does it for you.
I know, I use this all the time, but for a beginner this won't help much, because it doesn't show the DEFAULT mode. I know where to find and setup those build modes, but usually a beginner doesn't have the patience to take a deep look into the program options and check the settings. I know there is a button called "change build mode", but obviously a lot of people overlooking it.  :)

Quote
"Set compiler options as default".
For me this has never worked on any system that I use ... I haven't checked 2.0.6 and 2.0.8 ...
What about your system? Does it work for you? I'm just curious ...  :)


The reason why I wrote "stupid" is that it could be very easy to show every beginner that there are build modes and that those build modes affect the file size of course, that would eliminate a lot of questions and makes things more obvious.
Windows 7 Pro (x64 Sp1) & Windows XP Pro (x86 Sp3).

Handoko

  • Hero Member
  • *****
  • Posts: 5386
  • My goal: build my own game engine using Lazarus
Re: Build modes / release - debug
« Reply #7 on: June 24, 2020, 04:38:24 pm »
I would suggest to add a new mode: "Small binary" mode. So if someone asks why the exe size is big, we just tell them to set it to small binary mode.
« Last Edit: June 24, 2020, 04:40:22 pm by Handoko »

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Build modes / release - debug
« Reply #8 on: June 24, 2020, 04:44:37 pm »
I know where to find and setup those build modes, but usually a beginner doesn't have the patience to take a deep look into the program options and check the settings.

Beginners, more than anyone else, should have the patience and take the time to learn the environment. But you're right that they frequently don't, more so if they're also new to Pascal :)

Quote
For me this has never worked on any system that I use ... I haven't checked 2.0.6 and 2.0.8 ...
What about your system? Does it work for you? I'm just curious ...  :)

It has always worked for me. First thing I do on installing a new dev machine is (among lots of other things, like adding our standard project templates) what I outlined above: new project, set our (and my personal) "default" options, check that box, save and do a test compilation. No problems so far, though I must add that this is mostly on Linux, and (a very few) Windows boxes.

That is, I do that if for whatever reason I can't directly copy (and modify) the config directory (along the full source tree) of my reference machine, which doesn't happen that often.

YMMV, of course ;)
« Last Edit: June 24, 2020, 04:47:52 pm by lucamar »
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Handoko

  • Hero Member
  • *****
  • Posts: 5386
  • My goal: build my own game engine using Lazarus
Re: Build modes / release - debug
« Reply #9 on: June 24, 2020, 04:49:07 pm »
Beginners, more than anyone else, should have the patience and take the time to learn the environment.
To me, what make the beginner a beginner:They're impatience, want to do the thing outside their ability, ask before think, not willing to do some forum/web searching, lazy to read the wiki/documentation.

Sorry, but that's true.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Build modes / release - debug
« Reply #10 on: June 24, 2020, 05:05:37 pm »
I think it is most likely that absolute beginners are more interested in learning what can be done with the language rather than learning how to use the tools. Problem is that Lazarus is a rather complex tool as well as an important source of "standard" libraries, so the two learning paths get mixed up and can lead to some confussion.

This is hijacking the thread a little but for beginners I think we should have somewhere a ready-made set of configuration files with which to make buiding a learning environment a little easier.

Nevertheless, while Lazarus is "complex" as a tool it's relatively easy to use and learn even for beginners; the more esoteric features can always be learned later, when one needs them. Perhaps someone can write a small tutorial with step-by-step instructions for the commonly used (and useful) things ...? :-\
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Handoko

  • Hero Member
  • *****
  • Posts: 5386
  • My goal: build my own game engine using Lazarus
Re: Build modes / release - debug
« Reply #11 on: June 24, 2020, 05:18:48 pm »
I agree with all the things you said.

And you know, the biggest problem we have: manpower.

Lazarus/FPC is so awesome and free. As a hobbyist I am not willing and don't have the money to pay the license for a high quality development tool. Thank you the development team and everyone involved. So I come here to help newbies. My time and knowledge is very limited, that's why I often direct the beginners to the wiki/documentation page.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Build modes / release - debug
« Reply #12 on: June 24, 2020, 05:41:36 pm »
I agree with all the things you said.

And you know, the biggest problem we have: manpower.

Lazarus/FPC is so awesome and free. As a hobbyist I am not willing and don't have the money to pay the license for a high quality development tool. Thank you the development team and everyone involved. So I come here to help newbies. My time and knowledge is very limited, that's why I often direct the beginners to the wiki/documentation page.

Yeah, manpower and time are the biggest problem. We do have some training material but it's rather "loose-leaf": some collections of techy notes, examples, very small tuts, etc. because we rely more on personal teaching and on-the-job training. And we don't get so many "new" devs that it's a real necessity.

I've lately started organizing, curating and extending all that material along with some of my own but, as always happens, lack of time for low priority projects prevents full-ahead advance. :(
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

 

TinyPortal © 2005-2018