flathub / org.godotengine.Godot

Godot engine
https://flathub.org/apps/details/org.godotengine.Godot
38 stars 23 forks source link

GDExtension addon error: Can't open dynamic library, libstdc++.so.6 not found #127

Closed KatMistberg closed 6 months ago

KatMistberg commented 1 year ago

The issue:

I get this error when opening a project that has a GDExtension addon (such as the tutorial C++ GDExtension) and then the addon is not loaded. This only happens with the flatpak version and not with the executable binary version of Godot, and in both Godot 4.0 and 4.1. I am running Fedora Workstation 38.

The full error in the Output tab of Godot is:

- Can't open dynamic library: /home/<...>/Godot/gdextension_cpp_example_4.1/demo/bin/libgdexample.linux.template_debug.x86_64.so.
Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found
(required by /home/<...>/Godot/gdextension_cpp_example_4.1/demo/bin/libgdexample.linux.template_debug.x86_64.so)
- core/extension/gdextension.cpp:455 - GDExtension dynamic library not found:
/home/<...>/Godot/gdextension_cpp_example_4.1/demo/bin/libgdexample.linux.template_debug.x86_64.so
- Failed loading resource: res://bin/gdexample.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
- Cannot get class 'GDExample'.

Running the flatpak from the terminal I get:

ERROR: Can't open dynamic library: /home/<...>/Godot/gdextension_cpp_example_4.1/demo/bin/libgdexample.linux.template_debug.x86_64.so.
Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.32' not found
(required by /home/<...>/Godot/gdextension_cpp_example_4.1/demo/bin/libgdexample.linux.template_debug.x86_64.so)
   at: open_dynamic_library (drivers/unix/os_unix.cpp:650)
ERROR: GDExtension dynamic library not found: /home/<...>/Godot/gdextension_cpp_example_4.1/demo/bin/libgdexample.linux.template_debug.x86_64.so
   at: open_library (core/extension/gdextension.cpp:455)
ERROR: Failed loading resource: res://bin/gdexample.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:273)
ERROR: Error loading extension: res://bin/gdexample.gdextension
   at: load_extensions (core/extension/gdextension_manager.cpp:143)

(extra line breaks inserted in the output for ease of reading)

Steps to reproduce:

  1. Follow the GDExtension tutorial above until the addon works (so up until and not including the "Adding properties" section), using the binary version of the latest version of Godot (≥ 4.0). This should work.
  2. Open the project using the flatpak version of the same version of Godot. The error above appears (at least for me).

What I have tried so far:

orowith2os commented 1 year ago

I have checked that /usr/lib/x86_64-linux-gnu/libstdc++.so.6 exists and indeed contains GLIBCXX_3.4.32 (by running strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX)

On the host, or in the Flatpak environment? It's sounding like you're building the project on the host and running it inside of the Flatpak, resulting in Godot trying to load in a newer libc than is available. Building it from source (no cache) inside of Flatpak should fix it.

KatMistberg commented 6 months ago

Ah true, that was indeed the problem. Thanks!