gdext: Exported game panics due to missing `ResourceImporterOggVorbis` methods
I have been encountering the following panic when running exported games using the custom-godot feature:
ERROR: Parameter "mb" is null.
at: gdextension_classdb_get_method_bind (core\extension\gdextension_interface.cpp:1347)
ERROR: Rust function panicked in file godot-ffi\src\toolbox.rs at line 248. Context: failed to initialize GDExtension level `Scene`
at: <function unset> (godot-core\src\lib.rs:155)
ERROR: Panic msg:
Failed to load class method ResourceImporterOggVorbis::load_from_buffer (hash 354904730).
Make sure gdext and Godot are compatible: https://godot-rust.github.io/book/gdext/advanced/compatibility.html
at: <function unset> (godot-core\src\lib.rs:101)
This same issue seems to happen when using the custom-godot feature with the example extension. Here are the steps that I have verified to reproduce the issue (I have only checked on Windows, I can check on Linux too if that would be helpful):
- Build
editorandtemplate_debugtargets for custom godot version (I am using ad72de508 , corresponding to 4.2 rc1). - Point
GODOT4_BINenvironment variable at the custom editor build - Enable the
custom-godotfeature inexamples/dodge-the-creeps/rust/Cargo.tomland runcargo build. - In the editor, use the custom
template_debugto export a Windows Desktop build of thedodge-the-creepsexample. - Run the game, receive the error above.
About this issue
- Original URL
- State: closed
- Created 7 months ago
- Comments: 21 (12 by maintainers)
Thanks @coder137 and @Xylord, I overlooked that the default dependencies of
dodge-the-creepsonly have a minimal set of classes.Changed its
Cargo.tomlto:And built with:
Then indeed, I can reproduce it! 👍
So that’s a start 🙂
Confirmed with Godot developers and tracked as https://github.com/godotengine/godot/issues/86206.
I will implement a workaround in gdext, until there is an official way to know about methods that are unavailable in Release mode.
I did as you said. Upon starting the game the output below pops up in the console. I had to modify the dodge the creeps project a bit to get it to run. First, in Cargo.toml, I changed the godot dependency to:
godot = { git = "https://github.com/godot-rust/gdext", branch = "master", features = ["experimental-wasm"] }Second, in the .gdextension file, I moved the .dll files to a bin folder in the godot directory, and pointed the .gdextension path there:
windows.debug.x86_64 = "res://bin/debug/dodge_the_creeps.dll"windows.release.x86_64 = "res://bin/release/dodge_the_creeps.dll"The game seems to work properly in-editor.
It’s probably worth noting that the library was compiled on WSL1 (Linux Ubuntu) using
cargo build -p dodge-the-creeps --target=x86_64-pc-windows-gnu --release@Bromeon can you try the steps listed above. Need to update the Cargo.toml file in the Dodge the creeps example
Seems like there is a problem only with
ResourceImporterOggVorbisCommented out the panic , on exporting and running the game got the following dump
Can replicate the problem with this repository example
examples/dodge-the-creeps/rust/Cargo.tomlgodot = { path = "../../../godot" }(experimental wasm seems to work properly)../buildfolder is createdIt’s likely that there are many others, yes.
Will need to reproduce this at some point and see if there’s a pattern.
@Xylord and others: Can you try enabling the
lazy-function-tablesgdext feature and trying again? We found a similar problem while debugging WASM and that feature fixed it. Perhaps the problem we found actually affects all export targets, not just WASM?cc @Bromeon
This seems to be a more serious issue than initially thought.
I don’t think anybody can export a project right now,
custom-godotfeature or not.The game will export, but attempting to play the exported project will result in a panic.
I am not using
ResourceImporterOggVorbisanywhere. Which is the main concerning thing (could something be wacky about this, specifically? Not sending the proper hash or defaults?)It’s not an issue of the library missing, since if the library isn’t found, it will report a missing library:
In fact, just merely registering the library seems to cause this issue, no actual
GodotClassrequired…Looking into the
mb is nullerror, it seems to come from this snippet: https://github.com/godotengine/godot/blob/master/core/extension/gdextension_interface.cpp#L1327-L1349mbhere seems to benull. Putting the context clues together, couldResourceImporterOggVorbis::load_from_bufferbe doing something funky?