Recent

Author Topic: Cannot find StrUtils used by LazUTF8  (Read 2686 times)

daniel_sap

  • Jr. Member
  • **
  • Posts: 64
Cannot find StrUtils used by LazUTF8
« on: December 14, 2022, 10:59:43 pm »
Hi,

I'm trying to compile an application and compiler outputs this message

lazutf8.pas(36,22) Fatal: Cannot find StrUtils used by LazUTF8. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=C:\lazarus64\fpc\3.2.2\units\x86_64-win64\rtl-objpas\strutils.ppu..

The Lazarus version is 2.2.4 x86_64-win64-win32/win64
with FPC Version 3.2.2

Any help will be appreciated. Some directions how to approach this issue too.
Thank you

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Cannot find StrUtils used by LazUTF8
« Reply #1 on: December 14, 2022, 11:56:38 pm »
Any help will be appreciated. Some directions how to approach this issue too.
Fix first the "Duplicate Unit "Logic"...." things and than show another screenshot that shows your problem (if it still persist)
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

daniel_sap

  • Jr. Member
  • **
  • Posts: 64
Re: Cannot find StrUtils used by LazUTF8
« Reply #2 on: December 15, 2022, 01:26:16 am »
Thank you KodeZwerg
I fixed the issue with duplicate names and recompiled the IDE with Clear all, Normal
And then I tried again to compile the project and compiler returned the same error message

lazutf8.pas(36,22) Fatal: Cannot find StrUtils used by LazUTF8. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=C:\lazarus64\fpc\3.2.2\units\x86_64-win64\rtl-objpas\strutils.ppu..

I'm trying to identify some process, some steps which can lead me to identifying the issue.
May be to enable some extra compiler messages which will tell me in which package this happens and why.

For me C:\lazarus64\fpc\3.2.2\units\x86_64-win64\rtl-objpas\strutils.ppu is the proper place for strutils.ppu
cause I see it in the FPC source - "D:\fpcspace\fpc\packages\rtl-objpas\src\inc\strutils.pp"

May be I need to add this rtl-objpass path to fpc.cfg or somewhere else.
Also I don't see rtl-objpas package to be installed or available for installation in "Install/Uninstall packages"

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10551
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot find StrUtils used by LazUTF8
« Reply #3 on: December 15, 2022, 01:31:45 am »
For me C:\lazarus64\fpc\3.2.2\units\x86_64-win64\rtl-objpas\strutils.ppu is the proper place for strutils.ppu
cause I see it in the FPC source - "D:\fpcspace\fpc\packages\rtl-objpas\src\inc\strutils.pp"

Yes that should be the correct one (at least from what we have so far).

Have you searched, if there is another strutils.ppu anywhere?


Quote
May be I need to add this rtl-objpass path to fpc.cfg or somewhere else.
Also I don't see rtl-objpas package to be installed or available for installation in "Install/Uninstall packages"

Have you ever moved/renamed the lazarus folder?

Because, yes the path to strutils.ppu is in the fpc.cfg (well, it should be).
But if you rename/move any of the containing folders, then those paths are wrong (they are absolute).

You may be able to do a search replace in fpc.cfg, and update it.
Otherwise, to create a new one there is fpcmake.cfg. (I would have to check the commandline params....)



Though, on 2nd thought, if Lazarus did rebuild => then your fpc.cfg is fine.

So I would think, you have a 2nd sysutil.ppu, but for another compiler version, hence it can't be used.
« Last Edit: December 15, 2022, 01:33:55 am by Martin_fr »

daniel_sap

  • Jr. Member
  • **
  • Posts: 64
Re: Cannot find StrUtils used by LazUTF8
« Reply #4 on: December 15, 2022, 01:54:16 am »
Thank you Martin_fr

Quote
Have you ever moved/renamed the lazarus folder?

Because, yes the path to strutils.ppu is in the fpc.cfg (well, it should be).
But if you rename/move any of the containing folders, then those paths are wrong (they are absolute).

I didn't move or renamed the folders after the installation
c:\lazarus64
c:\lazarus64Config

And there is no second copy of strUtils in the installation folder or in my projects and components folder

Because the error says that
... Make sure all ppu files of a package are in its output directory
I'm also thinking in this direction, that some package is not ok(even if it's compiling successfully).
Not sure how to understand the error - May be some package or the application itself didn't put the ppu files in proper place.
Or the compiler prints this message when cannot find some ppu regardless of the reason.

