Recent

Author Topic: Build failure  (Read 2950 times)

n7800

  • Sr. Member
  • ****
  • Posts: 406
Re: Build failure
« Reply #30 on: June 16, 2025, 08:15:02 pm »
The error messages were sometimes similar to the Utf8 errors but not necessarily
the same message. Several wouldn't compile because the compiler couldn't find Interfaces which is in the old program's uses section.

The error "Error: Can't find unit Interfaces used by Project1" indicates that the project does not specify a dependency on LCL.

Open "Main Menu > Project > Project Inspector", and right-click on "Required Packages", select "Add" and specify LCL. It should look like the attached screenshot.

This may also explain the error with LazUtils, since LCL depends on LazUtils, and is automatically connected to the project.

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: Build failure
« Reply #31 on: June 17, 2025, 12:20:11 am »
    n7800, LCL is already there. There is already a dependency for LCL but I still previously got the Interfaces error.
    I'm using Lazarus 4.0 32-bit version right now.
    I made some changes and now I no longer get the Interfaces error but I still get that darn Utf8 error.
    By the way, in my searches and tests I found this nugget: I found out that in some cases it's possible to have two
different Lazarus versions on the same machine, even if neither has been installed under the secondary installment option.
    If the following command is typed into the Command Prompt then the chosen Lazarus version will run with no conflicts
between it and the other version.

lazarus.exe --args "--pcp=~/.lazarus-2.2.6.0"

    Does anyone think that if I again try to remove all references to Utf8 in the code and also take it out of the uses section
that it would help? Is it required? The code uses numerous Utf8 statements to handles text and strings but I think that
every one of them can be replaced with a different tool.

    I really would appreciate it if someone would answer the question above. Thanks.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11487
  • Debugger - SynEdit - and more
    • wiki
Re: Build failure
« Reply #32 on: June 17, 2025, 12:28:05 am »
lazarus.exe --args "--pcp=~/.lazarus-2.2.6.0"

That line looks like its cut out of a gdb command line or similar.

But it is almost what it should be

On Linux
Code: Text  [Select][+][-]
  1. lazarus.exe  --pcp=~/.lazarus-2.2.6.0

On Windows
Code: Text  [Select][+][-]
  1. lazarus.exe  --pcp=c:\some\path\laz\config



You never answered if there was a copy of that file in your sources...

1)

Check if you have a file named winlazfileutils.inc anywhere in your project.

Don't check the file that opens when you click the message. => If there are 2 files of the same name, then the IDE may show you the wrong one.

If you do, then please report. And continue below (step 2)
(removing it likely will give you a new error.)


2)
Open "search in files" and search all files in your project (and or project directory) for the word
   winlazfileutils

If it is found, please report
- where it is found (unit name)
- a few lines of code surrounding it


user5

  • Sr. Member
  • ****
  • Posts: 414
Re: Build failure
« Reply #33 on: June 17, 2025, 01:01:07 am »
    I did a search for winlazfileutils.inc and found only one reference to it. You said to mention it if it was mentioned more
than once unless I'm mistaken. The only way that could happen would be if the two references were in different folders.
    I thank you for taking the trouble to respond.
    It looks like I may not be able to solve this problem, at least for now.
    Maybe some day a group with sharp minds like yours can fix it.
    For now, I may for backup purposes buy a refurbished XP machine that matches my old machine and then to duplicate the old setup.
    At least it runs fine on Windows 10. U might check out my new video on YouTube titled VirtualU Tour 4.
    I made a donation to the Forum just because you tried to help me so much.
    Thanks again.

PS: As a possible final request, could someone please tell me if removing all references to Utf8 might help?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11487
  • Debugger - SynEdit - and more
    • wiki
Re: Build failure
« Reply #34 on: June 17, 2025, 01:36:05 am »
If you have a reference to it outside the lazarus/components/lazutils directory, then that reference is the problem.

The winlazfileutils can only be ok, when it is referenced by the files in lazutils. Any other reference is a problem.

If it is referenced like that, and you remove that, then other errors will come up. They can likely be fixed by adding some units to uses clauses.

