Lecrapouille / gdcef

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

build.py won't finish #3

Closed raphipod closed 2 years ago

raphipod commented 2 years ago

Upon downloading the newest Cef build, extracting it, the build.py script wants to compile "Godot CEF module", but it fails:

[INFO] Compiling Godot CEF module C:\Users\raphi\Documents\DEV\GDCef\gdcef
scons: Reading SConscript files ...

scons: *** Path for option api_path does not exist: .\godot-cpp\
File "C:\Users\raphi\Documents\DEV\GDCef\gdcef\SConstruct", line 53, in <module>
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 342, in <module>
    compile_gdnative_cef(GDCEF_PATH)
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 324, in compile_gdnative_cef
    gdnative_scons_cmd("windows")
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 309, in gdnative_scons_cmd
    run(["scons", "api_path=" + GODOT_CPP_API_PATH,
  File "C:\Users\raphi\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['scons', 'api_path=.\\godot-cpp\\', 'build_path=C:\\Users\\raphi\\Documents\\DEV\\GDCef\\example\\build', 'target=release', '--jobs=12', 'arch=x86_64', 'platform=windows']' returned non-zero exit status 2.

Scons is installed, I installed it with the requirements.txt via pip.

File structure is my personal fork of gdcef.

My wild guess is it that I need the special environment variables from Stigmee, am I wrong?

I really want to get this to compile completely because a web browser in Godot is just awesome!

Lecrapouille commented 2 years ago

@raphipod I've just realized that I forget to call the compile_cef() :( in the script. I have fixed it and I have extended the script by removing the usage of the argv[1] holding the path to godot-cpp. Now I clone it and compile godot-cpp automatically in the folder gdcef/thirdparty/, therefore you have nothing to pass to the script. Hope this will fix your issue. In summary:

./build.py

is enough :)

raphipod commented 2 years ago

Hmm. Still getting stuck at line 250, saying STIGMEE_INSTALL_PATH is not defined.

Traceback (most recent call last):
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 385, in <module>
    compile_cef()
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 250, in compile_cef
    shutil.copyfile(os.path.join(STIGMEE_INSTALL_PATH, "patch", "CEF", "win", "libcef_dll_wrapper_cmake"),
NameError: name 'STIGMEE_INSTALL_PATH' is not defined

All other actions before that work as expected now, thanks a bunch for fixing the script!

Edit: Just commenting out line 249 - 251 seems to make it work again. Those seem to be related to CMake, which is deprecated in CEF.

Lecrapouille commented 2 years ago

@raphipod ok I know, what it this: missing copying patches for Windows. I'll commit.

Lecrapouille commented 2 years ago

@raphipod since I do not have Windows now I cannot really check. Ping me if something is still odd !

raphipod commented 2 years ago

Yes, I'll test it now!

raphipod commented 2 years ago
Traceback (most recent call last):
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 386, in <module>
    compile_cef()
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 251, in compile_cef
    shutil.copyfile(os.path.join(PATCHES_PATH, "CEF", "win", "libcef_dll_wrapper_cmake"),
  File "C:\Users\raphi\AppData\Local\Programs\Python\Python310\lib\shutil.py", line 254, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\raphi\\Documents\\DEV\\GDCef\\gdcef\\patches\\CEF\\win\\libcef_dll_wrapper_cmake'

I think it expects .\patches\CEF\win in .\gdcef\, not in project root folder. I am testing further.

Lecrapouille commented 2 years ago

@raphipod ok lol Can you git pull --rebase origin master now. Hope to be fixed :)

raphipod commented 2 years ago

Now it stops when compiling GDNative_CEF. Something also seems odd in the SConstruct file.

scons: *** [src\browser_io.obj] Error 1
scons: *** [src\gdbrowser.obj] Error 1
scons: *** [src\gdcef.obj] Error 1
scons: *** [src\gdlibrary.obj] Error 1
Der Befehl "cl" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
scons: *** [src\helper.obj] Error 1
scons: building terminated because of errors.
Traceback (most recent call last):
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 388, in <module>
    compile_gdnative_cef(GDCEF_PATH)
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 371, in compile_gdnative_cef
    gdnative_scons_cmd("windows")
  File "C:\Users\raphi\Documents\DEV\GDCef\build.py", line 356, in gdnative_scons_cmd
    run(["scons", "api_path=" + GODOT_CPP_API_PATH,
  File "C:\Users\raphi\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['scons', 'api_path=C:\\Users\\raphi\\Documents\\DEV\\GDCef\\thirdparty\\godot-3.4\\cpp', 'build_path=C:\\Users\\raphi\\Documents\\DEV\\GDCef\\example\\build', 'target=release', '--jobs=12', 'platform=windows']' returned non-zero exit status 2.

It really doesn't like being compiled it seems ;)

Lecrapouille commented 2 years ago

@raphipod this means "The "cl" command is either misspelled or could not be found." This is your Windows g++ missing.

raphipod commented 2 years ago

Alright. My bad lol. That should be installed with Mingw, correct?

Lecrapouille commented 2 years ago

@raphipod nope with https://visualstudio.microsoft.com/fr/vs/ as described in the doc. More info https://github.com/stigmee/install#compile-stigmee-for-windows

To compile Stigmee for Windows:

    Ensure VS2022 is installed
    Open an x64 Native Tools Command Prompt for VS 2022, with Administrator privilege (this should be available in the start menu under Visual Studio 2022). This ensures the environment is correctly set to use the VS tools.

I did not pick this function in this repo See: https://github.com/stigmee/install/blob/master/build.py#L554 and https://github.com/stigmee/install/blob/master/helper.py#L203

raphipod commented 2 years ago

Ah, I see. Thanks for your help until here!

Lecrapouille commented 2 years ago

@raphipod courage ! On the initial project, Windows user did not get trouble: my script works well :) but on this current repo I quickly copied and adapt the script since I stopped maintaining both projects. I'll commit the cl checker function.

raphipod commented 2 years ago

@raphipod courage ! On the initial project, Windows user did not get trouble: my script works well :) but on this current repo I quickly copied and adapt the script since I stopped maintaining both projects. I'll commit the cl checker function.

Ok. I'm installing cl right now, let's see what happens.

Lecrapouille commented 2 years ago

@raphipod I added functions for checking CMake and cl.exe

raphipod commented 2 years ago

Awesome!

[INFO] Compilation done with success. You can run your Godot editor and import the project at 'gdcef/example'

That seemed to have worked. Can't say it a thousand times, thanks!

Lecrapouille commented 2 years ago

@raphipod Is this running before thanking me ?

raphipod commented 2 years ago

Haha. You got me there :) I'll test it with Godot

Lecrapouille commented 2 years ago

If this is working for you, I'll update the version to 0.3.1. I'll let you free to open pull requests for updating the unclear part of the documentation (my English is not good), upgrade the example (for example add missing key binding or applying CEF page on rotating cube). I'm a total noob in Godot :)

raphipod commented 2 years ago

I'll definitely update the documentation, CEF version in build.py - I also have to learn a little bit more about Godot and how it handles modules, but I'll get it working.

Lecrapouille commented 2 years ago

@raphipod Cool ! Is the hello world example working for you ? Just open Godot 3.4 and import the godot.project in the example/ folder.

raphipod commented 2 years ago

Unbenannt

Yep, that's it. It works.

Lecrapouille commented 2 years ago

@raphipod Finally :)

Lecrapouille commented 2 years ago

Ok I'm closing this ticket. I updated the changelog to 0.3.1. I'll make a 0.3.2 if doc or example evolves.