Skip to content

[tools/windows.py] misplaced flag prevents gd-extensions with C files to build #906

Closed
@Dfred

Description

@Dfred

TL;DR

In https://github.com/godotengine/godot-cpp/blame/master/tools/windows.py#L43 -std=c++17 is set to CCFLAGS but should be set to CXXFLAGS as this prevents compilation of gd-extensions with .c files.

Background

I've been trying to use godot-sqlite's gd-extension branch with Godot4-beta3, which has godot-cpp as a submodule set to SHA 1044251.
However Godot4-beta3.exe currently fails to load the artifact built from Github actions, libgdsqlite.windows.template_debug.x86_64.dll, because of links with debug versions of VcRedist DLLs - for which I submitted issue 102.

So I've been building the sqlite gd-extension with MinGW-w64 but got trapped in DLL dependency hell. Eventually I found another pre-built toolchain / package that worked: LLVM-MinGW .

Godot-sqlite builds src/sqlite/shell.c and src/sqlite/sqlite3.c along with src/gdsqlite.cpp and src/register_types.cpp, yet that fails because scons calls:

gcc -o src\sqlite\sqlite3.o -c -std=c++17 -O2 -DDEBUG_ENABLED -DDEBUG_METHODS_ENABLED -Igodot-cpp\godot-headers -Igodot-cpp\include -Igodot-cpp\gen\include -Isrc src\sqlite\sqlite3.c
=====
error: invalid argument '-std=c++17' not allowed with 'C'

=====
scons: *** [src\sqlite\sqlite3.o] Error 1
scons: building terminated because of errors.

I tracked down the std flag to tools/windows.py and fixed the error by changing line 43 to env.Append(CXXFLAGS=["-std=c++17"]).
Then that compiled the gd-extension's dll, which loads flawlessly in Godo4-beta3 editor under Windows 10.

@Faless I hope this helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions