synopse / mORMot2

OpenSource RESTful ORM/SOA/MVC Framework for Delphi and FreePascal
https://synopse.info
Other
485 stars 122 forks source link

Circular Reference Issue in Project04InterfaceBasedServer.dproj in martin-doyle's example 04-InterfacedBasedServices #240

Closed BastianTeufel-GTR closed 4 months ago

BastianTeufel-GTR commented 4 months ago

When trying to compile the server component of the 04-InterfacedBasedServices sample of @martin-doyle examples, I get the following error:

[dcc32 Fataler Fehler] mormot.core.variants.pas(27): F2047 Zirkuläre Unit-Referenz auf 'mormot.core.base'

in English:

[dcc32 Fatal error] mormot.core.variants.pas(27): F2047 Circular unit reference to 'mormot.core.base'

compiled on Windows 11, Delphi 12, Win32 / Debug

The client component compiles just fine.

synopse commented 4 months ago

I have no Delphi 12 available to reproduce the problem. But no issue on Delphi 11.2 or earlier...

There are clearly no circular reference between mormot.core.variants and mormot.core.base. Check the source code itself. So it sounds like a compiler issue, in your specific setup.

Did you clean all *.dcu in your system?

synopse commented 4 months ago

Please use our https://synopse.info/forum to discuss this and get help from others than me.

BastianTeufel-GTR commented 4 months ago

Thanks for your feedback. I'll check and go to the forum 👍

BastianTeufel-GTR commented 4 months ago

I found the problem. It was in how Delphi 12 imports the dpr file. When opening the dpr file for the first time, Delphi 12 generates the dproj file.

It automatically adds the mormot.coreinto the projects unit scope. This leads to the circular reference.

When removing the entry, it compiles as expected.

grafik