Lecrapouille / gdcef

[Plugin][Version 0.12.1][Functional] Chromium Embedded Framework Webview for Godot 3 and 4
https://discord.gg/EckEwy7S5U
MIT License
250 stars 31 forks source link

Unable to build the extension for Godot 4 on Windows 11 machine #39

Closed TheSilentFog closed 9 months ago

TheSilentFog commented 9 months ago

Hi.

I followed meticulously many times the installation process found here and here, but not once I was able to build the Godot extension.

I can't copy and past the entire stack trace since it's really too long, so this is the last part of stack trace I get:

C:\Users\loren\Desktop\Godot Projects\GDCEF Test\addons\gdcef\thirdparty\cef_binary\tests\ceftests\Release\ceftests.exe
 : fatal error LNK1169: rilevato uno o più simboli definiti più volte [C:\Users\loren\Desktop\Godot Projects\GDCEF Test
\addons\gdcef\thirdparty\cef_binary\tests\ceftests\ceftests.vcxproj]
Traceback (most recent call last):
  File "C:\Users\loren\Desktop\Godot Projects\GDCEF Test\addons\gdcef\build.py", line 500, in <module>
    compile_cef()
  File "C:\Users\loren\Desktop\Godot Projects\GDCEF Test\addons\gdcef\build.py", line 294, in compile_cef
    run(["cmake", "--build", ".", "--config", CEF_TARGET], check=True)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release']' returned non-zero exit status 1.

I would like to point out that the third line of the installation process ./build.py doesn't work on my machine and I had to fix it to python3 ./build.py.

If you need to know more details, just ask. Thank you in advance.

raphipod commented 9 months ago

Basically the Python script exits because it couldn't execute the cmake command with the subprocess python module.

@TheSilentFog Check if cmake is installed on your system. Should be getting installed with Visual Studio C++ for Desktop development in the VS-Installer app.

https://learn.microsoft.com/de-de/cpp/build/media/cmake-install-2019.png?view=msvc-170

This checkbox must be checked in the Visual Studio Installer on the right hand side when choosing C++ for desktop development (or whatever it's called).

For your last issue regarding typing in python3 before the build script: ./build.py tries to execute the python script. This command in this form only works on Unix systems. AFAIK in Windows you actually have to call the Python shell/interpreter with python3 or python beforehand for Python scripts to execute.

@Lecrapouille do you have any other idea what might cause the aforementioned issue?

Nonetheless, I will also debug this as soon as I get a VM running with Windows, as I no longer use Windows as my main OS.

Thanks for contributing this issue.

Lecrapouille commented 9 months ago

Hi !

Note: if you cannot compile, you can try precompiled release https://github.com/Lecrapouille/gdcef/releases/tag/v0.7.2-godot4

TheSilentFog commented 9 months ago

@raphipod According to VS Installer CMAKE was installed, but since you pointed out that the problem could be around CMAKE, I inspected the programs installed on my machine and tada!, I found out that I had two of them installed.

So, since I'm on windows and the resulting behaviour could be unexpected and I don't like doing things erratically. I uninstalled both the CMAKE double and the entire Visual Studio C++ for Desktop development inside VS installer. After a reboot I followed step by step again the installation process, checking the things already installed that were already working, installing what was missing and rebooting again.

Unfortunately for me the building process didn't work again, and unfortunately for you @Lecrapouille, I can't get the whole console content now. I'm sorry my friend, I read your comment too late.

I confirm I'm on the HEAD.

Now I'm stuck with this stack trace:

C:\Users\loren\Desktop\Godot Projects\GDCEF Test\addons\gdcef>python3 ./build.py
←[32m[INFO] Checking cmake version ...←[00m
Traceback (most recent call last):
  File "C:\Users\loren\Desktop\Godot Projects\GDCEF Test\addons\gdcef\build.py", line 495, in <module>
    check_cmake_version()
  File "C:\Users\loren\Desktop\Godot Projects\GDCEF Test\addons\gdcef\build.py", line 462, in check_cmake_version
    if version.parse(current_version) < version.parse(CMAKE_MIN_VERSION):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\loren\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\packaging\version.py", line 54, in parse
    return Version(version)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\loren\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\packaging\version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: '3.27.2-msvc1'

Seems it wasn't able to parse my cmake version, so:

C:\Users\loren\Desktop\Godot Projects\GDCEF Test\addons\gdcef>cmake --version
cmake version 3.27.2-msvc1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Thank you @Lecrapouille for the link to the precompiled release, I haven't tried it yet but it should solve my problems and headaches. It doesn't help solving your building problems on windows though. So, if you find it useful, I'm willing to go on with the building process, until it manages to build.

raphipod commented 9 months ago

Hmm.

Just to clarify: There is an upstream CMake available to download, and the one that gets installed with the C++ desktop development package in Visual Studio (for Windows).

We should probably only focus on the CMake version from VS as we already use the C++ desktop dev package and advise people to uninstall the non-VS versions of CMake (& update the Docs accordingly).

https://github.com/Lecrapouille/gdcef/blob/bb008a229dfb5a17b3eabe072829c888812343be/addons/gdcef/build.py#L458-L471

The snippet of the build script here checks the installed CMake's version number is lower than the minimal CMake version declared at the top of the build file in Line 48, which is 3.19.

As the included CMake of VS seemingly is at 3.27.2, we don't have any issue atleast on Windows.

For outdated or slow-updating Linux distros the version check (last lines) may be applicable, but for Windows, we can almost be sure that the version is >3.19 (if the version used is the one from VS!)

What if we add another check at L468 that the if-function only gets executed on the Linux platform? @Lecrapouille

@TheSilentFog comment out lines 468-471 in build.py, run it again, and see if it makes any difference. That would be my next step.

Lecrapouille commented 9 months ago
TheSilentFog commented 9 months ago

I commented the lines and gave it a try. The resulting behaviour is the same as the start of this issue.

Here the entire stack trace as requested: StackTrace.txt

Lecrapouille commented 9 months ago

@TheSilentFog

cef_sandbox.lib(check_op.obj) : error LNK2038: rilevata errata corrispondenza per 'RuntimeLibrary': il valore 'MT_StaticRelease' non corrisponde al valore 'MD_DynamicRelease' in binary_transfer_test.ob

Ok I think I understood: You have initially compiled CEF when the application of the windows patch has been removed (during the initial commit): your CEF was compiled as dynamic lib. Then you have updated the git which has added the patch back (for compiling CEF has static lib), this mess up the compiler: it is lost between dynamic and static symbols. Remove the cef_binary in gdcef/addons/gdcef/thirdparty and launch back build.py script, this will compile correctly.