Recent

Author Topic: Project options change by themselves [Solved]  (Read 21750 times)

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: Project options change by themselves
« Reply #15 on: November 07, 2023, 10:11:36 pm »
Sorry bobc50 as your questions gone by without me noticing earlier.

Do you agree with my assessment
As it stands right now with the information available then that could indeed explain the behaviour as you witnessed/experienced it. Especially if you are not quite sure if you used the check mark for saving your options as default and you did so indeed.

Quote
Short of changing my approach, which is based on my need to compare changes to prior versions, do you have a suggestion on how to keep this from happening going forward?
Other than the suggestions already mentioned, not really or that I am aware of.

Setting default options is something I personally do the moment I start a new Lazarus installation for the second time (I use the first time to check/verify other settings and behaviour and to make sure I did not messed up with my startup scripts/shortcuts). I then let Lazarus create a new empty project and go through all the compiler settings one by one till I'm satisfied, press the check-box and save these settings to be used as default. Then I close the empty project, create a new one and check if the default settings are indeed configured as intended for the new project and compile a first small test example with those settings.

I usually never touch the default settings again unless there is some kind of new feature that I want to try out and/or to see if it would beneficial to use it as a default setting and/or to "play" with it.

In the case were I truly want to make drastic changes to my default settings (very rare, in practice almost never usually because there is a new release before it even comes to that), I make a backup of my previous default settings first so that it is possible to revert the changes.

But that is easy for me to say because I've used FPC/Lazarus for quite some while now to know what I want the default compiler settings to be. That might not be that easy to do for someone who is new or fairly new to FPC/Lazarus.

Lazarus always provides you the option to start anew with using another (empty) configuration directory so you can't really go wrong there other than it takes time to re-configure everything.
« Last Edit: November 07, 2023, 10:14:22 pm by TRon »
Today is tomorrow's yesterday.

n7800

  • Hero Member
  • *****
  • Posts: 710
  • Lazarus IDE contributor
    • GitLab profile
Re: Project options change by themselves
« Reply #16 on: November 07, 2023, 10:23:39 pm »
Sorry for the offtopic.

You mean it does the same as "OK" and then also sets the default? I am not sure if it makes things any more clear.

Yes.

The gist I got from n7800's post is to replace the checkbox with a button with the caption "Save compiler options as default" or something to that extend.

My initial thought was also to place the button next to the other buttons but that might come across as unrelated to the compiler options in specific (unless using the whole caption to make it crisp and clear)

An example image is attached.

The button can be placed in place of the checkbox, but in my opinion this will not be very good.
Another option is near the "Show Options" button.

The caption for the button could be better, this is just an example.


bobc50

  • New Member
  • *
  • Posts: 30
Re: Project options change by themselves
« Reply #17 on: November 07, 2023, 11:47:04 pm »
Did you add build modes to your project? Some of them can be stored in a session data (.lps) instead of the project info (.lpi).
See Project Options -> Session.

I don't know if this is related to your issue anyhow. Still installing a new Lazarus version does not change your project's settings. There is something else going on.
Thanks for your reply. I don't do anything explicitly to add build modes. I've attached a copy or Project Options | Session. Perhaps that answers your question.

bobc50

  • New Member
  • *
  • Posts: 30
Re: Project options change by themselves
« Reply #18 on: November 08, 2023, 12:11:23 am »
Do you agree with my assessment
As it stands right now with the information available then that could indeed explain the behaviour as you witnessed/experienced it. Especially if you are not quite sure if you used the check mark for saving your options as default and you did so indeed.
Quote
Short of changing my approach, which is based on my need to compare changes to prior versions, do you have a suggestion on how to keep this from happening going forward?
Other than the suggestions already mentioned, not really or that I am aware of.
Again, your questions and comments have been helpful to suggest meaningful experiments. Thanks for that!

For the record I have been checking "Set compiler options as default" whenever I manually update the options to restore the defaults.

I've done some more experiments which might help to discover the root cause so it can be fixed.

