Search code examples
pythonc++buildwebassemblygodot

GDExtension cannot find a tool chain to build for the web, in spite of compatibility


To clarify my title, "web" is an available export platform for GDExtension as of Godot 4.2, which, while no doubt limited, is great news for those of us building web applications. This is mentioned here. When I attempt to compile with:

scons platform=web

I get a curious error message:

michael@Marduk:~/Documents/Godot/gdextension_cpp_example$ scons platform=web
scons: Reading SConscript files ...
Auto-detected 16 CPU cores available for build parallelism. Using 15 cores by default. You can override it with the -j argument.
Building for architecture wasm32 on platform web
ValueError: Required toolchain not found for platform web:
  File "/home/michael/Documents/Godot/gdextension_cpp_example/SConstruct", line 5:
    env = SConscript("godot-cpp/SConstruct")
  File "/usr/lib/python3/dist-packages/SCons/Script/SConscript.py", line 661:
    return method(*args, **kw)
  File "/usr/lib/python3/dist-packages/SCons/Script/SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/python3/dist-packages/SCons/Script/SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/michael/Documents/Godot/gdextension_cpp_example/godot-cpp/SConstruct", line 53:
    cpp_tool.generate(env)
  File "/home/michael/Documents/Godot/gdextension_cpp_example/godot-cpp/tools/godotcpp.py", line 265:
    raise ValueError("Required toolchain not found for platform " + env["platform"])

All of this is in Python and should be easy enough to read, but it isn't obvious. My best parsing shows me that no tool chain is registered for the "web" platform, but this is interesting in itself, as if it was, say, "windows", it would mention to me exactly what file was missing. This implies that it doesn't even have anything on record.

Is it maybe something to do with my C++ binding? Or perhaps I'm using the wrong platform extension? Is there a known way around this?

The extension builds fine for Linux and Windows.


Solution

  • Installing emscripten using the docs fixed this exact issue for me.