Recent

Author Topic: LPK: Cannot find a unit which exists  (Read 1285 times)

CM630

  • Hero Member
  • *****
  • Posts: 1652
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
LPK: Cannot find a unit which exists
« on: May 09, 2025, 11:12:31 pm »
There is  package:
https://github.com/URUWorks/TeroSubtitler/tree/main/TeroSubtitler/subtitleapi
Sometimes I can install it, sometimes it does not install, but I can COMPILE.
The trouble is that in some cases it says:

Quote
UWSubtitleAPI.Formats.SubRip.pas(13,47) Error: Can't find unit UWSubtitleAPI.Formats.SubRip used by UWSubtitleAPI
It also cannot find multiple other files, but they exist.

This is the content of UWSubtitleAPI.pas: https://github.com/URUWorks/TeroSubtitler/blob/main/TeroSubtitler/subtitleapi/UWSubtitleAPI.pas

It references the "missing" files in the USES which is in the implementation section.
The same "missing" files reference UWSubtitleAPI.pas in their main USES sections.

I tried to reverse the reference order, but for some known reasons it is not possible.
Maybe someone can point me a way out?

The author of the component (currently) cannot help .



Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

CM630

  • Hero Member
  • *****
  • Posts: 1652
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: LPK: Cannot find a unit which exists
« Reply #1 on: May 20, 2025, 09:21:32 am »
I created a sample 7z, to illustrate the case in an easier way (attached).
1. Download the package and unzip it.
2. Open all 3 .lpk files in lazarus (just open, nothing more).
3. One of them needs fpsspreadsheets, right click and install it online.
4. Try to install uwcommon.lpk, which is already open in step 2.
It says that some of the files in the Uses of subtitleapi.lpk is missing. The file is there.
If I rearrange the files listed in Uses, it complains that some other file is missing, which is also a lie.

It is not a new problem (also present in older releases of Lazarus), it is observed in Windows and Linux, I can ask if it occurs in macOS, too, but I guess this info it is not important.
« Last Edit: May 20, 2025, 09:23:50 am by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

Thaddy

  • Hero Member
  • *****
  • Posts: 18795
  • Glad to be alive.
Re: LPK: Cannot find a unit which exists
« Reply #2 on: May 20, 2025, 10:51:38 am »
Did you check your fpc.cfg and did you check the correct one?
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

CM630

  • Hero Member
  • *****
  • Posts: 1652
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: LPK: Cannot find a unit which exists
« Reply #3 on: May 20, 2025, 12:29:07 pm »
Did you check your fpc.cfg and did you check the correct one?

The component is created by a person which I believe has a much, much better knowledge and skills in Lazarus than me (he has switched from Delphi).
He did not succeed in fixing the issue, possibly he decided to pay attention to higher priority tasks, possibly he cannot find what is wrong, too.
So if both of us have the same problem with various computers and OSes, the fault should not be in fpc.cfg?
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12720
  • FPC developer.
Re: LPK: Cannot find a unit which exists
« Reply #4 on: May 20, 2025, 01:52:07 pm »
Here it works on win32 (FPC 3.3.1).  (open controls.lpk, compile, leave it open, open subtitleapi.lpk and compile).

CM630

  • Hero Member
  • *****
  • Posts: 1652
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: LPK: Cannot find a unit which exists
« Reply #5 on: May 20, 2025, 02:37:18 pm »
Here it works on win32 (FPC 3.3.1).  (open controls.lpk, compile, leave it open, open subtitleapi.lpk and compile).
Yes, if I get you right, that is what I wrote in my first post.
It needs Compile, it does not work __without__ Compile (you cannot do only 'Install' or install a component, which uses subtitleapi.lpk).

This actually spoils the entire Lazarus, because whenever I need to install an .LPK or "Main Menu -> Run -> Clean up and Build", I need to open that subtitleapi.lpk and compile it.
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

Thaddy

  • Hero Member
  • *****
  • Posts: 18795
  • Glad to be alive.
Re: LPK: Cannot find a unit which exists
« Reply #6 on: May 20, 2025, 03:32:58 pm »
That is a wrong fpc.cfg......I told you that. Send the fpc.cfg here.
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

CM630

  • Hero Member
  • *****
  • Posts: 1652
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: LPK: Cannot find a unit which exists
« Reply #7 on: May 20, 2025, 03:43:17 pm »
Here it is.
I only changed its extension to .txt due to forum limitations.
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

Fred vS

  • Hero Member
  • *****
  • Posts: 3835
    • StrumPract is the musicians best friend
Re: LPK: Cannot find a unit which exists
« Reply #8 on: May 20, 2025, 04:16:39 pm »
Here it is.
I only changed its extension to .txt due to forum limitations.

Are you using fpc and Lazarus on Linux installed from fpcupdeluxe?
If so (like already explained) or remove /etc/fpc.cfg or rename it /etc/fpc.cfg.old
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Thaddy

  • Hero Member
  • *****
  • Posts: 18795
  • Glad to be alive.
Re: LPK: Cannot find a unit which exists
« Reply #9 on: May 20, 2025, 04:18:58 pm »
Do not remove /etc/fpc.cfg but remove all others.
/etc/fpc.cfg *should* be the correct one.

This is a common mistake and is simply wrong, except if you would have used fpcupdeluxe. fpcupdeluxe is able to setup multiple versions of fpc/lazarus at the same time but a proper install is just /etc/fpc.cfg.
You should possibly edit the paths to the libraries inside /etc/fpc.cfg.

The mistake comes because of currently any uninstall will leave the /etc/fpc.cfg intact.
(which is, frankly, a bug)
« Last Edit: May 20, 2025, 04:27:21 pm by Thaddy »
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12720
  • FPC developer.
Re: LPK: Cannot find a unit which exists
« Reply #10 on: May 20, 2025, 04:26:37 pm »
I think his issue is with recursively compiling required packages.  But how would the IDE find the package when not registered and not opened ?

You can hack around with some -Fu's in the fpc.cfg, but that circumvents packages. It doesn't fix it. The beauty of packages is no hardcoded paths in projects or uses , and the modules can be moved around.
« Last Edit: May 20, 2025, 04:28:16 pm by marcov »

Thaddy

  • Hero Member
  • *****
  • Posts: 18795
  • Glad to be alive.
Re: LPK: Cannot find a unit which exists
« Reply #11 on: May 20, 2025, 04:28:02 pm »
Because the paths are wrong.... :'( :'(
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

Fred vS

  • Hero Member
  • *****
  • Posts: 3835
    • StrumPract is the musicians best friend
Re: LPK: Cannot find a unit which exists
« Reply #12 on: May 20, 2025, 04:29:35 pm »
Do not remove /etc/fpc.cfg remove all others.
/etc/fpc.cfg *should* be the correct one.
This is a common mistake, except if you would have used fpcupdeluxe.

Hello Thaddy,

FPC uses this order to find the fpc.cfg file:

If /etc/fpc.cfg exists, load it; otherwise, load it from /home/theuser/.fpc.cfg.
fpcupdeluxe has its own fpc.cfg file in /home/theuser/.
So, if an /etc/fpc.cfg file is present, it will be loaded instead of the fpcupdeluxe fpc.cfg.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

TRon

  • Hero Member
  • *****
  • Posts: 4377
Re: LPK: Cannot find a unit which exists
« Reply #13 on: May 20, 2025, 04:38:52 pm »
You're both wrong.

FPCUpDeluxe forces the use of the correct fpc.cfg file. Lazarus requires always to use the script as compiler and not the executable).

However, what FPCUpDeluxe can't fix is the makefile picking up on other compilers/configurations. At least afaik there isn't a mechanism present in Lazarus that is able to force these parameters to the makefile when doing a rebuild.

So it is either one or the other, not both a FPCUpDeluxe and a system install.
« Last Edit: May 20, 2025, 04:41:24 pm by TRon »
Today is tomorrow's yesterday.

CM630

  • Hero Member
  • *****
  • Posts: 1652
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: LPK: Cannot find a unit which exists
« Reply #14 on: May 20, 2025, 04:45:48 pm »
I think his issue is with recursively compiling required packages.  But how would the IDE find the package when not registered and not opened ?

You can hack around with some -Fu's in the fpc.cfg, but that circumvents packages. It doesn't fix it. The beauty of packages is no hardcoded paths in projects or uses , and the modules can be moved around.
What I noticed is that the units, which are cross-referenced (Uses) within the same package, are not found. The other are founds.
For example UWSubtitleAPI.pas has in its implementation uses multiple files.
The ones which do not reference UWSubtitleAPI.pas are found.
The ones which reference UWSubtitleAPI.pas (in their Uses sections) are not found.





Here it is.
I only changed its extension to .txt due to forum limitations.

Are you using fpc and Lazarus on Linux installed from fpcupdeluxe?
If so (like already explained) or remove /etc/fpc.cfg or rename it /etc/fpc.cfg.old

No, I do not use fpcupdeluxe, neither on Windows, nor on Linux (I tried it with no success).
Just direct install. I asked whether it is observed in MacOS, I will add the info when/if I get it.

And since the issue also occurs on Windows, there is no /etc/fpc.cfg.
« Last Edit: May 20, 2025, 04:50:29 pm by CM630 »
Лазар 4,4 32 bit (sometimes 64 bit); FPC3,2,2

 

TinyPortal © 2005-2018