FPC (Free Pascal Compiler) is a Pascal compiler. You need a compiler, either FPC or Delphi, to build Castle Game Engine applications.
Our official downloads already include the most recommended (latest stable) FPC version, so you don’t need to install FPC yourself, our engine can build applications "out of the box". Our FPC version is built using scripts and CI in castle-fpc repository.
Still, you can also install FPC yourself, and point CGE to use it. Some of the options to install FPC are:
Download and install from the FPC website.
Or download and install Lazarus along with FPC.
Or download and install both Lazarus and FPC using FpcUpDeluxe.
Some systems have package repositories from which you can install FPC, like apt install fpc on Debian / Ubuntu, brew install fpc on macOS.
We always support and advice the latest stable release of FPC: right now this means 3.2.2.
Usually, we also support a couple of older FPC releases. Right now we support any FPC version >= 3.2.0.
Explanation and history: We use some modern Pascal features (like generics) in CGE, so we occasionally bump the required FPC version. We check what is commonly available, e.g. what is in the latest Debian stable (which is a baseline for many other Linux distros).
|
Note
|
If you want to build for Aarch64 (64-bit Arm), as found on many systems (Linux,Android, iOS, macOS): While we support any FPC >= 3.2.0, we strongly advise FPC >= 3.2.2. That is because certain optimizations have been broken in older FPC versions. Our build tool disables optimizations in released builds when it detects Aarch64 and older FPC. |
|
Note
|
FPC 3.2.2 has known issues linking on latest macOS and Linux/Arm and Linux/Aarch64 (like Raspberry Pi), so you need to use FPC 3.2.3 on these platforms. If you just get our official downloads they already have working FPC version. |
Lazarus is an IDE (editor, debugger etc.) built around FPC. It also features a visual classes library (LCL) and an associated form designer.
Strictly speaking, you don’t need Lazarus to use Castle Game Engine. You can use any editor to write Pascal code (e.g. VS Code) and compile your games using the engine editor and build tool which under the hood just call FPC (or Delphi) command-line compilers.
That said, of course you can use Lazarus with CGE, it’s a feature-packed cross-platform comfortable IDE made for Pascal. Moreover, you need Lazarus if you want to
As for Lazarus version:
On all platforms, we always recommend the latest stable Lazarus release. Right now (as of 2026-02-04) this is Lazarus 4.4.
This is what we use to build CGE with, using scripts and CI in castle-lazarus repository.
This is also the version in our Docker images.
On Windows: We require at least Lazarus >= 3.2.
Older Lazarus versions have known issues:
On macOS, Linux, FreeBSD: We require at least Lazarus >= 3.6.
This fix (present in Lazarus >= 3.6) is critical on macOS: Tolerate AValue = nil in TCocoaWSCustomListView.SetImageList. Before this fix, trying to open any project (new or existing) in our editor will fail with SEGFAULT.
This fix (present in Lazarus >= 3.6) is critical on platforms using GTK2, like Linux and FreeBSD: Crash due to postponed focus loss (issue). Before this fix, editor occasionally crashes when renaming components in the tree (hierarchy) view.
To install multiple versions of FPC / Lazarus, with cross-compilers (e.g. for Android or iOS), use FpcUpDeluxe! We absolutely recommend and support it.
Some Pascal libraries, like sparta_Docked or sparta_Generics, may contain their own copy of Generics.Collections unit and friends.
FPC >= 3.2.0 doesn’t need them (it contains the Generics.Collections and friends, with the same implementation from Maciej Izak). In case of CGE, we didn’t need them even for FPC 3.0.x, as CGE included our own copy of Generics.Collections.
Solution: Remove Generics.Collections and related units from any sparta_xxx or other packages. FPC includes them already. Report to authors of these packages that these units create conflicts with FPC >= 3.2.0 standard units.
We generally try to support using the latest (unstable) FPC development version to compile CGE.
You can get such FPC:
Directly from GitLab (use main branch to get really latest and unstable version)
or using FpcUpDeluxe
or using our Docker image.
Although by default we use latest stable FPC inside our Docker image, but you can get FPC unstable using the tag cge-none-fpc331 when requesting the image. So the full image name to get it from Docker Hub would be kambi/castle-engine-cloud-builds-tools:cge-unstable.
The exact FPC revision included is the one listed in the Docker build script. This is updated manually from time to time (do you think we should bump it now? let us know).
Of course please remember that this FPC version is unstable, and it changes with every commit to FPC. We cannot test or guarantee that CGE works with an arbitrary FPC development revision. But we welcome testing such FPC. PRs to make CGE work with latest FPC trunk are also welcome (unless there’s a temporary bug in FPC which should be rather reported to FPC devs).
We moved our Delphi documentation to a separate page.
We do not support using Code Typhon (a fork of FPC/Lazarus).
We advise that you rather use original FPC and Lazarus. We have more trust in FPC and Lazarus developers doing great quality job, respecting copyrights of other projects (CodeTyphon did some murky things), and working in a transparent fashion (version control, cooperating with other projects).
Note that Lazarus comes now with Online Package Manager. And you can use FpcUpDeluxe to easily install cross-compilers. These cover the most often cited reasons for using Code Typhon in the past.
To improve this documentation just edit this page and create a pull request to cge-www repository.