2shady4u / godot-sqlite

GDExtension wrapper for SQLite (Godot 4.x+)
MIT License
947 stars 82 forks source link

[gd-extension] windows release version is linked with debug version of VC++ libraries #102

Closed Dfred closed 1 year ago

Dfred commented 1 year ago

I searched for a similar issue and preferred not to continue discussion #71 as the current issue described hereafter should be temporary.

Environment:

Issue description: Currently it is impossible to load the release version of the extension built by Github Actions; even after installation of MSVC runtime libraries + reboot.

In effect, the release version is linked with debug versions of the MSVC runtime libraries, as ldd reports:

$ ldd libgdsqlite.windows.template_release.x86_64.dll
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7ff9a1330000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7ff99fc00000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7ff99eb80000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7ff9a0f10000)
        libgdsqlite.windows.template_release.x86_64.dll => /c/Users/user/Downloads/godot-sqlite-windows/libgdsqlite.windows.template_release.x86_64.dll (0x7ff9852e0000)
        MSVCP140D.dll => not found
        VCRUNTIME140D.dll => not found
        VCRUNTIME140_1D.dll => not found
        ucrtbased.dll => not found

Steps to reproduce: download the latest Artifact for Windows here, unzip into your project's addons/godot-sqlite/bin/, export without debug, run the created executable.

Minimal reproduction project: Better retrieve files yourself to avoid confusion.

Additional context The debug versions of MSVC runtime libraries are considered not redistributable. Moreover I could not find them in MS Visual Studio 2022 Community.

2shady4u commented 1 year ago

Hi @Dfred!

Has this now been resolved by the implementation of https://github.com/godotengine/godot-cpp/pull/908? Or is there still an issue that needs to be resolved?

Dfred commented 1 year ago

Hi @2shady4u, thanks for following this up!

Or is there still an issue that needs to be resolved?

Unfortunately the issue remains the same, at least with the latest artifact built for beta5: ldd produces the exact same output. As mentioned in godotengine #906, I had tried various toolchains and found LLVM to best solve my issue, although I didn't explore all MSVC possibilities.

On a side note, do you think artifacts names could be a bit more descriptive, such as: platform + _godotversion + '.zip' ?

Dfred commented 1 year ago

I believe that issue will remain with the current build system until the /MDd flag in actions' build logs becomes /MD. For further info, see this page on MSVC compiler options Also, if the issue remains, it looks like using /MT would reduce dll dependencies at the cost of a bigger size.

2shady4u commented 1 year ago

Easiest fix from my end would be to add the windows crosscompilation build, using MinGW, to actions. As that would make the binaries wholly independent from MSVC.

I'll try to implement that.

Dfred commented 1 year ago

@2shady4u I just tested Windows artifacts built for beta 7, and they look & load great. Congrats \o/ I'll let you close the issue at your convenience.