Skip to content

Enabling "use_static_cpp" breaks hot reload on Linux #1876

@dsnopek

Description

@dsnopek

Godot version

v4.5.1.stable.official [f62fdbde1]

godot-cpp version

4.4 [269c925]

System information

Godot v4.5.1.stable - Pop!_OS 22.04 LTS on X11 - X11 display driver, Single-window, 3 monitors - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 Ti - AMD Ryzen 9 7950X 16-Core Processor (32 threads) - 61.94 GiB memory

Issue description

In #1747, we added the "use_static_cpp" flag for Linux, and made it enabled by default

However, in my testing, this appears to break reload. :-/ Specifically, it prevents Godot from loading the new versions of any virtual methods. Other aspects of hot reload may still work, but I'm not sure

For reusable GDExtensions (ie not ones with game logic), enabling "use_static_cpp" makes sense as a default. However, for ones that include game logic, reload is very important!

We have a couple options:

  1. Make use_static_cpp default to disabled
  2. Make use_hot_reload default to disabled
  3. Automatically disable use_static_cpp if use_hot_reload is enabled
  4. Automatically disable use_hot_reload if use_static_cpp is enabled
  5. Figure out some change to godot-cpp that allows use_static_cpp to still work with use_hot_reload?

Unfortunately, I have no idea how to do nr 5

I kind of wish we could do nr 2, but that's been the default for so long, it would be pretty disruptive. (This also applies to nr 4, which would effectly lead to nr 2, since that would be what happens with no options.)

So, only nr 1 and nr 3 are really viable, given that use_static_cpp has only been around for a short time

Steps to reproduce

  1. Make a GDExtension with a Node that prints something in _process()
  2. In the editor, make a scene that has this node
  3. Notice that the log is filling up with your print statements!
  4. Rebuild the GDExtension, and focus on the editor
  5. Notice that your prints have stopped appearing in the log

Minimal reproduction project

Haven't had a chance to make one (but would probably be useful if other folks want to look into it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions