Recent

Author Topic: incompatible packages  (Read 2099 times)

Birger52

  • Sr. Member
  • ****
  • Posts: 309
incompatible packages
« on: December 04, 2019, 07:28:07 pm »
I have designed - and used in a couple of projects by now - my own message system, which basically is a controller Unit, with functions to call, that will create a form, with the needed information and options to continue.
Packed it together in a package - tho there is nothing to register - and installed it...

All of a sudden, when compiling applications that uses this package, it says:
Fatal: Cannot find Forms used by MsgFormHandler, incompatible ppu=C:\lazarus\lcl\units\x86_64-win64\forms.ppu, package LCLBase
Why?
Tried to uninstall the package and rebuild IDE - which fails, because the package does not compile, with the same error as above.

I open the package and compiles it - and it compiles just fine..
So which is it? Does it compile or not?
And how do I get back to a Lazarus, that can be used...

Tried to recompile LCLbase - which in turn calls for recompilation of quite a number of build-in packages, one by one - and when done, ends up in the same error - the Forms unit can not be found.
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: incompatible packages
« Reply #1 on: December 04, 2019, 07:33:13 pm »
Maybe you can try:

Lazarus main menu > Tools > Configure "Build Lazarus" > Profile to build: Clean Up + Build all

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: incompatible packages
« Reply #2 on: December 04, 2019, 07:39:40 pm »
Do you have any custom path setting in your package? include path or similar? (package options)
The "path" page of the "package options" should not have any entries added by you.

Your package should have a dependency on the LCL or LCLBase (or any package, that in turn depends on the former).

"C:\lazarus\lcl\units\x86_64-win64\forms.ppu" looks correct? Ie. that is where your Lazarus is installed?
When you recompiled, did that file get a new/current timestamp?

Not likely, but do you have a forms.ppu somewhere in the directory of your own package?


Usually you get that error when you change compiler.

Or change the target (OS, or 32/64 bit).
But target changes should recompile required packages.





marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: incompatible packages
« Reply #3 on: December 05, 2019, 07:57:00 am »
My guess is that everything "down" must be compiled with -Ur, includign lclintf and its dependencies? Recompiling the both LCLs (the one that creates and the one that uses the package) with -Ur might work.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: incompatible packages
« Reply #4 on: December 05, 2019, 09:28:04 am »
Please try this workaround: Enter "Configure Build Lazarus" IDE form, check "Clean common files" (it does not work with "Automatically" or "Clean All"), check "Switch after building to automatically", and build IDE. Steps must be followed exactly as described. Report the result.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

Birger52

  • Sr. Member
  • ****
  • Posts: 309
Re: incompatible packages
« Reply #5 on: December 05, 2019, 05:40:00 pm »
The file mentioned - "C:\lazarus\lcl\units\x86_64-win64\forms.ppu" - exists and is apparently correct.
Don't know about timestamps. Didn't think to check, as it has been functioning as intended up until now.
Did the "Clean All" recompile of Lazarus - and it got all the way through, without any problems.

Recompiling my project however, still gave the same error - Forms can't be found, and the same incompatible ppu.

So figured.
Apart from this MsgSystem, I also have created a package with Database functions I use. And this package uses (dependency) the msg-package.
It has been necessary to include the path, as the database package wouldn't compile otherwise. (Said it couldn't find the file, when path not included - and when included it complains that the path "belongs" to another package.)
Figured that his was a problem, as pr. Martin_fr's sugestions.
So successfully removed the installation of the database-package from Lazarus.
This actually removed the dependency of the msg-package from the database package.
Added the dependency, and removed the path - and the database package now compiles.
Then successfully removed the installation of the msg-package - and this time without compilation errors.

Rebuild my project - without errors.

Seems like the error message was correct about an error - but not about why, how or where...
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: incompatible packages
« Reply #6 on: December 05, 2019, 06:18:03 pm »
Adding paths is really dangerous ground.

Usually it leads to "duplicate ppu" stuff. It can lead to other ppu errors such as yours, but then often with a different path. That is why the very exact error you got, threw me off a bit.

However, fpc often reports extra info with errors, and sometimes that gets stripped by the IDE (because it is seen as note or hint.)
The message window has a "copy all and original messages", and if you paste that into an editor, and read the lines around an error, you sometimes find more useful info.
I do not know what (if at all) it may have hidden in your case. And if it did hide anything, I do not know if it was a bug in the IDE. (i.e. maybe something more should have been shown).


Birger52

  • Sr. Member
  • ****
  • Posts: 309
Re: incompatible packages
« Reply #7 on: December 05, 2019, 08:27:01 pm »
 :o

"Duplicate stuff" indeed.
and you can delete duplicates, and Lazarus will copy them from the originals, and complain about duplicates...

I have my own units (only procedures and functions - no objects; a few Event definitions, tho.
And they are used in other units/objects, so compiler complains about them not being found, if I do not set paths to the folder where they are.
Lazarus then copies them to the /bin folder and complains about that there is both the original and the one it has copied.
I'm not really sure what the point is - simply dropping everything in the same folder, seems to be the only way Lazarus will accept things - but that is not really what I see as a sensible way to store things...
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: incompatible packages
« Reply #8 on: December 05, 2019, 10:37:17 pm »
You can add pathes, so long as each path can only be reached once.

You need to understand this. Compilation works like this
- Each package is compiled into a ppu
- if a package has "uses", each used package needs to exist as ppu.
  If it does not exist, the compiler will first compile it into a ppu, then use that ppu
   (there is some magic for circle refs....)

The rule should be: Each file belongs either to your project OR to a package. But only to ONE. Never to more than one.

A package or project can have as many source (pp/pas) locations as you like. But the must belong only to that package or project.
All those are compiled into ppu.
Each package or project should have just one folder for ppu (all else gets really complicated).

If 2 packages see the same source, it is as if that source exists twice => boom.


You have to understand is, that compilation is done package by package.
- So LCL compiles forms.pas into forms.ppu
- Then all further packages/projects, will see forms.ppu only. They will not see forms.pas.
  If they did (if you tweaked the path), they would create a 2nd forms.ppu in their ppu folder..... => boom

Extra ppu path can be handy if you have bought 3rd party components for which you have no source, but ppu only => then the compiler only sees the ppu, and no sources.

In theory a path can be included by 2 projects. Since at any time only one is compiled, and the other does not depend on it.
The 2 projects will never see each others ppu folder. So the 2 ppu will never conflict.
But to avoid having to deal with all that yourself, put such files into a package. And use the package. Then the IDE can work its magic.

If you go further on this, always look at the full fpc output, not just the messages window. (copy all....)
Also compile with -va which means the compiler will tell you every file it looks at, and where it looks for them (hell of a lot of info...)







af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: incompatible packages
« Reply #9 on: December 05, 2019, 11:12:05 pm »
Extra ppu path can be handy if you have bought 3rd party components for which you have no source, but ppu only => then the compiler only sees the ppu, and no sources.
Maybe if it works - see https://forum.lazarus.freepascal.org/index.php/topic,47582.msg341500.html#msg341500 - for me it doesn't work as expected
regards
Andreas

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: incompatible packages
« Reply #10 on: December 06, 2019, 12:37:25 am »
Well all the rtl and fpc-packages are ppu only (you can remove the sources, they are for codetools only)

Birger52

  • Sr. Member
  • ****
  • Posts: 309
Re: incompatible packages
« Reply #11 on: December 09, 2019, 04:45:29 pm »
@Martin_fr
So - my units with utility functions, should not be units, but packages, and units should only be pr project basis - not general stuff?
Lazarus 2.0.8 FPC 3.0.4
Win7 64bit
Playing and learning - strictly for my own pleasure.

 

TinyPortal © 2005-2018