LPK: Cannot find a unit which exists lazarus / 21-General ---------------------------------------------------------------------- CM630 · 2025-05-09 21:12 There is  package: https://github.com/URUWorks/TeroSubtitler/tree/main/TeroSubtitler/subt itleapi Sometimes I can install it, sometimes it does not install, but I can COMPILE. The trouble is that in some cases it says: QuoteUWSubtitleAPI.Formats.SubRip.pas(13,47) Error: Can't find unit UWSubtitleAPI.Formats.SubRip used by UWSubtitleAPIIt 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 . ---------------------------------------------------------------------- CM630 · 2025-05-20 07:21 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. ---------------------------------------------------------------------- Thaddy · 2025-05-20 08:51 Did you check your fpc.cfg and did you check the correct one? ---------------------------------------------------------------------- CM630 · 2025-05-20 10:29 Quote from: Thaddy on May 20, 2025, 10:51:38 amDid 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? ---------------------------------------------------------------------- marcov · 2025-05-20 11:52 Here it works on win32 (FPC 3.3.1).  (open controls.lpk, compile, leave it open, open subtitleapi.lpk and compile). ---------------------------------------------------------------------- CM630 · 2025-05-20 12:37 Quote from: marcov on May 20, 2025, 01:52:07 pmHere 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. ---------------------------------------------------------------------- Thaddy · 2025-05-20 13:32 That is a wrong fpc.cfg......I told you that. Send the fpc.cfg here. ---------------------------------------------------------------------- CM630 · 2025-05-20 13:43 Here it is. I only changed its extension to .txt due to forum limitations. ---------------------------------------------------------------------- Fred vS · 2025-05-20 14:16 Quote from: CM630 on May 20, 2025, 03:43:17 pmHere 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 ---------------------------------------------------------------------- Thaddy · 2025-05-20 14:18 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) ---------------------------------------------------------------------- marcov · 2025-05-20 14:26 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. ---------------------------------------------------------------------- Thaddy · 2025-05-20 14:28 Because the paths are wrong.... :'( :'( ---------------------------------------------------------------------- Fred vS · 2025-05-20 14:29 Quote from: Thaddy on May 20, 2025, 04:18:58 pmDo 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. ---------------------------------------------------------------------- TRon · 2025-05-20 14:38 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. ---------------------------------------------------------------------- CM630 · 2025-05-20 14:45 Quote from: marcov on May 20, 2025, 04:26:37 pmI 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. Quote from: Fred vS on May 20, 2025, 04:16:39 pmQuote from: CM630 on May 20, 2025, 03:43:17 pmHere 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. ---------------------------------------------------------------------- CM630 · 2025-05-20 18:51 About MacOS, the answer is "most likely the same behaviour, as long a I remeber it always behaved this way". The forum indicates that the sample is dowlnoaded 3 times, @Marcov says it behaves the way for him, I wonder if it worked for somebody else? ---------------------------------------------------------------------- n7800 · 2026-06-20 17:06 It appears the issue wasn't with the configuration file or the package's registration in the IDE, but rather with circular references (see discussion). The package author refactored the units, and the build is now fixed. ---------------------------------------------------------------------- Thaddy · 2026-06-23 08:23 After checking that, and I filed a related bug report for that a few weeks ago, there was a bug building for scoped units. ---------------------------------------------------------------------- CM630 · 2026-06-24 05:47 It is good that the issue is fixed now, it was really pestilent. But if it is a bug in Lazarus, as @Thaddy said, it would better be fixed, before someone steps on the same hoe. Quote from: Thaddy on June 23, 2026, 10:23:38 amAfter checking that, and I filed a related bug report for that a few weeks ago, there was a bug building for scoped units. Could you post a link to the bug report?