Skip to content

Use OpenSSL on windows too, build libgit2, ssh2 with cmake. #199

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

Merged
merged 1 commit into from
May 26, 2025

Conversation

Faless
Copy link
Contributor

@Faless Faless commented Jul 17, 2023

This builds on top of #191 .
Fixes #193 (enable using elliptic curves cryptography on Windows).

@akien-mga akien-mga force-pushed the build/openssl_and_cmake branch from 6c720d8 to 0d0c307 Compare May 26, 2025 15:28
@akien-mga akien-mga merged commit 3ab9d03 into godotengine:master May 26, 2025
4 checks passed
@akien-mga
Copy link
Member

Thanks! Looks great.

@Calinou
Copy link
Member

Calinou commented May 26, 2025

It seems this broke Windows CI, even though jobs still appear successful. The Windows artifacts don't contain a DLL anymore (only EXP/LIB), and the CI log has this:

 [100%] Built target libgit2package
link /nologo /WX /OPT:REF /OPT:NOICF /dll /out:demo\addons\godot-git-plugin\win64\libgit_plugin.windows.editor.x86_64.dll /implib:demo\addons\godot-git-plugin\win64\libgit_plugin.windows.editor.x86_64.lib /LIBPATH:bin\thirdparty\openssl\windows\x86_64 bin\thirdparty\git2\windows\x86_64\git2.lib bin\thirdparty\ssh2\windows\x86_64\src\libssh2.lib bin\thirdparty\openssl\windows\x86_64\libssl.lib bin\thirdparty\openssl\windows\x86_64\libcrypto.lib crypt32.lib ws2_32.lib advapi32.lib user32.lib godot-cpp\bin\libgodot-cpp.windows.editor.x86_64.lib advapi32.lib winhttp.lib rpcrt4.lib crypt32.lib ole32.lib user32.lib wsock32.lib ws2_32.lib bcrypt.lib godot-git-plugin\src\gdlibrary.windows.editor.x86_64.obj godot-git-plugin\src\git_callbacks.windows.editor.x86_64.obj godot-git-plugin\src\git_plugin.windows.editor.x86_64.obj godot-git-plugin\src\git_wrappers.windows.editor.x86_64.obj
git2.lib(oid.c.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
   Creating library demo\addons\godot-git-plugin\win64\libgit_plugin.windows.editor.x86_64.lib and object demo\addons\godot-git-plugin\win64\libgit_plugin.windows.editor.x86_64.exp
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : error LNK1218: warning treated as error; no output file generated
scons: *** [demo\addons\godot-git-plugin\win64\libgit_plugin.windows.editor.x86_64.dll] Error 4098
scons: building terminated because of errors.

It worked on the commit just before in master, i.e. 955ec02.

@akien-mga
Copy link
Member

The above error is fixed by #284.

Checking the build logs, we still have a few non-blocking issues to resolve:

[ 64%] Building C object src/libgit2/CMakeFiles/libgit2.dir/streams/openssl.c.obj
cl : Command line warning D9025 : overriding '/MD' with '/MT'
openssl.c

(same for various other libgit2 deps)
And this:

git2.lib(oid.c.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance

@Faless
Copy link
Contributor Author

Faless commented May 27, 2025

cl : Command line warning D9025 : overriding '/MD' with '/MT'

I've opened #285 that should silence this.

git2.lib(oid.c.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance

libgit2 enabled /GL and /LTCG on release builds, and there's no way to disable it. This is not an issue, the warning is telling us that we should enable that for the linking process, but the current godot-cpp version does not allow that option.

I've opened #286 which forces the LINKFLAG, this should at least silence the warning.

@Faless Faless deleted the build/openssl_and_cmake branch May 27, 2025 11:56
@akien-mga akien-mga mentioned this pull request May 27, 2025
akien-mga added a commit to akien-mga/godot-git-plugin that referenced this pull request May 27, 2025
- Remove the `demo` project which isn't really useful.
  * Instead the `addons` subfolder is made top-level and that's where stuff gets written.
- Update the README following recent PRs (godotengine#191, godotengine#199) as OpenSSL is now compiled from source for all platforms.
  * Also remove obsolete `build_openssl_universal_macos.sh` script.
- Remove the bogus `plugin.cfg` which isn't necessary, and was confusing users who tried to enable it.
  * Fixes godotengine#267.
- Bump min SCons version to 3.1.2 and Python to 3.6.
- Bump `compatibility_minimum` to `4.2.0` following godotengine#196.
- Remove some code in `godot-git-plugin/SCsub` that seems redundant with `godot-cpp` config.
- CI: Update clang-format check to version 18.
akien-mga added a commit to akien-mga/godot-git-plugin that referenced this pull request May 27, 2025
- Remove the `demo` project which isn't really useful.
  * Instead the `addons` subfolder is made top-level and that's where stuff gets written.
- Update the README following recent PRs (godotengine#191, godotengine#199) as OpenSSL is now compiled from source for all platforms.
  * Also remove obsolete `build_openssl_universal_macos.sh` script.
- Remove the bogus `plugin.cfg` which isn't necessary, and was confusing users who tried to enable it.
  * Fixes godotengine#267.
- Bump min SCons version to 3.1.2 and Python to 3.6.
- Bump `compatibility_minimum` to `4.2.0` following godotengine#196.
- Remove some code in `godot-git-plugin/SCsub` that seems redundant with `godot-cpp` config.
- CI: Update clang-format check to version 18.
@akien-mga
Copy link
Member

akien-mga commented May 27, 2025

I get this error locally on Fedora 42 in the step that builds libssh2:

...
-- Found Threads: TRUE
-- Found OpenSSL: /home/akien/Godot/godot-git-plugin/bin/thirdparty/openssl/linux/x86_64/libcrypto.a (found version "3.1.1")
-- Found ZLIB: /usr/lib64/libz.so (found version "1.3.1")
-- The following features have been enabled:

 * Static library, creating libssh2 static library

-- The following OPTIONAL packages have been found:

 * Threads
 * ZLIB

-- The following REQUIRED packages have been found:

 * OpenSSL

-- The following features have been disabled:

 * Shared library, creating libssh2 shared library (.so/.dll)
 * Logging, Logging of execution with debug trace
 * Compression, using zlib for compression

-- Configuring done (3.0s)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
ZLIB_LIBRARY
    linked by target "libssh2_static" in directory /home/akien/Godot/godot-git-plugin/thirdparty/ssh2/libssh2/src

-- Generating done (0.0s)
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_CXX_COMPILER


CMake Generate step failed.  Build files cannot be regenerated correctly.

This seems to be because I have zlib-ng-compat-devel installed (I can't remove it, a bunch of userland packages seem to depend on it).

We might need to tell CMake explicitly not to use system libs, and maybe point it at OpenSSL's built-in zlib copy.


Before that one, I also ran into this issue:

cd bin/thirdparty/openssl/linux/x86_64 && perl -- /home/akien/Godot/godot-git-plugin/thirdparty/openssl/Configure --prefix="/home/akien/Godot/godot-git-plugin/bin/thirdparty/openssl/linux/x86_64/dest" --openssldir="/home/akien/Godot/godot-git-plugin/bin/thirdparty/openssl/linux/x86_64/dest" no-ssl2 no-ssl3 no-weak-ssl-ciphers no-legacy no-shared no-tests linux-x86_64
Can't locate IPC/Cmd.pm in @INC (you may need to install the IPC::Cmd module) (@INC entries checked: /home/akien/Godot/godot-git-plugin/thirdparty/openssl/util/perl /usr/local/lib64/perl5/5.40 /usr/local/share/perl5/5.40 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 /home/akien/Godot/godot-git-plugin/thirdparty/openssl/external/perl/Text-Template-1.56/lib) at /home/akien/Godot/godot-git-plugin/thirdparty/openssl/util/perl/OpenSSL/config.pm line 19.
BEGIN failed--compilation aborted at /home/akien/Godot/godot-git-plugin/thirdparty/openssl/util/perl/OpenSSL/config.pm line 19.
Compilation failed in require at /home/akien/Godot/godot-git-plugin/thirdparty/openssl/Configure line 23.
BEGIN failed--compilation aborted at /home/akien/Godot/godot-git-plugin/thirdparty/openssl/Configure line 23.

I solved it by installing perl-IPC-Cmd as suggested by the error. But weirdly enough, in a minimal fedora:42 podman container, with only git, scons, gcc, and g++ installed, I didn't get either error.

So I suspect the perl-IPC-Cmd requirement is also due to an optional dependency which I may happen to have and CMake tries to use it automatically.

akien-mga added a commit to akien-mga/godot-git-plugin that referenced this pull request May 27, 2025
- Remove the `demo` project which isn't really useful.
  * Instead the `addons` subfolder is made top-level and that's where stuff gets written.
- Update the README following recent PRs (godotengine#191, godotengine#199) as OpenSSL is now compiled from source for all platforms.
  * Also remove obsolete `build_openssl_universal_macos.sh` script.
- Remove the bogus `plugin.cfg` which isn't necessary, and was confusing users who tried to enable it.
  * Fixes godotengine#267.
- Bump min SCons version to 3.1.2 and Python to 3.6.
- Bump `compatibility_minimum` to `4.2.0` following godotengine#196.
- Remove some code in `godot-git-plugin/SCsub` that seems redundant with `godot-cpp` config.
- Remove `export-ignore`s in `.gitattributes`, they're incomplete and not actually doing anything usable.
- CI: Update clang-format check to version 18.
akien-mga added a commit to akien-mga/godot-git-plugin that referenced this pull request May 27, 2025
- Remove the `demo` project which isn't really useful.
  * Instead the `addons` subfolder is made top-level and that's where stuff gets written.
- Update the README following recent PRs (godotengine#191, godotengine#199) as OpenSSL is now compiled from source for all platforms.
  * Also remove obsolete `build_openssl_universal_macos.sh` script.
- Remove the bogus `plugin.cfg` which isn't necessary, and was confusing users who tried to enable it.
  * Fixes godotengine#267.
- Bump min SCons version to 3.1.2 and Python to 3.6.
- Bump `compatibility_minimum` to `4.2.0` following godotengine#196.
- Remove some code in `godot-git-plugin/SCsub` that seems redundant with `godot-cpp` config.
- Remove `export-ignore`s in `.gitattributes`, they're incomplete and not actually doing anything usable.
- Fix artifacts URL handling in `release.sh`, make it executable.
- CI: Update clang-format check to version 18.
@Faless
Copy link
Contributor Author

Faless commented May 28, 2025

I've opened #290 to disable zlib detection for libssh .
As explained there:

This seems to only be used with the OpenSSL backend (which we plan to drop).
libgit2 already use builtin ZLIB, I'm not even sure we if it would be used in libssh2 (we only use libssh2 to provide git ssh access, and git already compress objects.

Regarding the second issue, that's something related to the openssl build system (not cmake).
I don't think we can do much about that, the openssl build system expects perl (and some base modules) to be installed. A typical perl installation should contain those modules but YMMV depending on the distribution.

akien-mga added a commit to akien-mga/godot-git-plugin that referenced this pull request May 28, 2025
- Remove the `demo` project which isn't really useful.
  * Instead the `addons` subfolder is made top-level and that's where stuff gets written.
- Update the README following recent PRs (godotengine#191, godotengine#199) as OpenSSL is now compiled from source for all platforms.
  * Also remove obsolete `build_openssl_universal_macos.sh` script.
- Remove the bogus `plugin.cfg` which isn't necessary, and was confusing users who tried to enable it.
  * Fixes godotengine#267.
- Bump min SCons version to 3.1.2 and Python to 3.6.
- Bump `compatibility_minimum` to `4.2.0` following godotengine#196.
- Remove some code in `godot-git-plugin/SCsub` that seems redundant with `godot-cpp` config.
- Remove unnecessary `.exp` and `.lib` files in Windows artifact, rename its folder to `windows`.
- Remove `export-ignore`s in `.gitattributes`, they're incomplete and not actually doing anything usable.
- Fix artifacts URL handling in `release.sh`, make it executable.
- CI: Update clang-format check to version 18.
akien-mga added a commit to akien-mga/godot-git-plugin that referenced this pull request May 28, 2025
- Remove the `demo` project which isn't really useful.
  * Instead the `addons` subfolder is made top-level and that's where stuff gets written.
- Update the README following recent PRs (godotengine#191, godotengine#199) as OpenSSL is now compiled from source for all platforms.
  * Also remove obsolete `build_openssl_universal_macos.sh` script.
- Remove the bogus `plugin.cfg` which isn't necessary, and was confusing users who tried to enable it.
  * Fixes godotengine#267.
- Bump min SCons version to 3.1.2 and Python to 3.6.
- Bump `compatibility_minimum` to `4.2.0` following godotengine#196.
- Remove some code in `godot-git-plugin/SCsub` that seems redundant with `godot-cpp` config.
- Remove unnecessary `.exp` and `.lib` files in Windows artifact, rename its folder to `windows`.
- Remove `export-ignore`s in `.gitattributes`, they're incomplete and not actually doing anything usable.
- Fix artifacts URL handling in `release.sh`, make it executable.
- CI: Update clang-format check to version 18.
akien-mga added a commit to akien-mga/godot-git-plugin that referenced this pull request May 28, 2025
- Remove the `demo` project which isn't really useful.
  * Instead the `addons` subfolder is made top-level and that's where stuff gets written.
- Update the README following recent PRs (godotengine#191, godotengine#199) as OpenSSL is now compiled from source for all platforms.
  * Also remove obsolete `build_openssl_universal_macos.sh` script.
- Remove the bogus `plugin.cfg` which isn't necessary, and was confusing users who tried to enable it.
  * Fixes godotengine#267.
- Bump min SCons version to 3.1.2 and Python to 3.6.
- Bump `compatibility_minimum` to `4.2.0` following godotengine#196.
- Remove some code in `godot-git-plugin/SCsub` that seems redundant with `godot-cpp` config.
- Remove unnecessary `.exp` and `.lib` files in Windows artifact, rename its folder to `windows`.
- Remove `export-ignore`s in `.gitattributes`, they're incomplete and not actually doing anything usable.
- Fix artifacts URL handling in `release.sh`, make it executable.
- CI: Update clang-format check to version 18.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugin freezes the editor on remote commands with SSH using Ed25519 key.
3 participants