Compiling Godot for the Playstation 2

I am trying to compile Godot for the PlayStation 2 using the PS2SDK homebrew project.

I am running into compilation errors and I am not sure how to resolve them. I have a repository created so that people can try to reproduce the issue locally.

The error I am receiving is:

In file included from ./core/method_bind.h:383,
                 from ./core/class_db.h:34,
                 from ./core/reference.h:34,
                 from modules/csg/csg.h:43,
                 from modules/csg/csg_shape.h:36,
                 from modules/csg/csg_shape.cpp:31:
./core/ In instantiation of 'PropertyInfo MethodBind0RC<R>::_gen_argument_type_info(int) const [with R = int]':
./core/   required from here
./core/ error: incomplete type 'GetTypeInfo<int, void>' used in nested name specifier
  549 |                 if (p_argument==-1) return GetTypeInfo<R>::get_class_info();
      |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
./core/ In instantiation of 'GodotTypeInfo::Metadata MethodBind0RC<R>::get_argument_meta(int) const [with R = int]':
./core/   required from here
./core/ error: incomplete type 'GetTypeInfo<int, void>' used in nested name specifier
  536 |                 if (p_arg==-1) return GetTypeInfo<R>::METADATA;
      |                                                       ^~~~~~~~
./core/ In instantiation of 'void MethodBind0RC<R>::ptrcall(Object*, const void**, void*) [with R = int]':
./core/   required from here
./core/ error: 'encode' is not a member of 'PtrToArg<int>'
  588 |                 PtrToArg<R>::encode(  (instance->*method)() ,r_ret)  ;
      |                 ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Most probably, I am missing some flags for the compile, but I am unsure which.

This is my file:

import os
import platform
import sys
import os.path

def is_active():
    return True

def get_name():
    return "Playstation 2"

def can_build():
     # Check the minimal dependencies
    if "PS2SDK" not in os.environ:
        print("PS2SDK not defined in environment.. Playstation 2 disabled.")
        return False
    if "PS2DEV" not in os.environ:
        print("PS2DEV not defined in environment.. Playstation 2 disabled.")
        return False
    return True

def get_opts():
    return []

def get_flags():
    return [
        ("tools", False),
        ("builtin_bullet", True),
        ("builtin_enet", True),
        ("builtin_freetype", True),
        ("builtin_libogg", True),
        ("builtin_libpng", False),
        ("builtin_libtheora", True),
        ("builtin_libvorbis", True),
        ("builtin_libvpx", True),
        ("builtin_libwebp", True),
        ("builtin_wslay", True),
        ("builtin_mbedtls", True),
        ("builtin_miniupnpc", True),
        ("builtin_opus", True),
        ("builtin_pcre2", True),
        ("builtin_squish", True),
        ("builtin_zlib", True),
        ("builtin_zstd", True),

def configure(env):
    env["CC"] = "mips64r5900el-ps2-elf-gcc"
    env["CXX"] = "mips64r5900el-ps2-elf-g++"
    env["AR"] = "mips64r5900el-ps2-elf-ar"
    env["AS"] = "mips64r5900el-ps2-elf-as"
    env["LD"] = "mips64r5900el-ps2-elf-ld"
    env["OBJCOPY"] = "mips64r5900el-ps2-elf-objcopy"
    env["STRIP"] = "mips64r5900el-ps2-elf-strip"
    env["ADDR2LINE"] = "mips64r5900el-ps2-elf-addr2line"
    env["RANLIB"] = "mips64r5900el-ps2-elf-ranlib"
    env["BIN2S"] = os.environ.get("PS2SDK") + "/bin/bin2s"
    env["VCL"] = "vcl"
    env["VCLPP"] = "vclpp"
    env["DVP"] = "dvp-as"

    PS2DEV = os.environ.get("PS2DEV")

    env.Append(LIBS=["stdc++", "dma", "packet2", "graph", "draw", "math3d", "png", "debug", "z", "pad", "audsrv", "patches", "cdvd"])
    env.Append(LINKFLAGS="-O3 -Wl,-zmax-page-size=128")

    env["bits"] = "32"



You can download a repo to test my build locally from

1 Like

As per the custom platform ports documentation, it’s unlikely you’ll get Godot to run on a PS2, even if it’s a devkit (with 128 MB of RAM instead of 32 MB as found in a retail PS2):

Godot is a modern engine with modern requirements. Even if you only intend to run simple 2D projects on the target platform, it still requires an amount of memory that makes it unviable to run on most retro consoles. For reference, in Godot 4, an empty project with nothing visible requires about 100 MB of RAM to run on Linux (50 MB in headless mode).

If you want to run Godot on heavily memory-constrained platforms, older Godot versions have lower memory requirements. The porting process is similar, with the exception of DisplayServer not being split from the OS singleton.

Even Godot 3.x would hardly fit within the memory constraints of the PS2. Also, remember that to compile Godot 4.x, you need a C++17 compiler while Godot 3.x requires C++11 if I’m not mistaken (due to some third-party dependencies requiring it).


Thanks for the information. I wanted to make use of the features of Godot 3 as the Godot 2 branch was very bare bones but I guess I will have more luck with it. The link you provided is very useful. I had figured out most of it myself but it is nice to have.

EDIT: I assume that some part of the memory used by Godot is boilerplate. An empty project on Windows 11 with GLES 2 is around 68MB but some of that memory probably comes from all of the DLLs that Windows uses.

EDIT2: I am getting further by building Godot 2.1.6. I guess I could use it, but the editor is very ugly at this stage :sweat_smile: Might start working my way up until I hit a memory block.