CGE Editor: Error on compiling (64 bit cross compile)

Hi there,
appreciate and follow this project for a long time. I really like it. Nevertheless, had some time left today and tried to use the CGE Editor as proposed at several locations in the manual.

I ran in an error with my older setup (Lazarus 1.8.4 + FPC 2.0.4, 64 bit version), so I tried the new setup: Lazarus 2.0.10 + FPC 2.4.0, 64 bit version. Unfortunately I ran into the same error.

Dev. environment: Lazarus 1.8.4 + FPC 2.0.4, 64 bit OR Lazarus 2.0.10 + FPC 2.4.0, 64 bit
OS: Win 8.1, 64 bit

When using the pre-built CGE Editor from snapshot 6.5 OR using the self-built (FPC 2.4.0, 64 bit version) CGE Editor from the current (23/10/2020) snapshot of the Git repo, I get this error message on trying to run any example in the CGE Editor:
‘Compiling project_standalone.lpr
Fatal: Cannot open file “project_standalone.lpr”
Fatal: Compilation aborted
Error: (some dirs)\bin\ppcx64.exe returned an error exitcode
Exception “Exception”:
Failed to compile’

When playing around with some examples a few month ago, where I didn’t use the CGE Editor at all, the examples worked.

Any hint on how to solve the problem is welcome.

Best regards
Kobalt

Have you possibly made a mistake about FPC versions in your post?

We don’t support FPC 2.0.4 or 2.4.0, they would be ancient. I’m not sure does Lazarus 2.x supports so old FPC. For the latest engine, we require FPC at least 3.0.2 (see https://castle-engine.io/supported_compilers.php ) and we recommend just using the latest FPC stable 3.2.0.

As for your problem, it seems that “project_standalone.lpr” was not created. This is possible if you didn’t use he pre-built CGE editor to create the project. You probably instead used to self-built CGE editor, but you didn’t build the build tool. At project creation, the CGE editor calls the command-line build tool to create “project_standalone.lpr”.

You should have seen a clear error message about it when creating the project.

If you build the engine yourself, you have to build both CGE editor and CGE build tool, and place the build tool on $PATH. Alternatively, use the pre-built version where everything is set up such that changing $PATH is not necessary.

To fix it now, just enter the project, and execute castle-engine generate-program in the project directory.

Or, you can create the “project_standalone.lpr” manually by replacing macros in https://github.com/castle-engine/castle-engine/blob/master/tools/build-tool/data/standalone/program_template.lpr . Similar you could create LPI file from https://github.com/castle-engine/castle-engine/blob/master/tools/build-tool/data/standalone/program_template.lpi .

Hm, reading your post again, you write you get this error with “”“any example in the CGE Editor:”". This is weird, examples do not have “project_standalone.lpr”.

What exactly project do you open in CGE editor? Try e.g. examples/screen_effects_demo, in the CGE editor you should do “Open Project” and then point to the “CastleEngineManifest.xml” inside.

Thanks for your quick response!

Exactly! 2.0.4 should be 3.0.2 and 2.4.0 should be 3.2.0. Not sure why I got the version numbers wrong, sorry about that.

This made me realize, that I was indeed confronted with two different errors which appeared to be the same. I had put the self-compiled Build Tool (and all the other tools) in the same dir. as the self-built CGE Editor and checked carefully for the standalone.lpr now. And you are right, this fixes this issue (for some reason the self-built CGE Editor does work now quite well…).

With the pre-built CGE Editor I still get this on compiling an empty new project:
'castleparameters.pas(304,21) Error: Duplicate identifier “Options”
castleparameters.pas(307,27) Error: Duplicate identifier “Options”
castleparameters.pas(341,1) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted
Error: (some dirs)\bin\ppcx64.exe returned an error exitcode
Exception “Exception”:
Failed to compile’

I was kind of unclear here. I refered to my own projects, actually just different new empty projects (the 6.5 snapshot does only allow for empty projects bc. the project_templates folder doesn’t provide any templates for 2d or 3d game projects as far as I could see).

I tried the screen_effects_demo, it works well with the self-built CGE Editor, it gives the same error (duplicate “Options” identifier) for the pre-built CGE Editor.

Thanks for your help. I consider this closed since I can work with the git snapshot Editor, and am looking forward to the 7.0 release :-).

Best regards
Kobalt

OK, I’m happy it is solved! Maybe I can help with some additional problems you mention:

castleparameters.pas(304,21) Error: Duplicate identifier “Options”
castleparameters.pas(307,27) Error: Duplicate identifier “Options”

These errors are possible only with an old CGE version. They were fixed in January this year ( Rename Options parameter to AOptions, to not conflict with TStringLis… · castle-engine/castle-engine@c46558a · GitHub ). Maybe you have a different, old, version of CGE accidentally used?

Check:

  • Where does $CASTLE_ENGINE_PATH point, if you have such environment variable defined. On Windows, you can enter command-line and call
    echo %CASTLE_ENGINE_PATH%

  • Does your fpc.cfg maybe refer to some old CGE directory using the -Fuxxx option? See Configuration file to locate the FPC config file.

  • If above ideas fail, you can try to compile from the command-line, and pass -vu parameter to FPC, to detailed information about where does it search/find for units. You can do it by compiling using CGE build tool like this:

    castle-engine compile --compiler-option=-vu
    

The version of CGE should always compile with all FPC versions we support. We even automatically check it (using Jenkins) before updating the pre-built version each time.

(the 6.5 snapshot does only allow for empty projects bc. the project_templates folder doesn’t provide any templates for 2d or 3d game projects as far as I could see).

All the templates should be available. We added them in June, see New useful project templates in the Castle Game Engine editor – Castle Game Engine .

If you don’t have all the templates, then it also indicates you’re using old CGE version somehow. If your CASTLE_ENGINE_PATH points to an old CGE version, then the editor could be picking up all CGE directory, even if you run it from the directory contain latest CGE.

( Offtopic note: you have have experienced today problems posting on this forum, due to server misbehaving :slight_smile: It is fixed now. )

Oh, my bad! I just realized that the download from Release Latest release of Castle Game Engine (Auto-Updated Snapshot) · castle-engine/castle-engine · GitHub is auto-updated. I had indeed an old version (from June 2019) of the zip file laying around on my hard disk. - As I was in a hurry, the download file is not very small and the version number 6.5 still matched, I assumed they are the same and did not download it again.

Now, everything makes sense! :slight_smile:

No harm done, thank you!