Without Lazarus running I delete my two debug folders and then copy the folders from GitHub to recreate a new version of those folders. As soon as I open Lazarus the project options have changed!
  • What does that tell us?
  • I assume that at startup Lazarus discovers that the folders it had open have changed and updates the files. What type of file could change the Project Options?

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: Project options change by themselves
« Reply #19 on: November 08, 2023, 12:40:56 am »
Without Lazarus running I delete my two debug folders and then copy the folders from GitHub to recreate a new version of those folders. As soon as I open Lazarus the project options have changed!
I want to prevent miscommunication so have to be pedantic and ask that when you write "the project options have changed" if you refer to the options of the (individual) project or the default options that Lazarus uses whenever you create a new project ?

These are two distinct situations.

Based on the situation, the answer to your question(s) differ.

With regards to "debug folders", what exactly do you meant by that ? Are these project related directories or Lazarus (configuration) related folders ?

It would be nice to figure this out and be able to re-create the issue consistently.
Today is tomorrow's yesterday.

bobc50

  • New Member
  • *
  • Posts: 30
Re: Project options change by themselves
« Reply #20 on: November 08, 2023, 08:26:41 am »
Without Lazarus running I delete my two debug folders and then copy the folders from GitHub to recreate a new version of those folders. As soon as I open Lazarus the project options have changed!
I want to prevent miscommunication so have to be pedantic and ask that when you write "the project options have changed" if you refer to the options of the (individual) project or the default options that Lazarus uses whenever you create a new project ?
Good clarifying questions, thanks. I mean the options that I see in Lazarus when I click Project | Project Options. The one that causes me the most issues when I debug is Compiler Options | Compilation and Linking. My default is Optimization Levels: 1. That changes to level 3.
With regards to "debug folders", what exactly do you meant by that ? Are these project related directories or Lazarus (configuration) related folders ?
I mean my two project related folders. I recreate those by copying the files that I have downloaded from GitHub. I never touch the Lazarus related folders.
It would be nice to figure this out and be able to re-create the issue consistently.
Now that I believe I have shown that it is some file in my project related folders that is causing the change, as soon as we suspect the type of file that might do this my plan is to attach it so the issue can be reproduced leading to a solution to prevent it from happening again.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4715
  • I like bugs.
Re: Project options change by themselves
« Reply #21 on: November 08, 2023, 05:33:48 pm »
I assume that at startup Lazarus discovers that the folders it had open have changed and updates the files. What type of file could change the Project Options?
The Project Info file (.lpi). That is where the options are stored.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

bobc50

  • New Member
  • *
  • Posts: 30
Re: Project options change by themselves
« Reply #22 on: November 09, 2023, 01:37:06 pm »
I assume that at startup Lazarus discovers that the folders it had open have changed and updates the files. What type of file could change the Project Options?
The Project Info file (.lpi). That is where the options are stored.
Most helpful and, I hope, one step from fixing this issue, thanks. I found lines below in that file. I suspect they are causing the Project Options to change from my default. I see other lines that correspond to other changes in the Project Options.

Is there a way to "tell" Lazarus to not force values for those parameters but rather to use the compiler defaults? If I understood the comments in this thread that would completely solve my issue. I wouldn't have to worry that the Project Options are changing behind my back.

What I would like is for the code highlighted to be removed from the ini. I found a previous version where that was the case but we've got no idea about what was done to cause that to happen.  :(

 
Code: Pascal  [Select][+][-]
  1.      <Parsing>
  2.       <SyntaxOptions>
  3.         <IncludeAssertionCode Value="True"/>
  4.       </SyntaxOptions>
  5.     </Parsing>
  6.     <CodeGeneration>
  7.       <Checks>
  8.         <IOChecks Value="True"/>
  9.         <RangeChecks Value="True"/>
  10.         <OverflowChecks Value="True"/>
  11.         <StackChecks Value="True"/>
  12.       </Checks>
  13.       <VerifyObjMethodCallValidity Value="True"/>
  14.       <TargetOS Value="win64"/>
  15.       <Optimizations>
  16.         <OptimizationLevel Value="3"/>
  17.       </Optimizations>
  18.     </CodeGeneration>
« Last Edit: November 10, 2023, 09:39:00 am by bobc50 »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4715
  • I like bugs.
Re: Project options change by themselves
« Reply #23 on: November 10, 2023, 05:38:31 pm »
Is there a way to "tell" Lazarus to not force values for those parameters but rather to use the compiler defaults? If I understood the comments in this thread that would completely solve my issue. I wouldn't have to worry that the Project Options are changing behind my back.
You decide yourself when you download the project from GitHub. Why do you download it "behind your own back" when the same project is open in Lazarus? Makes no sense. :)

Quote
What I would like is for the code highlighted to be removed from the ini. I found a previous version where that was the case but we've got no idea about what was done to cause that to happen.  :(
You mean removed from the Project Info file, right?
You must ask the project maintainers to do it and commit the change to GitHub.
Better yet, ask them to generate Debug and Release buildmodes. Then you can develop with all debug flags and checks enabled (Debug mode) and build only the final binary with Release mode.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: Project options change by themselves
« Reply #24 on: November 10, 2023, 10:27:32 pm »
@bobc50:
From your latest conversations with JuhaManninen it is now becoming more clear to me why I am unable to recreate the issue that you mention. (I can 100% recreate that but I do not experience it as an error/issue hence the confusion on my part).

That is normal default behaviour. If you store a project to disk it is the projects settings file (lpi) file that 'overrules' your default settings. So, whenever the default settings of somoene else (or an older version of your own used or differently configured Lazarus) used other default settings then this can conflict as you experienced.

You can circumvent that by:
- not 'uploading' the lpi file
- make sure the prject uses a 'clean' lpi file that does not interfere with (other) user's default settings (only store those settings that are minimal required for the project to be able to act as intended)
- not downloading the lpi file
- remove the lpi file or conflicting settings before opening your project with Lazarus

I am not 100% sure (I never checked) if publishing a project cleans out the lpi file (and/or other project related files) before the actual save to disk. If it does then that would also be a viable option/solution.
« Last Edit: November 10, 2023, 10:32:05 pm by TRon »
Today is tomorrow's yesterday.

bobc50

  • New Member
  • *
  • Posts: 30
Re: Project options change by themselves
« Reply #25 on: November 11, 2023, 12:20:37 pm »
Quote
The Project Info file (.lpi). That is where the options are stored.
You mean removed from the Project Info file, right?
You must ask the project maintainers to do it and commit the change to GitHub.

So, whenever the default settings of somoene else (or an older version of your own used or differently configured Lazarus) used other default settings then this can conflict as you experienced.

You can circumvent that by:
- make sure the prject uses a 'clean' lpi file that does not interfere with (other) user's default settings (only store those settings that are minimal required for the project to be able to act as intended)
It sounds like you are both suggesting the same approach and I'm very appreciative of your suggestion. It might be very clear to you, but due to my experience level, not to me, HOW to do it. The goal was to remove the lines below in the project.lpi file.

To be specific:
  • JuhaManninen, when you say, "You must ask the project maintainers to do it," can you please tell me exactly what that "it" is?
  • TRon, I've tried every approach I could think of to have Lazarus remove the code below and come up with a 'clean' lpi which wouldn't interfere with (other) user's default settings. If I knew how to accomplish that and generate such a file I could ask the developer to do the same. Can you please tell me how I might do that?

 
Code: Pascal  [Select][+][-]
  1.       <Optimizations>
  2.         <OptimizationLevel Value="3"/>
  3.       </Optimizations>
  4.  

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4715
  • I like bugs.
