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

Can't compile the extension #29

Closed
aliendisco opened this issue Dec 17, 2022 · 13 comments
Closed

Can't compile the extension #29

aliendisco opened this issue Dec 17, 2022 · 13 comments
Labels
bug Something isn't working

Comments

@aliendisco
Copy link

aliendisco commented Dec 17, 2022

Hi,

I'm using windows 11 64 and compile of godot-cpp fails for me.
I cloned repo and run scons in godot-cpp folder (commit c20ecea).
Maybe I'm doing something wrong. Files src\godot.cpp and others are there.

Regards,
Bostjan

Log:

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 x86_64 on platform windows
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src\godot.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\godot.cpp
g++ -o src\classes\wrapped.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\classes\wrapped.cpp
g++ -o src\core\class_db.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\core\class_db.cpp
g++ -o src\core\error_macros.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\core\error_macros.cpp
g++ -o src\core\memory.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\core\memory.cpp
g++ -o src\core\method_bind.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\core\method_bind.cpp
g++ -o src\core\object.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\core\object.cpp
g++ -o src\variant\aabb.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\variant\aabb.cpp
g++ -o src\variant\basis.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\variant\basis.cpp
g++ -o src\variant\char_string.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\variant\char_string.cpp
g++ -o src\variant\color.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\variant\color.cpp
g++ -o src\variant\packed_arrays.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\variant\packed_arrays.cpp
g++ -o src\variant\plane.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\variant\plane.cpp
g++ -o src\variant\projection.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\variant\projection.cpp
scons: *** [src\godot.windows.template_debug.x86_64.o] The system cannot find the file specified
g++ -o src\variant\quaternion.windows.template_debug.x86_64.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-headers -Iinclude -Igen\include src\variant\quaternion.cpp
scons: *** [src\classes\wrapped.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\core\class_db.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\core\error_macros.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\core\memory.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\core\method_bind.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\core\object.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\variant\aabb.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\variant\basis.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\variant\char_string.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\variant\color.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\variant\packed_arrays.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\variant\plane.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\variant\projection.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: *** [src\variant\quaternion.windows.template_debug.x86_64.o] The system cannot find the file specified
scons: building terminated because of errors.
@paddy-exe paddy-exe added the bug Something isn't working label Dec 17, 2022
@paddy-exe
Copy link
Owner

Hey @aliendisco which Godot Version are you using? Is it the correct one to the godot-cpp version?

@aliendisco
Copy link
Author

I'm using 4.0 beta 8 win64.
Side question. Is the step 0 necessary? (Click on the green "Use this template" button to generate the repository for you)

@aliendisco
Copy link
Author

aliendisco commented Dec 18, 2022

I somehow managed to compile the extension. I didn't use windows for 10 years and something about my build setup was wrong.
Now the extension gets created but godot throws Error loading extesnsion when trying the Game project.
In game/bin/summator folder there are 2 files .a and .dll so this seems ok. I opened the game project with godot 4.0 beta 8.
Looks like I'm close but not quite there yet :)

Godot console log:

SCRIPT ERROR: Parse Error: Identifier "Summator" not declared in the current scope.
          at: GDScript::reload (res://main.gd:4)
ERROR: Can't open dynamic library: C:/Users/Bostjan/work/git/GDExtensionSummator/game/bin/summator/libgdsummator.windows.template_debug.x86_64.dll, error: Error 126: The specified module could not be found.
.
   at: (platform/windows/os_windows.cpp:293)
ERROR: GDExtension dynamic library not found: C:/Users/Bostjan/work/git/GDExtensionSummator/game/bin/summator/libgdsummator.windows.template_debug.x86_64.dll
   at: open_library (core/extension/native_extension.cpp:400)
ERROR: Failed loading resource: res://bin/summator.gdextension. Make sure resources have been imported by opening the project in the editor at least once.
   at: (core/io/resource_loader.cpp:214)

@paddy-exe
Copy link
Owner

Hmm from your latest error there seems to be an issue with the os_windows.cpp file. This is probably an upstream issue with Godot and godot-cpp
Btw for easier readability please put " ``` " these quotation markes before and behind the error log.

@aliendisco
Copy link
Author

Thanks for response. I'll format the error log next time 👍

@paddy-exe
Copy link
Owner

paddy-exe commented Dec 19, 2022

@aliendisco Can you try again with the latest commit and the Beta 9 version? Also before compiling anything, delete the .godot folder inside the game directory.

@aliendisco
Copy link
Author

I tried with the latest beta9 and I still get the same error. Even the lines number are the same which is kind of odd.

I noticed that the files created in bin folder are:
libgdsummator.windows.template_debug.x86_64.dll
liblibgdsummator.windows.template_debug.x86_64.a

The .a file starts with liblib. Is this correct?

@paddy-exe
Copy link
Owner

liblibgdsummator.windows.template_debug.x86_64.a

The .a file starts with liblib. Is this correct?

No, this doesn't look correct. Unfortunately I can't compile it myself but I haven't run into any errors on my Maschine and the CI either. Can you run the test project inside the godot-cpp repository?

@aliendisco
Copy link
Author

Unfortunately it doesn't work either. Extension get created.

libgdexample.windows.template_debug.x86_64.dll
liblibgdexample.windows.template_debug.x86_64.a

Again liblib

Maybe I'm doing something wrong since I'm not very proficient with c++

  Can't open dynamic library: C:/Users/Bostjan/work/git/GDExtensionSummator/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/GDExtensionSummator/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'.

@aliendisco
Copy link
Author

The last command when running scons is (there is liblib for file name):

g++ -shared -o demo\bin\libgdexample.windows.template_debug.x86_64.dll src\example.o src\register_types.o $( -LC:\Users\Bostjan\work\git\GDExtensionSummator\godot-cpp\bin $) -lgodot-cpp.windows.template_debug.x86_64 -Wl,--out-implib,demo\bin\liblibgdexample.windows.template_debug.x86_64.a

@aliendisco
Copy link
Author

I tried building it on linux. It creates file: libgdsummator.linux.template_debug.x86_64.so

And it works!

Maybe only a windows build is broken, or I'm doing something wrong.

@paddy-exe
Copy link
Owner

@aliendisco In this case please file an issue on the Godot-cpp repository so that it can be tracked. (Also do link this issue here as well)
This seems to be an underlying API problem, not with this extension template then

@paddy-exe
Copy link
Owner

This should be fixed now with godotengine/godot-cpp#1203 being merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants