Recent

Author Topic: Fpc/Lazarus generate 'linkXXXX.res' and 'ppas.bat' files in the project director  (Read 1210 times)

PascalUser69105

  • Newbie
  • Posts: 6
These files have something to do with the linking of the program or something... but they are placed in the project's directory and are annoying/distracting.
I often delete them manually, but I'm getting tired.
I also tried delp but it seems to ignore these files.

tetrastes

  • Sr. Member
  • ****
  • Posts: 483
1. If you don't like these files, don't use Run-Quick Compile.
2. The placement of these files is defined by -FE or -o options, if the latter contains path. In Lazarus you can define it by Project-Project Options-Compiler Options-Paths-Target file name (-o).

denis.totoliciu

  • Jr. Member
  • **
  • Posts: 53
1. If you don't like these files, don't use Run-Quick Compile.
2. The placement of these files is defined by -FE or -o options, if the latter contains path. In Lazarus you can define it by Project-Project Options-Compiler Options-Paths-Target file name (-o).

Quick Compile has its benefits as it works faster than the normal compilation. It is also very useful for checking whether the source code compiles or not without going through the linking stage. It used to work fine without creating these files. I don't know if there is any usage to keeping them, the linkXXXX.res, but there should be a simple option to stop the generation of these files.

Seems to me that you are actually defending this new behavior of the IDE which looks more like a bug than a feature.

tetrastes

  • Sr. Member
  • ****
  • Posts: 483
Seems to me that you are actually defending this new behavior of the IDE which looks more like a bug than a feature.
Do not speculate about other people's intentions.
I am defending nothing, I simply describe things as is, and have told OP how to place these files not in the project directory.
I don't worry whether this is bug or feature.
And may be you tell me the version of Lazarus, when this "new" behaviour arrived?

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Quick Compile has its benefits as it works faster than the normal compilation. It is also very useful for checking whether the source code compiles or not without going through the linking stage. It used to work fine without creating these files. I don't know if there is any usage to keeping them, the linkXXXX.res, but there should be a simple option to stop the generation of these files.

Judging from the code (and its history) it was never the case that the files weren't created with Quick Compile: the quick compile option tells the IDE's compiler wrapper to skip both the linking as well as the assembling. This means it will pass -s to the compiler which in turn means that the link/assembly shell script (ppas.bat, ppas.sh, etc.) as well as the script for the linker (the *.res) will be created.

denis.totoliciu

  • Jr. Member
  • **
  • Posts: 53
Seems to me that you are actually defending this new behavior of the IDE which looks more like a bug than a feature.
Do not speculate about other people's intentions.
I am defending nothing, I simply describe things as is, and have told OP how to place these files not in the project directory.
I don't worry whether this is bug or feature.

Maybe I understand wrongly, but saying to a programmer not to use Quick compile in order to avoid such a thing (the files generated) doesn't seem to me like a solution, but more like avoidance. Problem with this approach is that you can't really start recommending everybody who bumps into features with potential issues to just avoid them and not care whether those apparent feature misbehaviors are bugs or features.

And may be you tell me the version of Lazarus, when this "new" behaviour arrived?
This is indeed a new behavior. I have on the same machine, Windows 7 Ultimate SP1 64-bit, the following versions of the IDE:
  • Lazarus 2.0.12 that uses FPC 3.2.0. This one works as expected, creating a single file named link.res, doing the same as the previous versions of Lazarus;
  • Lazarus 2.2.0 that uses FPC 3.2.2. This is the version that generates the multiple linkXXXX.res at each execution of the Quick compile command.
There is another topic that has been opened on the same subject:
Quick Compile leaves linknnnn.res files in project

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
And may be you tell me the version of Lazarus, when this "new" behaviour arrived?
This is indeed a new behavior. I have on the same machine, Windows 7 Ultimate SP1 64-bit, the following versions of the IDE:
  • Lazarus 2.0.12 that uses FPC 3.2.0. This one works as expected, creating a single file named link.res, doing the same as the previous versions of Lazarus;
  • Lazarus 2.2.0 that uses FPC 3.2.2. This is the version that generates the multiple linkXXXX.res at each execution of the Quick compile command.