Also, I created a new application and added all the packages ant it compiles fine.



Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10551
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot find StrUtils used by LazUTF8
« Reply #5 on: December 15, 2022, 02:07:14 am »
Compile with the option -va  (for the package LazUtils, since that it where the error happens).

Actually -vt should be enough, I just have in the past only tried -va ("a" = all, includes "t").

Fpc will output every file it tried, and why it did not take it.
Once you get the error, messages window > context menu > copy > copy all and original
This will be a ton of messages, paste them somewhere, and check the last maybe 50 entries.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10551
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot find StrUtils used by LazUTF8
« Reply #6 on: December 15, 2022, 02:16:26 am »
At the same time, lets follow up the fpc.cfg

Since you are on Windows, your fpc.cfg should contain the lines
Code: Text  [Select][+][-]
  1. # searchpath for units and other system dependent things
  2. -Fuc:\FPC\fpc_3.2.2\units/$fpctarget
  3. -Fuc:\FPC\fpc_3.2.2\units/$fpctarget/*
  4. -Fuc:\FPC\fpc_3.2.2\units/$fpctarget/rtl
  5.  

Only that instead of "c:\FPC\fpc_3.2.2\" it will have your path d:\lazarus64\fpc\3.2.2 or whatever it actually is.
The / vs \ aren't important. Either is fine.

Many other similar lines exist, but mostly commented "#", or in #IFDEF

daniel_sap

  • Jr. Member
  • **
  • Posts: 64
Re: Cannot find StrUtils used by LazUTF8
« Reply #7 on: December 16, 2022, 08:51:10 pm »
Thank you Martin_fr

I have the following lines in the fpc.cfg
# searchpath for units and other system dependent things
-FuC:\lazarus64\fpc\$FPCVERSION/units/$fpctarget
-FuC:\lazarus64\fpc\$FPCVERSION/units/$fpctarget/*
-FuC:\lazarus64\fpc\$FPCVERSION/units/$fpctarget/rtl

it looks these are the proper values

Quote
Compile with the option -va  (for the package LazUtils, since that it where the error happens).
LazUtils pack compiles successfully. It never fails the compilation, no matter if it is ide build or if I open the package and compile it.

But I added verbosity -va to the application and received the ton of messages

Quote
Fpc will output every file it tried, and why it did not take it.
Once you get the error, messages window > context menu > copy > copy all and original
This will be a ton of messages, paste them somewhere, and check the last maybe 50 entries.

it searches in other installation folder
D:\Programs\IDE\FpcUpDeluxeInstall\fpc\units\x86_64-win64
May be for these packages it takes the folder from different place


Bart

  • Hero Member
  • *****
  • Posts: 5465
    • Bart en Mariska's Webstek
Re: Cannot find StrUtils used by LazUTF8
« Reply #8 on: December 16, 2022, 10:17:22 pm »
This (wrong) path must be in your project options, since you stated that you were able to rebuild the IDE (and the IDE uses LazUtils package).

Bart

daniel_sap

  • Jr. Member
  • **
  • Posts: 64
Re: Cannot find StrUtils used by LazUTF8
« Reply #9 on: December 16, 2022, 10:55:43 pm »
Thank you Bart

I checked the options of the project in the Lazarus IDE and don't see this wrong path anywhere.
Also checked in the "lpr" and "lpi" files of the project - nothing there.

The only place I found this path is in the "lps" file of the project
Code: Pascal  [Select][+][-]
  1.       <Unit345>
  2.         <Filename Value="D:\Programs\FpcUpDelux\lazarus\lcl\controls.pp"/>
  3.         <UnitName Value="Controls"/>
  4.         <EditorIndex Value="-1"/>
  5.         <TopLine Value="2168"/>
  6.         <CursorPos Y="2189"/>
  7.         <UsageCount Value="29"/>
  8.         <DefaultSyntaxHighlighter Value="Delphi"/>
  9.       </Unit345>
  10.  

Code: Pascal  [Select][+][-]
  1.       <Unit350>
  2.         <Filename Value="D:\Programs\FpcUpDelux\lazarus\lcl\include\customlistbox.inc"/>
  3.         <EditorIndex Value="-1"/>
  4.         <TopLine Value="784"/>
  5.         <CursorPos X="3" Y="793"/>
  6.         <UsageCount Value="7"/>
  7.         <DefaultSyntaxHighlighter Value="Delphi"/>
  8.       </Unit350>
  9.  

Code: Pascal  [Select][+][-]
  1.     <BreakPoints>
  2.       <Item>
  3.         <Kind Value="bpkSource"/>
  4.         <WatchScope Value="wpsLocal"/>
  5.         <WatchKind Value="wpkWrite"/>
  6.         <Expression Value="AMessage.Msg = LM_KEYDOWN"/>
  7.         <Source Value="D:\Programs\IDE\FpcUpDeluxeInstall\lazarus\lcl\include\application.inc"/>
  8.         <InitialEnabled Value="False"/>
  9.         <Line Value="1425"/>
  10.       </Item>
  11.  

I'm not sure if this "lps" file will affect the build and tell the compiler to use the folder. (Especially the 3-rd one, which looks like a breakpoint info)

I start to think that for these fpc packages there is something shared between the installations.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10551
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot find StrUtils used by LazUTF8
« Reply #10 on: December 17, 2022, 12:36:02 am »
Maybe ask on the FpcUpDeluxe thread where FpcUpDeluxe may add such info.

From your messages
Code: Text  [Select][+][-]
  1. [1.156] (STRUTILS) (10002) PPU Name: D:\Programs\IDE\FpcUpDeluxeInstall\fpc\units\x86_64-win64\rtl-objpas\strutils.ppu
  2. [1.156] (STRUTILS) (10008) PPU Invalid Version 208
  3.  

"Invalid version" => the ppu it did found belongs to a different fpc version.


Strange so, also from the messages
Code: Text  [Select][+][-]
  1. [1.211] (10000) Unitsearch: C:\lazarus64\fpc\3.2.2\units\x86_64-win64\rtl\StrUtils.ppu
  2. [1.211] (10000) Unitsearch: C:\lazarus64\fpc\3.2.2\units\x86_64-win64\rtl\StrUtils.pp
  3. [1.211] (10000) Unitsearch: C:\lazarus64\fpc\3.2.2\units\x86_64-win64\rtl\StrUtils.pas
  4.  
That goes with what you found
I have the following lines in the fpc.cfg
# searchpath for units and other system dependent things
-FuC:\lazarus64\fpc\$FPCVERSION/units/$fpctarget
-FuC:\lazarus64\fpc\$FPCVERSION/units/$fpctarget/*
-FuC:\lazarus64\fpc\$FPCVERSION/units/$fpctarget/rtl
Only its just the last of those lines. So it misses "rtl-objpas" (which I assume is there, or not?).


Note, it may not be an include path.
It could also point to an alternate fpc.cfg file.

If you still have the full messages, check at the top. Somewhere it should say that it loads an fpc.cfg file. Then you can check if that contains the wrong path. (if its a diff fpc.cfg from what is used for building the IDE).

---
The path could be relative to the project, so search for substrings.




The "Unit" entries in the lps, are files that at some time were open in the editor.... (some of them long ago).

daniel_sap

  • Jr. Member
  • **
  • Posts: 64
Re: Cannot find StrUtils used by LazUTF8
« Reply #11 on: December 17, 2022, 12:54:30 pm »
Thank you Martin_fr

I will ask in the FpcUpDeluxe thread also.

Quote
Note, it may not be an include path.
It could also point to an alternate fpc.cfg file.

If you still have the full messages, check at the top. Somewhere it should say that it loads an fpc.cfg file. Then you can check if that contains the wrong path. (if its a diff fpc.cfg from what is used for building the IDE).

Yes, I keep all the messages, also can generate them again, cause the problem happens on every try to build the app (I attach first 4k lines here)
But cannot see in the messages info about the loading of fpc.cfg
I'm trying now to make sure it uses the proper fpc.cfg

The first occurrence of FpcUpDeluxe is here

Code: Pascal  [Select][+][-]
  1. [0.016] (11028) Handling option "-FuD:\Programs\IDE\FpcUpDeluxeInstall\lazarus\components\lazreport\source\lib\x86_64-win64"
  2. [0.016] (11032) interpreting option "-FuD:\Programs\IDE\FpcUpDeluxeInstall\lazarus\components\lazreport\source\lib\x86_64-win64"
  3. [0.016] (11028) Handling option "-FuD:\Programs\IDE\FpcUpDeluxeInstall\lazarus\components\virtualtreeview\lib\x86_64-win64-win32"
  4. [0.016] (11032) interpreting option "-FuD:\Programs\IDE\FpcUpDeluxeInstall\lazarus\components\virtualtreeview\lib\x86_64-win64-win32"
  5.  

So, I renamed the folder D:\Programs\IDE\ to D:\Programs\IDE7\ so now is completely impossible to access something inside it.
The errors are the same.
So, I start to think that
1. Before some time I installed these packages(components) in the D:\Programs\IDE\FpcUpDeluxeInstall\lazarus
2. After that I installed them in c:\lazarus64
3. Somehow packages still remember the old IDE installation and try to find it. (I will try to clean everything in the pacakges)
And from this
[0.016] (11028) Handling option "-FuD:\Programs\IDE\FpcUpDeluxeInstall\lazarus\components\lazreport\source\lib\x86_64-win64"
I think some package keeps the old info for lazreport

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: Cannot find StrUtils used by LazUTF8
« Reply #12 on: December 17, 2022, 02:13:52 pm »
In my experience such things just happen from time to time for some unknown reasons, maybe way outside the Lazarus/FPC files. You are on Windows where you can create a new installation within less than 10 minutes. Use a secondary installation to leave your current installation alone. Then simply test whether the problem still exists - very probably it will be solved.

On the other hand, searching for the reason of such a bug is very time-consuming - your first post was 3 days ago, and the issue still is not solved.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10551
  • Debugger - SynEdit - and more
    • wiki
Re: Cannot find StrUtils used by LazUTF8
« Reply #13 on: December 17, 2022, 02:56:10 pm »
Ok, lets do another approach

Also, I created a new application and added all the packages ant it compiles fine.

Lets try to recover this project. And a few other settings.

1) Check where your primary config is. Menu: View > Ide Internals > About IDE => Search for "primary config path"
If you haven't done a 2ndary install, then likely something like C:\Users\USERNAME\AppData\Local\lazarus

Delete the file "packagefiles.xml" (make a backup)
After that your IDE does no longer know where 3rd party packages are (but it also won't have any wrong paths to them.
Next startup, ignore the warnings. Then open each installed 3rd party/OPM package. Either vie menu Packages, or drop the lpk file.

You can skip this or you can manually search the file and remove only suspicious entries.


2)
- Close IDE
- Make a backup of the project
- Delete the .lps file of your project. (session file)
  Check in the primary config path for an lps file with the project name => delete too (or move / backup)
- Open IDE
- Open the project
- Menu: Project > Project Options
  Compiler Options > Path
    "Other Unit Files" = empty (or only files inside the project dir, which are not part of any package)
    "Include Files" = $(ProjOutDir)
    "Libraries" = empty (... as above)
    "Unit output directory" = lib\$(TargetCPU)-$(TargetOS)  (or similar)
    "Target Filename" = empty or project name or whatever the exe should be called (not importand)
    ....    (you may later re-populate entries that are needed (and inside the project folder)
- Menu:  Project > Publish project
   Choose a new empty directory
   "Filter" = *.(pas|pp|inc|lpr|lfm|lrs|lpi|lpk|xml|sh) 
       (Simple Syntax)
   "Compress" = False

Restart the IDE.
Try building your Project

If you remove any path, and files in those locations are reported "not found" try adding the path back, one by one. Make sure they do not clash with any package.

3)
If not yet fixed
- Close IDE
- Delete the LPI file
- Open IDE
- Drag and drop the LPR file to you IDE
It will ask, if you want to create a new lazarus project => Yes
Then pick the type of app that you had (I assume "Application" for a GUI project with forms)

- You now have to add pack any package that the project used. You will get compile errors for those missing packages.
- You also need to add all the units back to the project (Project inspector > Drop down button "Add" > "Add..." and select from disk)

Alternatively open the .lpi file in an editor and inspect the sections for
    <RequiredPackages>
        ....
    </RequiredPackages>
    <Units>
        ....
    </Units>






Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2615
Re: Cannot find StrUtils used by LazUTF8
« Reply #14 on: December 20, 2022, 09:46:35 am »

Yes, I keep all the messages, also can generate them again, cause the problem happens on every try to build the app (I attach first 4k lines here)
But cannot see in the messages info about the loading of fpc.cfg
I'm trying now to make sure it uses the proper fpc.cfg


The answer why some the unit not found is in the last part of the output.  Since you have a lot of search paths, the first 4k only shows the first few units searched. Can you attach the last 4k too ?

Marc
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018