dbannon

  • Hero Member
  • *****
  • Posts: 3425
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Build failure
« Reply #35 on: June 17, 2025, 04:54:00 am »
....
PS: As a possible final request, could someone please tell me if removing all references to Utf8 might help?

user5, if the "utf8" error you refer to is the one in the image posted in the other thread, its NOT a utf8 error. The error is that the compiler is not finding the definition of a constant called "lrsUnableToCreateConfigDirectoryS". That constant is defined in a unit LazUtilsStrConsts (and has some 70 other definitions) that exits in the file /SOMEPATH/lazarus_4_0/components/lazutils/lazutilsstrconsts.pas on my system.

You should be able to find that definition, on your system with a couple of simple steps -

  • Look in the unit that does not compile (Lazarus will have opened it for you).
  • Scroll up to where you added  "LazUtilsStrConsts" to its uses clause. Cannot see it ? thats your problem ! See previous instructions.
  • Hover the mouse over that entry, "LazUtilsStrConsts", when you do so, a yellow box will pop up and show a link to the file. Examine that link (before you click it) and ensure its path is to the Lazarus install you expect (and its not in your project files).
  • Click that link, it will open that file, scroll down until you see a line that looks like -
Code: Pascal  [Select][+][-]
  1. lrsUnableToCreateConfigDirectoryS = 'Unable to create config directory "%s"';

Make sure its there, that you can see it and its not greyed out. If any of those steps fail, thats the problem.

If all those tests are passed, we really need to see that image of the error again !

----

PS I strongly recommend starting Lazarus with that --pcp= switch, make a directory up in c:\ called LazConfigs and put your Lazarus installs in, eg C:use, eg c:\Lazarus

Code: [Select]
$> cd C:\Lazarus\lazarus_4_0
$> .\lazarus --pcp=c:\LazConfigs\lazarus_4_0

This will ensure some certainty when you have multiple lazarus installs (but be careful of taking Windows advice from a Linux user!).

Davo
« Last Edit: June 17, 2025, 04:59:53 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: Build failure
« Reply #36 on: June 17, 2025, 11:20:35 pm »
    Sorry that I didn't respond sooner. I had some illness.
    dbannon, I did my best to follow your instructions. I scrolled up as you suggested in winlazfileutils.inc where the error
message was shown. This document had no uses clause so I opened the main form of my program because at someone's
suggestion (was it you?) I put lazutilsstrconsts in its uses clause.
    I then opened lazutilsstrconsts.pas which only had 37 lines and contained the stuff shwon below.
    lrsUnableToCreateConfigDirectoryS etc. was not there.
    Your statement that this is not a Utf8 error was important.
    What do I do now? Duh.

Code: Pascal  [Select][+][-]
  1. unit LazUtilsStrConsts;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. resourceString
  8.   rsModified = '  modified ';
  9.   sInvalidCharSet = 'The char set in mask "%s" is not valid!';
  10.   rsSize = '  size ';
  11.  
  12. implementation
  13.  
  14. end.



user5

  • Sr. Member
  • ****
  • Posts: 414
Re: Build failure
« Reply #37 on: June 17, 2025, 11:39:19 pm »
    Is there hope here for a solution? Your analyses affected me strangely. Please don't get my hopes up.

dseligo

  • Hero Member
  • *****
  • Posts: 1535
Re: Build failure
« Reply #38 on: June 17, 2025, 11:47:30 pm »
    I did a search for winlazfileutils.inc and found only one reference to it. You said to mention it if it was mentioned more
than once unless I'm mistaken. The only way that could happen would be if the two references were in different folders.

So is 'winlazfileutils.inc' in your project directory or is it only in your_lazarus_installation_directory\components\lazutils?
Check also that 'lazfileutils.pas' and 'lazutils_defines.inc' are not in your project directory.

cdbc

  • Hero Member
  • *****
  • Posts: 2266
    • http://www.cdbc.dk
Re: Build failure
« Reply #39 on: June 17, 2025, 11:47:55 pm »
Hi
Why don't you just add that resourcestring to that file and see what happens?!?
...or just add a string constant with that name in your unit and see what happens...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 3.6 up until Jan 2024 from then on it's both above &: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 4.99

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11487
  • Debugger - SynEdit - and more
    • wiki
