Recent

Author Topic: Bug? Non-existing unit doesn't break compiliation  (Read 405 times)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 729
    • My games in Pascal
Bug? Non-existing unit doesn't break compiliation
« on: June 28, 2024, 01:12:18 pm »
I wonder if it is intended behavior? Most likely cached (prebuilt) versions of units that depend on deleted units is used.

Steps to reproduce:

1. In Lazarus create a simple program, add Unit1 and Unit2.
2. Add Unit1 to program's uses section, add Unit2 to Unit1's uses section.
3. Compile. [The attached project is at this step for your convenience]
4. Remove unit2.pas from the Project Inspector.
5. Physically delete unit2.pas
6. (Optional) do some changes elsewhere, e.g. add writeln in program.
7. Compile.

Compilation successful. Even though unit1 still has unit2 in uses section. Clean up and Build correctly throws a compilation failure because unit2 is not found.
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

zeljko

  • Hero Member
  • *****
  • Posts: 1637
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Bug? Non-existing unit doesn't break compiliation
« Reply #1 on: June 28, 2024, 01:23:05 pm »
Delete unit2.ppu and you'll get error :)

Eugene Loza

  • Hero Member
  • *****
  • Posts: 729
    • My games in Pascal
Re: Bug? Non-existing unit doesn't break compiliation
« Reply #2 on: June 28, 2024, 01:39:27 pm »
Well, clean up and build requires less manual work :D

But the usecase is simple. I make a unit, I start integrating it in the game, then I see that the unit was a bad idea and it doesn't solve the issue. I delete it, compile and clean up all remains of the unit's references, at least so I think. Make a git commit and push. Start working on a different solution. Suddenly stumble upon a class used from the unit I've deleted 20 minute ago. Making this face :o Make clean up and build - and there are still tons of references to the deleted unit to clean up.
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

cdbc

  • Hero Member
  • *****
  • Posts: 1497
    • http://www.cdbc.dk
Re: Bug? Non-existing unit doesn't break compiliation
« Reply #3 on: June 28, 2024, 02:40:47 pm »
Hi
Say you've bought a library of components(the cheap one without sources), you then install said package/library and finally you use it in your programs...
This all works very well because of that bug feature you mention, it makes it possible to compile without the sources present, only the ppu/o-files.
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

 

TinyPortal © 2005-2018