Error compilling CGE Editor on Windows 11

Now I’m on Windows 11 trying to re-compile the editor (version 7.0-alpha3.snapshot) with custom components but it ends with this error (and a few related more):

C:\prog\motores\CastleGameEngine\tools\common-code\toolmanifest.pas(144,29) Error: (5000) Identifier not found “TProjectDependencies”

I’m using FPC 3.2.2 and Lazarus 3.4. On Linux I’m using FPC 3.2.0 and Lazarus 3.4 and it compiles without error but a few warnings.

I was about to upgrade Lazarus but the site is down right now.

It seems you have multiple engine versions, old and new, and they get mixed up.

( This issue seems unrelated to Windows, FPC, Lazarus versions. )

In new CGE version,

  1. TProjectDependencies is defined in src/files/castleinternaltools.pas ( castle-engine/src/files/castleinternaltools.pas at master · castle-engine/castle-engine · GitHub ).
  2. And it is used by tools/common-code/toolmanifest.pas ( castle-engine/tools/common-code/toolmanifest.pas at master · castle-engine/castle-engine · GitHub ).

It seems in your case AD 2 is true, but AD 1 is not.

Likely, Lazarus remembers the package (lpk) location from older CGE.

Make sure to recompile lpk (from new CGE) using Lazarus first. Our Compiling from source | Manual | Castle Game Engine shows various ways that avoid this issue:

  • if you build the “build tool” from Lazarus, then before castle-engine/tools/build-tool/castle-engine.lpi rebuild packages/castle_base.lpk .
  • or there are other ways of building the “build tool”.

Actually I actualized CGE but I didn’t remove the old version.

Maybe the best option is to uninstall, clean and install it again.

Thanks.

Hm, you generally do not need to uninstall previous engine version if you “update in place”. Our Windows installer (if you download binaries from Download | Castle Game Engine ) has been specifically tested to ensure smooth upgrades (without the need to uninstall old version first).

Maybe there’s something we should fix – can you describe in more details

  • how did you install CGE originally? I can see that old version (known to Lazarus) is in C:\prog\motores\CastleGameEngine .
  • how did you update CGE?

Your messages did indicate you had 2 versions of CGE sources, one old (C:\prog\motores\CastleGameEngine) and one new.

( I understand you solved the issue anyway on your system. But in any case more info would be appreciated – we want to ensure “smooth upgrades” for people, without the need to uninstall. So if there’s some bug there, I’d like to fix it :slight_smile: )

Sorry for the late answer. It’s a busy month.

  • how did you install CGE originally?

I don’t remember actually. I think I downloaded a zip or a tarball and unzipped.

  • how did you update CGE?

I downloaded the installer from the site and installed over it.

[Edit]
I’ve fixed this way:

  1. I’ve uninstalled CGE.
  2. I’ve removed the CGE directory because it had some files.
  3. I’ve removed CGE configuration files from C:/Users/<user>/AppData/Local
  4. I’ve installed CGE again.
  5. I’ve registered packages on Lazarus again.

This seems to work for me.

I think the issue was that the first time I installed CGE I didn’t use the Windows installer, I just downloaded a zip and uncompressed it (iirc). Using the installer from the first install should allow clean updates, but Michalis would confirm that.

Yes, using the installer (i.e. exe on Windows) to install the new version should behave OK, and it will update from previous version smoothly (correctly removing or replacing all files from the old version). InnoSetup that we use guarantees it, I checked it long time ago.

If you installed the previous version from zip/tar.gz, then installer doesn’t know about it, there is no central information about it. So installer cannot remove/replace it, and it’s your responsibility to remove it manually before using the new version. Some people may also use this way (installing from zip) like to keep multiple engine versions installed in parallel, with the obvious caveat that you need to be aware always which one do you use, and make sure all IDEs/environment variables ($PATH, Lazarus, Delphi, VS Code config) point to the same CGE version, and not have a “mix” .

I’ve found another issue:

In one of the projects it compiles the game, but it doesn’t find unit CastleWindows when compilling the CGE Editor. The unit is referenced in one of the views (to close the application when pressing Esc).

The weird thing is that another (newer) project it compiles both without any problem and it also uses unit CastleWindows.

Hm, I’m not sure what happens, we need more information what/how you’re doing :slight_smile:

  • We have no unit named CastleWindows. Only CastleWindow. I guess you mean CastleWindow.
  • But the CGE editor doesn’t use CastleWindow. CGE editor also doesn’t have any views.
  • And it’s not clear how do you build the editor, how it fails.

Please show exactly the error message. Best to make screenshots of what you’re doing, or record a short movie.

And show where do you have Castle Game Engine installed (in the explorer), and show whether you configured the “Castle Game Engine Path” in “Preferences → General” and did you set $CASTLE_ENGINE_PATH.

This is the error, with the ´Running` line at the beginning:

This is the line error. As you see, Lazarus is able to find the required unit.

CGE is installed in C:\prog\motores\Castle Game Engine, using windows Installer, and it’s correctly auto-detected by CGE, as shown in “Preferences → General”. As far as I can see, $CASTLE_ENGINE_PATH isn’t set.

Hello, Did you register the components in Lazarus?. Did you compile the CGE packed from Lazarus?. I use “most_important_lazarus_packages_and_tools.lpg” project group?
/BlueIcaro

Hm, “PPU is compiled for another processor” points to something weird happening with CPU. Maybe compiler artifacts for Win32 (i386) and Win64 (x86_64) got mixed. I’m not sure why does it seem like it tries to compile for i386 – editor is x86_64 and should compile for x86_64.

It seems you installed FPC and Lazarus independently, in c:/lazarus/fpc/3.2.2/, maybe it doesn’t have the Win64 installed?

Ideas:

  • Can you change the “Preferences → FPC and Lazarus” to use “bundled FPC” installed along with CGE? Just delete the custom FPC path there. The FPC we provide can build Win64 applications.

  • If you installed FPC / Lazarus yourself, did you choose “Windows 64-bit” version? Lazarus downloads on https://www.lazarus-ide.org/ should provide Windows 64-bit versions. You can also install Win64 versions of FPC / Lazarus using fpcupdeluxe | Manual | Castle Game Engine . ( The FPC downloads from Free Pascal Compiler - Browse Files at SourceForge.net contain Win32 compiler with Win64 cross-compilers, last time I checked. ) Try installing / adding Win64 FPC version.

Sorry for the silence but I was not working in this issue because I had to move forward, and it wasn’t critical since Linux (which is my main platform) worked without problems.

Until now.

I was learning about Android development and suddently, after installing the cross-platform compiler using fpcupdeluxe, the Editor doesn’t compile anymore and has the exact same error, except it doesn’t include the “PPU is compiled for another processor” message.

The project compiles correctly though.

I’ve found a workaround: remove the GameViewWindow unit from the uses, add the CustApp unit and replace Application by CustomApplication. Then, on the dpr code, add also CustApp and the line CustomApplication := Application just before Application.OpenAndRun.

The lack of “PPU is compiled for another processor” may mean it’s a different error. (I am not sure, I would have to see exact code and environment of everything :), but at least in this case the error is clear. )

In this case, esp. after reading your workaround, the issue is: you use custom component ( Custom Components | Manual | Castle Game Engine ) and use editor_units=... in CastleEngineManifest.xml that use the CastleWindow unit. You cannot do this – Lazarus IDE cannot use CastleWindow unit. The package castle_window.lpk is deliberately only run-time, not design-time. See castle-engine/packages at master · castle-engine/castle-engine · GitHub for explanation.

I do not 100% understand your workaround (I do not know what is CustomApplication in this case), but basically:

1 Like

looks that not only the flow for editor component(s) is using CastleWindow (which is traceable from error log, where units get compiled in order of appearance in uses clause and recursively compiling sub-dependent units) , rather editor component depends on player, which in turn depends on view, and view depends on CastleWindow , the latter is actually ok, but editor component should not depend on internals (dependency-inversion violation), it should be isolated in general, and for the functionality you would probably need to pass params to constructor or smth like this. Player is also weirdly depending on view, should be vice versa.

Finally, I’ve found where the problem is.

The project was made for a Jam, so no planification was done. At a moment I decided to change a class in to a behavior. That class referenced two of the views, but when transforming it in to a behavior I moved that code to another place more suitable for it. The problem was I forgot to remove the view references from the USES section. Once removed it compiled and behaved as it should.

So guys, plan your code organization as much as you can before to start to code, even if it’s a prototype or a fast Jam entry.

1 Like