This change was done in FPC so that the compiler can be run in parallel in the same directory if linking is involved (cause the file is also required when linking is done; it's simply deleted by the compiler afterwards). FPC does not care that Lazarus uses the -s option for it's Quick Compile menu. So you'll either have to live with that or open a feature request on the Lazarus bug tracker that the IDE cleans up these files.

Thaddy

  • Hero Member
  • *****
  • Posts: 14382
  • Sensorship about opinions does not belong here.
If it would be added to delp it would possibly also clean valid resource files unless tied to the names.
[edit]
Note that delp.pp already contains code to handle both link*.res and ppas.bat, so it should already work.
« Last Edit: December 22, 2022, 08:37:26 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

tetrastes

  • Sr. Member
  • ****
  • Posts: 483
Maybe I understand wrongly, but saying to a programmer not to use Quick compile in order to avoid such a thing (the files generated) doesn't seem to me like a solution, but more like avoidance. Problem with this approach is that you can't really start recommending everybody who bumps into features with potential issues to just avoid them and not care whether those apparent feature misbehaviors are bugs or features.

May be you don't notice, I also gave OP another solution, which can help him:

... but they are placed in the project's directory and are annoying/distracting.

2. The placement of these files is defined by -FE or -o options, if the latter contains path. In Lazarus you can define it by Project-Project Options-Compiler Options-Paths-Target file name (-o).

And how did you help him? Telling that this is bug and that's all?

denis.totoliciu

  • Jr. Member
  • **
  • Posts: 53
And how did you help him? Telling that this is bug and that's all?

I am interested in the same issue as the original poster. I wanted to know whether this is considered a bug or a feature. Now I know what this is, thanks to the explanation given by PascalDragoon.
Some people, including me, want to understand what is happening with some of the features that out of a sudden start working in different ways.

The way in which I helped is this: I continued the discussion and by this, at some point, some interested programmers came about and stated out what is happening, why it is happening and this is the part that for me says an actual fact:
So you'll either have to live with that or open a feature request on the Lazarus bug tracker that the IDE cleans up these files.

Why this to me is important information? It is because of the following question:
How can you know whether this is normal behavior or not of the IDE since the previous versions worked differently?

Knowing whether this is a feature or a bug or a reason for a feature request makes a big difference in the long run.

tetrastes

  • Sr. Member
  • ****
  • Posts: 483
That's all good, but why did you restart the discussion by charging me?
I answered OP what he asked. Reread subject of topic and his post. He didn't ask whether this is bug or feature. Now he knows it, and what? - all he can do is wait if this feature request will be done. At least with my answer he can do something.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
This change was done in FPC so that the compiler can be run in parallel in the same directory if linking is involved (cause the file is also required when linking is done; it's simply deleted by the compiler afterwards). FPC does not care that Lazarus uses the -s option for it's Quick Compile menu. So you'll either have to live with that or open a feature request on the Lazarus bug tracker that the IDE cleans up these files.
A feature request preferably with a patch implementing it.
I am sure it would be applied. I guess it is relatively easy to implement but is low priority for most Lazarus core developers. Thus without a patch it is not likely to happen soon.
Does anybody want to keep those files after Quick Compile? If yes, then an option is needed. Otherwise the files can be just deleted always.
« Last Edit: December 23, 2022, 09:27:13 am by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

PascalDragon

  • Hero Member
  • *****
  • Posts: 5486
  • Compiler Developer
Does anybody want to keep those files after Quick Compile? If yes, then an option is needed. Otherwise the files can be just deleted always.

I don't think an option is needed, because from the user's point of view Quick Compile simply has the goal to check the syntax. If - hypothetically - FPC would have an option to do exactly that without outputting any files, Lazarus would use that option. If the users need the files they can always pass -s as custom option, because the clean up should only be done if really a Quick Compile is done.

 

TinyPortal © 2005-2018