Re: Project options change by themselves
« Reply #26 on: November 12, 2023, 07:49:52 pm »
JuhaManninen, when you say, "You must ask the project maintainers to do it," can you please tell me exactly what that "it" is?
Removing the OptimizationLevel from the Project Info .lpi file. That's what you asked.
You download it from GitHub, thus changing it yourself is not enough. Am I right? So the project maintainers in GitHub must do it.
Maybe I still don't understand what the actual problem is. Feels like you have turned a simple task into a complicated one.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

bobc50

  • New Member
  • *
  • Posts: 30
Re: Project options change by themselves
« Reply #27 on: November 13, 2023, 09:35:04 am »
JuhaManninen, when you say, "You must ask the project maintainers to do it," can you please tell me exactly what that "it" is?
Removing the OptimizationLevel from the Project Info .lpi file. That's what you asked.
You download it from GitHub, thus changing it yourself is not enough. Am I right? So the project maintainers in GitHub must do it.
Maybe I still don't understand what the actual problem is. Feels like you have turned a simple task into a complicated one.
Thanks for the clarifying questions. I agree it is a simple task to use the Project Options in Lazarus to change the Optimization settings to what is required whenever I get a new copy of the software from GitHub. However, that is error prone. I sometimes get several versions to test in a day and forgetting to change all of the important parameters can lead to anomalous results.

The developer who creates a new release candidate would be happy to change their settings in Project Options to eliminate the lines related to optimization in the Project.lpi file which would allow Lazarus to use the default Project Options on target machine to control those settings but isn't sure how to do that. I've read through all the documentation I could find and haven't found settings that the developer can use to allow that to happen.

While I am an experienced software engineer, use of Lazarus Free Pascal is new to me. Over the decades I've learned that the "simplest task" is no task required. That eliminates mistakes and oversights. Based on responses to my question in this forum, it appears that there are settings in Lazarus that can be made by the developer that, once done, would NOT require any additional work to allow the Lazarus defaults to govern the compilation and linking. I suspect those would benefit other users beside me. Does that help to explain the problem?

n7800

  • Hero Member
  • *****
  • Posts: 710
  • Lazarus IDE contributor
    • GitLab profile
Re: Project options change by themselves
« Reply #28 on: November 13, 2023, 02:12:17 pm »
For the record I have been checking "Set compiler options as default" whenever I manually update the options to restore the defaults.

You seem to be even more confused by the name of the "Set compiler options as default" checkbox. This does not mean "Restore values to default values", but "Remember current values as default values".

In any case, forget about "Set compiler options as default" - they only apply when you create a NEW PROJECT. When you open an EXISTING PROJECT they DO NOT APPLY.

Otherwise, the same project would work differently for different users, and this would cause many different problems.

Options not specified in the LPI file have a default value, which is hardcoded in the IDE sources. You cannot change them for all projects. You need to manually open each project and change the settings for it.

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: Project options change by themselves
« Reply #29 on: November 13, 2023, 03:01:56 pm »
TRon, I've tried every approach I could think of to have Lazarus remove the code below and come up with a 'clean' lpi which wouldn't interfere with (other) user's default settings. If I knew how to accomplish that and generate such a file I could ask the developer to do the same. Can you please tell me how I might do that?[/li][/list]

I did not respond sooner because of what n7800 just wrote. It is a +1 answer.

That means that the maintainer is responsible for those settings and these settings are usually made with a clear vision/purpose (of the maintainer) in mind.

Now, once in a while it so happens that the maintainer is either not aware that some options set for the project does not really have any impact or is/are really required (in which case these settings could 'bug' you because you have to change those settings again and again whenever you do a new pull) and it also happens that, especially when using vcs, that the projects settings are changed unintentionally because the project maintainer forgot to exclude them from being updated (it is a technical boring story but if more information needed then feel free to ask).

In those situations I manually adjust the lpi file to suit my needs.

There is no real hard list of steps that could be set in stone as they only apply for a certain project and/or situation. Each time it differs what need to be changed and it would be changed according to your own personal preferences (and preferences tend to differ for each individual).

Today is tomorrow's yesterday.

 

TinyPortal © 2005-2018