Skip to content

Support Godot 4.7#419

Open
Rubonnek wants to merge 12 commits into
limbonaut:masterfrom
Rubonnek:support-godot-4-7
Open

Support Godot 4.7#419
Rubonnek wants to merge 12 commits into
limbonaut:masterfrom
Rubonnek:support-godot-4-7

Conversation

@Rubonnek

Copy link
Copy Markdown
Contributor

No description provided.

@Rubonnek Rubonnek force-pushed the support-godot-4-7 branch 6 times, most recently from b1cdebb to e3d4dc1 Compare March 5, 2026 18:15
@actforjason

actforjason commented Apr 1, 2026

Copy link
Copy Markdown

Hi! Does the Checks errors affect the use of this PR?

Edit: Compilation passed, and it seems to work fine.

@Rubonnek Rubonnek force-pushed the support-godot-4-7 branch from dd9097b to 07e1c5e Compare April 14, 2026 23:02
lethiandev added a commit to lethiandev/limboai that referenced this pull request May 15, 2026
Apply upstream PR limbonaut#419 fixes:
- Add missing ClassDB headers
- Add missing callable_mp headers
- Add missing Engine header
- Add missing DisplayServer header
- Add missing Input header
- Add missing ResourceSaver headers
- Improve Ref ownership safety
- Fix editor crash upon closing

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Rubonnek Rubonnek marked this pull request as ready for review May 25, 2026 20:03
@Rubonnek

Copy link
Copy Markdown
Contributor Author

This PR is ready for review now.

GDExtension is untested for the most part. That said, I can't spot any glaring issues in Linux -- compilation seems fine and the demo runs fine as well.

@pfchen

pfchen commented Jun 1, 2026

Copy link
Copy Markdown

@Rubonnek I believe you need to add the line #include "core/object/callable_mp.h" at https://github.com/Rubonnek/limboai/blob/67ecbd3a8bff6ad0b4332949772a3831e43cc3fa/tests/test_hsm.h#L20 to ensure the tests compile successfully.

@Rubonnek

Rubonnek commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@pfchen the tests compile fine for me in Linux when using LimboAI as a module against the master branch in Godot. I need a way to reproduce your issue. What error do you see? Could you elaborate on your platform and dependencies?

@pfchen

pfchen commented Jun 1, 2026

Copy link
Copy Markdown

@Rubonnek I am also on Linux and using the latest Godot master branch (commit ID: dff2b9bb66a01d8c1a207531b0752405c7399124), but I have enabled .NET/C# support.

My build command is:
scons platform=linuxbsd target=editor arch=x86_64 module_mono_enabled=yes custom_modules=../modules dev_mode=yes module_text_server_fb_enabled=yes verbose=yes warnings=extra cache_path=.scons_cache cache_limit=4

Note: I placed your branch (Rubonnek:support-godot-4-7) in the ../modules directory.

[ 15%] In file included from ./modules/modules_tests.gen.h:54,
                 from tests/test_main.cpp:73:
./../modules/limboai/tests/test_hsm.h: In function 'void TestHSM::wire_callbacks(LimboState*, Ref<CallbackCounter>, Ref<CallbackCounter>, Ref<CallbackCounter>)':
./../modules/limboai/tests/test_hsm.h:29:32: error: 'callable_mp' was not declared in this scope
   29 |         p_state->call_on_enter(callable_mp(p_entries_counter.ptr(), &CallbackCounter::callback));
      |                                ^~~~~~~~~~~
./../modules/limboai/tests/test_hsm.h:29:32: note: 'callable_mp' is a function-like macro and might be used incorrectly
[ 15%] ./../modules/limboai/tests/test_hsm.h: In function 'void TestHSM::DOCTEST_ANON_FUNC_168()':
./../modules/limboai/tests/test_hsm.h:231:33: error: 'callable_mp_static' was not declared in this scope
  231 |                                 callable_mp_static(_on_enter_dispatch).bind(state_beta, "event_two"));
      |                                 ^~~~~~~~~~~~~~~~~~
./../modules/limboai/tests/test_hsm.h:231:33: note: 'callable_mp_static' is a function-like macro and might be used incorrectly
[ 15%] ./../modules/limboai/tests/test_hsm.h:245:33: error: 'callable_mp_static' was not declared in this scope
  245 |                                 callable_mp_static(_on_enter_get_cargo).bind(state_beta, cargo));
      |                                 ^~~~~~~~~~~~~~~~~~
./../modules/limboai/tests/test_hsm.h:245:33: note: 'callable_mp_static' is a function-like macro and might be used incorrectly
./../modules/limboai/tests/test_hsm.h:254:33: error: 'callable_mp_static' was not declared in this scope
  254 |                                 callable_mp_static(_on_enter_set_initial_state).bind(nested_hsm, state_delta));
      |                                 ^~~~~~~~~~~~~~~~~~
./../modules/limboai/tests/test_hsm.h:254:33: note: 'callable_mp_static' is a function-like macro and might be used incorrectly
[ 15%] ./../modules/limboai/tests/test_hsm.h:295:39: error: 'callable_mp' was not declared in this scope
  295 |                 state_beta->set_guard(callable_mp(guard.ptr(), &TestGuard::can_enter));
      |                                       ^~~~~~~~~~~
./../modules/limboai/tests/test_hsm.h:295:39: note: 'callable_mp' is a function-like macro and might be used incorrectly
./../modules/limboai/tests/test_hsm.h:314:84: error: 'callable_mp' was not declared in this scope
  314 |                 hsm->add_transition(state_alpha, state_beta, "guarded_transition", callable_mp(guard.ptr(), &TestGuard::can_enter));
      |                                                                                    ^~~~~~~~~~~
./../modules/limboai/tests/test_hsm.h:314:84: note: 'callable_mp' is a function-like macro and might be used incorrectly
[ 99%] scons: *** [bin/obj/tests/test_main.linuxbsd.editor.x86_64.o] Error 1

@Rubonnek

Rubonnek commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@pfchen Could you try placing the limboai repository within the modules folder and dropping custom_modules=../modules flag?

I was able to compile with the following command while having modules/limboai within the Godot source code:

scons platform=linuxbsd target=editor arch=x86_64 module_mono_enabled=yes dev_mode=yes module_text_server_fb_enabled=yes verbose=yes warnings=extra cache_path=.scons_cache cache_limit=4

which is your exact command, but just dropping that custom_modules=../modules flag which is what's throwing the header lookup error.

@pfchen

pfchen commented Jun 1, 2026

Copy link
Copy Markdown

@Rubonnek I think the reason should be quite clear by now.

Direct Cause

limboai/tests/test_hsm.h uses callable_mp and callable_mp_static, but does not include the header that defines them:

#include "core/object/callable_mp.h"

So the build depends on whether another test header happened to include that file first.

Evidence

Godot wires module test aggregation in modules/SCsub:

module_tests = sorted(glob.glob(os.path.join(base_path, "tests", "*.h")))
test_headers += module_tests

env.CommandNoCache(
    "modules_tests.gen.h",
    test_headers,
    env.Run(modules_builders.modules_tests_builder),
)

The final generated include order is sorted in godot/modules/modules_builders.py:

headers = sorted([
    os.path.relpath(src.path, methods.base_folder).replace("\\", "/")
    for src in source
])

With custom_modules=../modules, LimboAI test headers become:

#include "../modules/limboai/tests/test_hsm.h"

which sorts before built-in module tests like:

#include "modules/jsonrpc/tests/test_jsonrpc.h"

test_jsonrpc.h includes:

#include "core/object/callable_mp.h"

When LimboAI is placed in godot/modules/, its path becomes:

#include "modules/limboai/tests/test_hsm.h"

which sorts after modules/jsonrpc/..., so the missing include is accidentally hidden.

Fix

Add this include to limboai tests/test_hsm.h:

#include "core/object/callable_mp.h"

This makes the test header self-contained and fixes the issue for both in-tree and custom_modules builds.

@Rubonnek

Rubonnek commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@pfchen Ah, I see, thanks for the explanation. At one point I think I got a wildly different error that threw me off because of my incremental builds -- I think I had a conflicting generated file somewhere.

I cleaned my repository and was able to reproduce the issue. I'll push the change in a bit -- I need to merge this patch on a previous commit. This missing header issue is due to an upstream change.

@Rubonnek Rubonnek force-pushed the support-godot-4-7 branch from 67ecbd3 to e7cfcdb Compare June 1, 2026 16:37
@limbonaut

Copy link
Copy Markdown
Owner

Nice stuff! Let's get this merged in a week or so. I'd like to give 1.7.1 some window to gather feedback in case it needs patching.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants