Skip to content

Enabling "use_static_cpp" breaks hot reload on Linux #1876

Closed

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)

Activity

  1. added this to the 4.x milestone on Nov 1, 2025
  2. added
    bug
    on Nov 1, 2025
  3. dsnopek commented on Nov 1, 2025

    @dsnopek
    CollaboratorAuthor

    I've made PRs for:

    I'm probably leaning to #1878 at this point

  4. enetheru commented on Nov 2, 2025

    @enetheru
    Collaborator

    does this solve any of these related issues?
    #1847
    #1712
    #1502

  5. dsnopek commented on Nov 2, 2025

    @dsnopek
    CollaboratorAuthor

    Ah, it could certainly be related to #1847 - I think the other two are from before the use_static_cpp flag was added for Linux

  6. Ivorforce commented on Nov 3, 2025

    @Ivorforce
    Member

    It seems to me that hot reload is only needed for builds used locally, while using static cpp is only needed for builds sent out to people.
    Theoretically, they should be mutually exclusively useful. I'd prefer that for the convenience of the user.
    Is that your suggestion number 3?

  7. dsnopek commented on Nov 3, 2025

    @dsnopek
    CollaboratorAuthor

    Sort of. PR #1877 implements nr 3

    The problem is that use_hot_reload defaults to enabled on all builds except release templates. So, if we do #1877 and folks don't change their arguments to scons at all, they'll end up with editor and debug templates that have use_static_cpp disabled, and release templates that have it enabled. That'll be weird and unexpected.

    That's why I wrote above that I wish we could do nr 2, so that people were passing use_hot_relead=yes when they actually needed hot reload, but at the moment, I suspect folks don't even know that option exists because it's enabled by default. But at this point, if we changed the default on that, it'd be disruptive since it's been the default for so long.

    The least disruptive change is nr 1, because that's only been the default for a little while

  8. Ivorforce commented on Nov 3, 2025

    @Ivorforce
    Member

    I guess we don't have a convenient way to differentiate between the "builds I make for myself" and "builds I send to other people" then? (I'm not aware of any, anyway)

    I would probably expect hot reload to work by default for local builds. So I think I'm with you to go with solution 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplatform:linuxbsd

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions