Forum > Linux

Random "Codetools errors"/"unit not found StdCtrls" on fresh install 2.2.6 / deb

(1/2) > >>

NonSpillable:
After upgrading to Debian 12 I do as I always do and Lazarus is among the first packages I install.

The IDE works, for a moment, but behaves oddly in two ways. First, it start to throw
Codetools, Errors: 1
main.pas(8,76) Error: unit not found: StdCtrls
in the Message box. I can compile, I can run. But I cannot add things on the form and clicking on methods. It gives the warning dialog
"Unable to create new method. Please fix the error shown in the message window which is normally below the source editor. Press OK to ignore and risk data corruption. Press Abort to kill the program." (If I press "Abort" I get "Access violation")

It usually happens when code completion is "running" in the editor, and instead of showing parameters for a function (etc), the editor jumps to the "uses" line in the code and show the error.

Restarting the IDE gives me a few minutes of useful work, before it happens again. I still can compile and run when this happens.

The second problem is random high CPU utilization of bin/lazarus during idle.

Here what I've tried so far:
Removing and reinstalling via synaptic/apt.
Tools->Rescan FPC Source Directory
Tools->Rebuild Lazarus with profile (I've tried "Normal" and "Clean up + Build all")

Any suggestions? Any logs/files/outputs from me that can assist to diagnose and/or solve the problem?

Martin_fr:
I can just add a few guesses...

High CPU: start your lazarus from a terminal/console => then it may write debug output to the console. Maybe there is anything of interest in there.

Codetools: Have you got any 3rd party packages? Some use features of the Pascal language that codetool does not yet have (certain generics...).
Make sure you have no old files of an earlier fpc or lazarus installation.

cdbc:
Hi
I had that particular problem once...
In my case the root of the problem was a "double Free" deeply nested in my own code. But hunting for the reason always threw me deep in the implementation of lclQt?!? (the font-cache), and sometimes "uses"/"StdCtrls". Had nothing whatsoever to do with that... Errors like that can be wimsy and hard to find, that one got me at least 100 new gray hairs  :D
Regards Benny

dseligo:

--- Quote from: NonSpillable on August 09, 2023, 08:17:39 pm ---Codetools, Errors: 1
main.pas(8,76) Error: unit not found: StdCtrls
in the Message box. I can compile, I can run. But I cannot add things on the form and clicking on methods. It gives the warning dialog
"Unable to create new method. Please fix the error shown in the message window which is normally below the source editor. Press OK to ignore and risk data corruption. Press Abort to kill the program." (If I press "Abort" I get "Access violation")

It usually happens when code completion is "running" in the editor, and instead of showing parameters for a function (etc), the editor jumps to the "uses" line in the code and show the error.

Restarting the IDE gives me a few minutes of useful work, before it happens again. I still can compile and run when this happens.

--- End quote ---

Sometimes I have the very similar problem with 2.2.6 under Windows 11, but only when creating new project.
If this happens and I add button to the form, button is created on the form, but line 'Button1: TButton;' is not inserted in unit's code.

Then I close Lazarus and start it again. After that it all works (unlike your problem - it works only for a few minutes for you).

Martin_fr:
In general terms, there is a know issue ("know" as in "has been observed", but not "why it happens").

This issue does cause such random errors, but usually only once in a very long time (once a month, if using the IDE daily). This issue has been around for many years (and despite various efforts the reason has not been found).

For it to happen every few minutes is new / different. => It most likely means that you have a source/pascal file somewhere, either in the wrong place, or with new fpc syntax that isn't supported by codetools.

Or you have some package installed in your IDE that is broken (could be any random package, totally unrelated to codetools and sources). If that package has a bug and causes memory to be incorrectly changed.

Or you recompiled your IDE with settings that trigger a bug in FPC.
Unfortunately the current released FPC (3.2.2) has some such bugs.

Rebuild your IDE with -O-1  and see if that improves anything.
(This is only if you did rebuild / e.g. when installing packages)

Navigation

[0] Message Index

[#] Next page

Go to full version