Thank you all for taking the time to reply.
As a heads-up, I might be a bit sporadic with providing feedback because the issue itself is somewhat sporadic. I had it happen all day yesterday and the day before that, but it hasn't popped up again today.
Nel, I'd suspect a software issue but as no one else has (yet) reported such an issue, I'd doubt it. And you sound sure its not your code ?
What are you running (FPC ver and Lazarus ver) and on what hardware ?
Compiling often uses a lot of memory. Sometimes, memory that is rarely used. So, next I'd run a aggressive memory checker. Not one of the short, few minute things, a multiple combination, sloooow one. Expect as much as an hour to be sure.
Most linux ISOs have a memory checker available in their boot up menu.
I hope that is not the answer ....
Davo
I mean, it could be my code causing the issue for all I know, but if it is, it's not in a way that Lazarus and its error-spotting mechanisms seem to catch. The closest to a hint for a potential cause that I've come across once, a few weeks back, involved a particular unit being in the "uses" list of another unit's implementation section: moving it up to interface somehow seemed to fix the problem. At the time, I thought that this was the cause of the issue. But then it started happening in other unrelated situations as well, so it doesn't seem like that was it.
But if it really is my code, then why would changing something like the optimization level fix it for a single run?
I'm going to echo @dbannon's comments.
Any kind of problem report should be accompanied by the Lazarus and FPC versions.
The capricious behavior of the problem you described does raise a good possibility that there might be a hardware problem, likely memory as pointed out by @dbannon. To be on the safe side, I'd check the hard drive and file system too.
Start by posting the FPC and Lazarus version.
HTH.
Which Lazarus/FPC versions are you using? I do remember that there was a time when compilation did not terminate under some unclear circumstances; I've never seen this for a long time, though.
To start with, here's everything on my version of Lazarus, FPC, and system:
Lazarus 3.99 (rev main_3_99-2836-gdfce0d15a4)
FPC 3.3.1 x86_64-linux-gtk2
## Hardware Information:
- **Hardware Model:** Gigabyte Technology Co., Ltd. F2A88X-D3H
- **Memory:** 16,0 GiB
- **Processor:** AMD Athlon™ X4 860K Quad Core × 4
- **Graphics:** NVIDIA GeForce RTX™ 3050
- **Disk Capacity:** 3,1 TB
## Software Information:
- **Firmware Version:** F6
- **OS Name:** Ubuntu 24.04.1 LTS
- **OS Build:** (null)
- **OS Type:** 64-bit
- **GNOME Version:** 46
- **Windowing System:** X11
- **Kernel Version:** Linux 6.8.0-48-generic
--------
I did two passes on Memtest yesterday and found no errors. How many passes would you recommend for it to be conclusive?
Also, what tools should I use to check on the hard drive and file system?
When looking at the output, use the context menu "copy all/original messages". That may give additional info.
I am not sure though if you will get much useful info.
Once you had the problem, does Lazarus still show "compiling" or does it show the compilation ended? => If I read you correctly it will say it's still compiling?
Does the fpc process still run?
Someone reported a similar issue recently (IIRC here on the forum). But if the compiler goes into an endless loop, then that will be hard to narrow down.
https://forum.lazarus.freepascal.org/index.php/topic,69067.0.html
I guess the difference you get when changing compiler settings (or doing a clean build) is how other units are handled. I.e. if the code of other units was loaded from ppu, or gotten compiled from source. One fpc process will compile all units (in the project, not packages), but only those that it can't load from ppu.
The result *should* be the same, but at the very least mem layout will differ, maybe something else in your case...
Okay, I'll give the context menu of Messages a try once it happens again.
Yes, I'll double-check next time, but everything about the process seemed normal and labelled as still "Compiling", just that it was stuck at a specific step and not making any progress.
I didn't think about checking on the compiler's process in the system monitor, I'll do that the next time it happens.
Is TS perhaps compiling from/on a remote/external drive (dropbox, VM share) ?
No, everything is local to my system: Lazarus, FPC and all files used by the project.