Recent

Author Topic: [SOLVED] Linux: Cannot use autocomplete because of Unit Not Found  (Read 469 times)

CM630

  • Hero Member
  • *****
  • Posts: 1593
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Lazarus 4 on Linux Mint Mate.

In an old project running so far only in Windows I cannot use Autocomplete, and Find declaration of... when using the IDE in Linux.
When I try to use autocomplete (etc) I get "Unit xxx not found...".
I tried rearranging the units, each time a different unit is blamed.
The blamed unit is always one of the Lazarus/FPC units, never a unit which is a part of the project. Actually, it seems that the last Lazarus/FPC unit in the UNIT list is the not-found one.
There is another odd thing - I can use autocomplete in the UNUT section, but the names of the units offered are always lowercase (lazutif8, instead of LazUTF8). I have created a new project, in it when I use autocomplete there the names of the units are with the proper case.

The project builds and works.
Maybe something in the LPI or the LPR files is wrong?
« Last Edit: May 30, 2025, 11:02:09 am by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

cdbc

  • Hero Member
  • *****
  • Posts: 2599
    • http://www.cdbc.dk
Re: Linux: Cannot use autocomplete because of Unit Not Found
« Reply #1 on: May 30, 2025, 10:23:09 am »
Hi
Nope!
Your problem lies in 'Access Rights', most Linux/Unix OS' install apps & programs in 'ReadOnly' Root-space, i.e.: Administrator / SuperUser restricted.
You can probably read and execute in 'root-space', as a normal user, but not much more. This is safety, for the system and for you.
Lazarus tries to circumvent this by creating a 'shadow-path' in your /home/you/.lazarus/ directory, where it (and you) has /write-rights/, in the case of recompiling etc...
>> It does not always work as advertized <<  %)
There are 3 possible ways to solve this:
- Install FPC & Lazarus from source in your /home/you/ directory
- Use 'FpcUpDeluxe' to install both in your /home/you/ directory
- In commandprompt
--> su to root
--> cd into /usr/lib64/
--> chmod 777 -R lazarus
----> in lazarus -> recompile lazarus itself
--> chmod 644 -R lazarus
(!) DO NOT LEAVE LAZARUS DIR 777 (!) It's unsafe!!!

Sometimes I've had luck with creating an 'alias' file for the uses clause, but this approach is more like a 'crap-shoot'  :D
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

Thaddy

  • Hero Member
  • *****
  • Posts: 18726
  • To Europe: simply sell USA bonds: dollar collapses
Re: Linux: Cannot use autocomplete because of Unit Not Found
« Reply #2 on: May 30, 2025, 10:42:07 am »
Better option:
sudo groupadd fpcusers
sudo usermod -aG fpcusers $USER
sudo chgrp -R fpcusers /usr/lib/fpc /usr/share/lazarus
sudo chmod -R g+rw /usr/lib/fpc /usr/share/lazarus

Now fpc and lazarus users can access the units without using sudo.
The same can be achieved with symlinks, but that is slightly more permissive.

This may be debian based distributions specific. I have little knowledge of other distributions, but this should work for debian, ubuntu, mint and the likes.

(Put those lines in a shellscript if you want.)
« Last Edit: May 30, 2025, 10:47:29 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

cdbc

  • Hero Member
  • *****
  • Posts: 2599
    • http://www.cdbc.dk
Re: Linux: Cannot use autocomplete because of Unit Not Found
« Reply #3 on: May 30, 2025, 10:52:59 am »
Hi
Thanks Thaddy, I don't speak 'debian' ...and for the cli-tips  ;)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

CM630

  • Hero Member
  • *****
  • Posts: 1593
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Linux: Cannot use autocomplete because of Unit Not Found
« Reply #4 on: May 30, 2025, 11:01:48 am »
...
sudo groupadd fpcusers
sudo usermod -aG fpcusers $USER
sudo chgrp -R fpcusers /usr/lib/fpc /usr/share/lazarus
sudo chmod -R g+rw /usr/lib/fpc /usr/share/lazarus
...
Thanks, I did it this way.
Now Autocomplete, and Find declaration of... work!
Thanks!
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

 

TinyPortal © 2005-2018