godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.68k stars 506 forks source link

Can't build on windows #942

Closed TheSecondReal0 closed 1 year ago

TheSecondReal0 commented 1 year ago

I've been trying to build godot-cpp for a while now and I keep getting the same errors. I've tried reinstalling mingw and g++ and even on multiple computers but I keep running into the same problem.

The error messages look like this:

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.

if I try changing the target to "editor" it still spits out the same errors, just "template_debug" is replaced with "editor."

Any help would be much appreciated

akien-mga commented 1 year ago

Please include the commands you're using in full, and details on your build environment (mingw version, where you installed it from, etc.).

pondc1 commented 1 year ago

I am running into the same issue. I have installed mingw v12.2.0 via the online installer here and am simply running the scons command with no parameters in the godot-cpp directory in my project. I get the exact same above error trace. And much like the original poster, if I add a target paramter such as scons target=editor, it replaces the the errors with "editor" instead of "template_debug"

Calinou commented 1 year ago

Which branch of godot-cpp are you trying to build (master for GDExtension in 4.0.beta, or 3.x for GDNative in 3.5?)

I wonder if this occurs because SCons is using backslashes in paths, but MinGW expects forward slashes.

TheSecondReal0 commented 1 year ago

I am trying to build master for GDExtension. I've tried with mingw 4.3.0, 7.3.0, and 10.0.0 and get the same errors regardless. I'm running scons with no input parameters. I'm installing mingw from https://winlibs.com

bruvzg commented 1 year ago

What's output of gcc --version and x86_64-w64-mingw32-gcc --version commands. Make sure you have PATH environment variable set correctly (both https://winlibs.com/ and https://github.com/niXman/mingw-builds-binaries doesn't seem to set it), otherwise scons won't find MinGW install. Also try adding use_mingw=yes to the scons command.

pondc1 commented 1 year ago

I was using master. I actually just got scons to build successfully. I ended up resetting my environment var for mingw and that seemed to have allowed me to compile the library. Not exactly sure what happened there but this is most likely a user error on my part

TheSecondReal0 commented 1 year ago

I was also able to fix this by making sure mingw was in my %PATH% correctly, complete user error. At least this issue thread existing will help other people running into the same problem.