Re: Build failure
« Reply #40 on: June 17, 2025, 11:48:18 pm »
The unit LazUtilsStrConsts that you show in your post => that is from 2012.

So that means, somewhere in your project are copies of files that came with Lazarus 1 or 1.2  (or something of this range).

And they don't compile with the latest Lazarus, because there are new units of the same name.

Or your setup is mixing between your different Lazarus installations.
(You can check the path of that file, that you copied...)




If it is in your project:

You could try to remove those "copied files" => if your own units start using the files that come with Lazarus then they likely wont need those copies. (if you do, also remove the ppu for them)

I don't know what other files you may have copied.

Of course there are chances that something got renamed, then you need to see what other errors you get, and update your project.
« Last Edit: June 17, 2025, 11:54:31 pm by Martin_fr »

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: Build failure
« Reply #41 on: June 18, 2025, 12:15:08 am »
    Could there have been some minor difference between Lazarus 1.0.10.0 and all the other versions which something in my
code expoited? That old version was what I learned with after I made the jump from Turbo.
    I'm not proud of much of my early coding but the later stuff was better.
    I'm just groping here.
    dseligo, I am pondering what you said. I hope that it's not over my head.
    cdbc, I will do as you suggest and will report back. By the way, how do you suggest that I do that? I'm unsure of the syntax and
just how to word it. You have the code that I attached. How would you do that?
    Martin_fr, I am pondering what you said. Ditto.

dbannon

  • Hero Member
  • *****
  • Posts: 3425
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Build failure
« Reply #42 on: June 18, 2025, 02:53:42 am »
Yes user5, its quite likely that during the initial development, you were unhappy with the contents of one of the original (2012) Lazarus files. So, you copied it to your project directory and edited it as necessary. The build process looks in your project dir first, finds it and looks no further.

Repeating things already said, for emphasis and clarity!

It sounds to me like you have both winlazfileutils.inc and lazutilsstrconsts.pas in your project directory ?  Hover the mouse of its tab in the IDE, it should show you the path to that file. These are files that belong in the Lazarus source tree, NOT your project directory.

You should, probably, try to eliminate all those 'imports', one by one or any upgrade to Lazarus will be a nightmare.  So, close the project, starting with the one just identified,  rename (or move elsewhere) each import and try and resolve the problems that introduces. Comparing the content of your import to the Lazarus 4.0 one might be useful. Please do it one by one, close the project, rename the file, open the project, compile. There will be errors, particularly the one that the import dealt with, find a better way to fix it.

Remember what I said above "Hover the mouse over that (uses) entry, when you do so, a yellow box will pop up and show a link to the file. Examine that link (before you click it) and ensure its path is to the Lazarus install you expect (and its not in your project files)".  You need to end up with only your files in the project directory.

You could, perhaps, just workaround the problem, adding the missing definition to your imported files for example but honestly, that would be a fools paradise, might seem to work but is just making the problem worse.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: Build failure
« Reply #43 on: June 18, 2025, 03:08:31 am »
    cdbc, I did as you suggested. I possibly opened the wrong file before but I opened LazUtilsStrConsts.pas,
put in lrsUnableToCreateConfigDirectoryS = 'Unable to create config directory "%s"'; with the other const
declarations and then saved and ran it. I got an error message so I took it back out, ran it again and the error
that I got is shown in the attachment.

user5

  • Sr. Member
  • ****
  • Posts: 414
Re: Build failure
« Reply #44 on: June 18, 2025, 03:29:59 am »
    dbannon, I don't remember ever daring to alter a Lazarus file.
    You are correct on one of the files. lazutilsstrconsts.pas IS in my project directory but winlazfileutils.inc is not.
    winlazfileutils.inc is in the Lazarus components folder.
    From what I understand, I need to take lazutilsstrconsts.pas out from my project. My search for that file showed
that it did not exist anywhere but in my project folder. Is it supposed to be located in Lazarus somewhere?

 

TinyPortal © 2005-2018