Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test project builds on Windows 11 64-bit but doesn't work in Godot #976

Closed
aliendisco opened this issue Dec 23, 2022 · 8 comments · Fixed by #1203
Closed

Test project builds on Windows 11 64-bit but doesn't work in Godot #976

aliendisco opened this issue Dec 23, 2022 · 8 comments · Fixed by #1203
Labels
discussion topic:gdextension This relates to the new Godot 4 extension implementation

Comments

@aliendisco
Copy link

I tried compiling beta 8 and 9 versions of Godot-cpp and demo project and they compile ok. But extension doesn't work in Godot b8/b9.

I also tried building GDExtensionSummator and got same results.
Here's also link to GDExtensionSummator issue I posted: Link

Everything work OK on linux x64.

The error:

  Can't open dynamic library: C:/Users/Bostjan/work/git/godot-cpp/test/demo/bin/libgdexample.windows.template_debug.x86_64.dll, error: Error 126: The specified module could not be found.
  .
  core/extension/gdextension.cpp:400 - GDExtension dynamic library not found: C:/Users/Bostjan/work/git/godot-cpp/test/demo/bin/libgdexample.windows.template_debug.x86_64.dll
  Failed loading resource: res://example.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
  Transient parent has another exclusive child.
  Cannot get class 'Example'.
  Cannot get class 'ExampleMin'.
  In Object of type 'MissingNode': Attempt to connect nonexistent signal 'custom_signal' to callable 'Node(main.gd)::_on_Example_custom_signal'.
@fatduckling
Copy link

I got it to work after doing a make clean.

I ran directly from terminal: cmake .. && make instead of doing through Visual studio.

@epchain
Copy link

epchain commented Jan 3, 2023

I have the same issue with Godot 4.0beta10. I do clean and successful builds of godot-cpp and godot-cpp/test (commit 3da6db4...) according to instructions from this page (a bit outdated) with the same error messages in Godot. Both official Godot 4.0beta10 build and custom build of commit d0398f6... behave similarly. I build on Windows 10 x64 with MSYS2 Mingw-w64 v12.2.0.
Before building I dumped extension_api.json and gdextension_interface.h from Godot as suggested in godot-cpp/gdextension/README.md, updated them in godot-cpp/gdextension and immediately see difference: godot-cpp's extension_api.json doesn't have entries for FramebufferCacheRD and UniformSetCacheRD which are present in Godot. This means godot-cpp 3da6db4... looks like not so synced with Godot d0398f6...
If it helps, I attached my build options and logs:
godot-cpp_build-flags.zip
godot-cpp_build-log.zip
godot-cpp-test_build-log.zip

@AmberOrange
Copy link

Having the same issue here too, Windows 10 x64 with MSYS2 Mingw-w64

@feiyunw
Copy link
Contributor

feiyunw commented Apr 1, 2023

You can use Dependencies to check your DLL dependcies.
Copy them (libgcc_s_seh-1.dll, libstdc++-6.dll and libwinpthread-1.dll) from MinGW installation to the same directory where libgdexample.windows.*.dll resides (i.e. godot-cpp\test\demo\bin).

Better to link the DLL statically, without any external MinGW DLL dependency.

@epchain
Copy link

epchain commented Apr 2, 2023

Thanks, @feiyunw!
I've walked through the whole building process from scratch on Godot v.4.0.stable / Windows 10 x64 / MSYS2 Mingw-w64 v12.2.0 and can confirm that missing dependency libraries are cause of this issue. Default build of godot-cpp/test depends on dynamic libraries libgcc_s_seh-1.dll, libstdc++-6.dll and libwinpthread-1.dll. Copying them to godot-cpp/test/demo/bin solves the issue. You can get them from <MSYS2-installation>\mingw64\bin. As for linking those libraries statically, you can add the following line to godot-cpp/test/SConstruct file:

...
else:
    # This line
    env["LINKFLAGS"] = "-static-libgcc -static-libstdc++ -static -pthread"
    library = env.SharedLibrary(
...

However, the error message Godot gives out in this situation is still misleading. It could be something like "failed to load" instead of "couldn't find" a library.

@feiyunw
Copy link
Contributor

feiyunw commented Apr 2, 2023

As for linking those libraries statically, you can add the following line to godot-cpp/test/SConstruct file:

You may be interested in PR #1082

@doonv
Copy link

doonv commented Apr 24, 2023

I was also having this issue, and @epchain 's solution solved it for me! Thank you so much!

@Calinou Calinou added discussion topic:gdextension This relates to the new Godot 4 extension implementation labels May 23, 2023
@NatGazer
Copy link

NatGazer commented Aug 6, 2023

Devs, I love your work but, if possible I would like to know why, in 08/2023 with Godot 4.1.1, do I still have this problem. And by the way, thank you so much @feiyunw and @epchain for giving the solution, I've lost a week just to put gdextension to work because of this issue.

EDIT:
At least add env["LINKFLAGS"] = "-static-libgcc -static-libstdc++ -static -pthread" to the "hardcoded SConstruct file" present in the tutorial: https://docs.godotengine.org/en/stable/tutorials/scripting/gdextension/gdextension_cpp_example.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion topic:gdextension This relates to the new Godot 4 extension implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants