godot
godot copied to clipboard
Command line export doesn't properly reimport project files, and `--headless --editor --quit` workaround is not reliable to force it before export.
Godot version
4.0 beta7
System information
Windows 10
Issue description
Well, really don't know what is real problem, but hope we will find it.
I am trying to export Android project on CI. So I don't have .godot directory in vcs. First tries to export project produce broken build. I found that after full reimport I can export working apk.
What problem I see: If I remove .godot directory and then open project I got bunch of errors of broken dependencies. There are ui-theme files, that referenced to svg textures, scenes, that refs to shaders, refs to custom Reference files and there are lots of it. And this stage I mean full reimport. After it I can export my project.
So I want to reimport project with command line, and as I found old answers, command like godot --headless --editor --quit should reimport project, but it didn't. Even if I execute it multiple times. Real import execute only on --export
Maybe it's problem not with this command, maybe with reimport itself, maybe some bug with references. Hope somebody can tell it and maybe there is some workaround (for now export 3 times in a row gives working build)
Steps to reproduce
Everything is in description
Minimal reproduction project
I hope it's not necessary in this case
Can you test https://github.com/godotengine/godot/pull/68461 to see if it resolves your issue?
As a workaround, don't use --quit
, but use the timeout
command or some other way to kill the process after a certain amount of time has passed (e.g. 60 seconds for a medium-sized project).
Well that seems like exactly same problem. And that thing with --import flag would be great. So maybe (maybe) this issue is duplicate or at least has wrong title. For now I cannot build engine to test PR, but I can use workaround to let engine to import project. And part of errors gone, but not all, so I will spend your time a bit more :)
But this time I will try to provide more info.
- I tried to export apk without .godot dir and without opening project with --headles --editor --quit. As it was pulled from repo and export. And engine crashes it this case. Log: build_log_1.txt
Also maybe it's important, after this there is still no .godot dir.
- I do reimport as you suggested. And try to export. Export successful, but build is not working. Part of log (cannot take full log): build-log-2.txt
There are lots of errors about failed loading resource. I thing this is reason of broken build. But why it's happening only on export? I thought maybe something is working in parallel. Gave it 3 minutes for import. But same result.
~If I export again after it, I get working build (almost, there are visual problem, but I think that's different problem).~ My bad, if I export again after first try, sometime build failed with errors like
ADDING: res/drawable-mdpi-v4/notification_bg_low_pressed.9.png
ADDING: res/drawableERROR: Another resource is loaded from path 'res://assets/entities/actors/actor_human/actor_human.tscn::StandardMaterial3D_kt0wa' (possible cyclic resource inclusion).
at: set_path (core/io/resource.cpp:75)
ERROR: Another resource is loaded from path 'res://assets/entities/actors/actor_human/actor_human.tscn::ShaderMaterial_bj6gb' (possible cyclic resource inclusion).
at: set_path (core/io/resource.cpp:75)
ERROR: Another resource is loaded from path 'res://assets/entities/actors/actor_human/actor_human.tscn::15' (possible cyclic resource inclusion).
at: set_path (core/io/resource.cpp:75)
ERROR: Another resource is loaded from path 'res://assets/entities/actors/actor_human/actor_human.tscn::13' (possible cyclic resource inclusion).
Maybe some ideas why?
And one another thing. As you anyway will read my comment, I want to mention other few issues. If there are known bugs - good, or I could report new one. But I think you can tell what's better. In my project I use native webrtc plugin. (Maybe this is root of all problems, who knows)
- On export I see error
ERROR: Couldn't find the given section "dependencies" and key "android.debug.arm64", and no default was given.
But it seems to not brake anything. - If I export android for 2 abis (arm64 and x86_64 for example), I got webrtc library only for arm64 in apk. But if I chose only x86_64 in export settings, I got it in apk. So I think there is a bug with multiple libraries for that case.
- Also I see error
ERROR: Error getting method split_floats, hash mismatch. at: gdnative_variant_get_ptr_builtin_method (core/extension/gdnative_interface.cpp:477)
maybe it's important too - And sometime I see error
corrupted double-linked list (not small)
godot -e -q
doesnt work in godot3 either, but timeout 60 godot -e
did work in 3. It does not work in 4.x.
I have a example project, https://github.com/bend-n/hammer_space, on which i have CI building, but it doesnt seem to import resources correctly, resulting in a game... without a theme.
Some (hopefully) relevant informations to the issue:
In my current project I am doing exactly this in my github actions CI/CD pipeline and it seems to work with Godot 4 beta 8. I am using firebelley/godot-export github action and contributed the initial import of the project to it (see my PR) and for my project it will build the web export, show a bunch of errors (see my latest build action) but regardless work as expected.
Since you're issue revolves around an android export, I think the problem may only be specific to android exports. Are you using the setup-android github action before your build step and supplying an editor_setting.tres file pointing to the android SDK?
I tried to export apk without .godot dir and without opening project with --headles --editor --quit. As it was pulled from repo and export. And engine crashes it this case. Log: build_log_1.txt
I noticed in this build log file, that you have the error:
ERROR: Cannot save editor settings to file 'res://.godot/editor/project_metadata.cfg'. at: set_project_metadata (editor/editor_settings.cpp:1119)
This is the only one I do not get in my github action build (besides the crash).
I do reimport as you suggested. And try to export. Export successful, but build is not working. Part of log (cannot take full log): build-log-2.txt
Here the issue are probably:
WARNING: res://assets/entities/actors/actor_slime/actor_slime.tres:4 - ext_resource, invalid UUID: uid://s33uh0ikfg5i - using text path instead: res://assets/entities/actors/actor_slime/actor_slime.tscn at: load (scene/resources/resource_format_text.cpp:452)
and
ERROR: Failed loading resource: res://assets/world/base_shader.tres. Make sure resources have been imported by opening the project in the editor at least once. at: _load (core/io/resource_loader.cpp:214)
I got the same errors when I didn't have .godot folder present and did not import the godot project before building it. In my build I do not have these errors.
ERROR: Another resource is loaded from path 'res://assets/entities/actors/actor_human/actor_human.tscn::15' (possible cyclic resource inclusion). at: set_path (core/io/resource.cpp:75)
This error I also get in my build, but it doesn't seem to break anything for me.
Hi, as I see in your PR, you just add "godot --editor --headless --quit" as import step. So I decided to try it again on beta-8. And no luck.
In godot3, actually, godot --export
automatically reimports.
This behaviour seems to have changed in godot4, however, and if the resources are not imported, there are no textures.
Is there a workaround for Godot 4? I have the same issue for iOS exports in my GitHub Actions pipeline.
@marius-se
There is the timeout 60 godot -e
, but that may or may not work. Maybe you could include the .import
folder?
iOS exports
Slightly off-topic, but how exactly do you export for iOS, and would you mind pointing me to your workflow?
@bend-n Hmm I don't know if I like including the .import folder. Also I realised some nodes, like NavigationRegion3D
, are missing e.g. their navigation mesh if I clone the project on a new computer (non-CI)
Sure, but let's not pollute this PR and move the discussion over to this gist:
From my testing, export with deleted .godot now seems to work properly, but only if .godot/editor and .godot/imported exists.
#72360 has a better description of the problem, has a MRP and it's more recent. I might prefer to close this one in favor of that. (I suspect the cyclic reference issues were already fixed by now, so that's not relevant any more?)
--editor --quit is not reimporting assets reliably. I'm not sure if it should or not but that should be a separate issue.
Im not sure if this is quite fixed? It exports, and creates the executable, but the executable runs with alot of errors, and the build process also has alot of errors, and doesnt function correctly. I think maybe its because of the blender files...
Im not sure if this is quite fixed? It exports, and creates the executable, but the executable runs with alot of errors, and the build process also has alot of errors...
Please open a new issue with a minimal reproduction project attached. Make sure you're using an editor build that includes https://github.com/godotengine/godot/pull/73595 too.
Never mind, my problem seems to be some other resource regression thing, and a few script errors pertaining to setting alignments on boxcontainers, and something where exporting freezes on master right now, but only on my CI...
For anyone who is still experiencing issues when trying to export with headless without an existing .godot/
folder (after #73595): My workaround is to just run the export command twice. For example:
./godot --headless --path abc/def --export-pack iOS gef/MyGame.pck
./godot --headless --path abc/def --export-pack iOS gef/MyGame.pck
After the first attempt I'm getting the following types of errors:
-
ERROR: Cannot open file 'res://.godot/imported/character.glb-2260dfd73953faa3c9da36c26ac0c54f.scn'
-
ERROR: Can't open file from path 'res://.godot/global_script_class_cache.cfg'.
-
SCRIPT ERROR: Parse Error: Could not find type "Customer" in the current scope.
-
ERROR: 2 RID allocations of type '8NavAgent' were leaked at exit.
-
ERROR: Resources still in use at exit (run with --verbose for details).
But then, after the second export things are running smooth!
The export should succeed despite the errors in theory. Those errors are noisy indications of the need to import files and generate the global script class cache, which should be done right after, and before doing the actual export. At least in my test on various projects the export was successful despite the errors.
For me, it has a few errors, some related to classes/class names, and then it just hangs indefinitely, but only on my CI. Quite strange.
- it says some stuff about classes:
SCRIPT ERROR: Parse Error: Could not find type "TrackResource" in the current scope.
at: GDScript::reload (res://globals.gd:3)
- then it mentions import issues:
ERROR: Cannot open file 'res://.godot/imported/1.wav-38f1b5e1992f840a56602f7d26b59602.sample'.
at: get_dependencies (core/io/resource_format_binary.cpp:1249)
- then it hangs (i had to add a timeout or it would go on forever)
I have some issues in godot-vrm with cyclic script references due to class_name. The first time the project is opened, some scripts give an error like:
SCRIPT ERROR: Parse Error: Identifier "VRMTopLevel" not declared in the current scope.
at: GDScript::reload (res://addons/vrm/vrm_springbone.gd:159)
SCRIPT ERROR: Parse Error: Identifier "VRMTopLevel" not declared in the current scope.
at: GDScript::reload (res://addons/vrm/vrm_springbone.gd:165)
SCRIPT ERROR: Compile Error:
at: GDScript::reload (res://addons/vrm/import_vrm.gd:-1)
SCRIPT ERROR: Compile Error:
at: GDScript::reload (res://addons/vrm/plugin.gd:-1)
The import plugin seems to partially work, but it produces some errors instantiating one of those scripts:
SCRIPT ERROR: Invalid call. Nonexistent function 'new' in base 'GDScript'.
at: _parse_secondary_node (res://addons/vrm/vrm_extension.gd:904)
If I delete only .godot/imported and reopen the project again, there are no errors. All scripts load properly and all files import correctly this time.
I wonder if it's a similar issue since the error @marius-se had also mentions a class name.
Just to see, I went back and the problem existed as early as beta10, and perhaps even earlier, so this issue has probably always existed 4.0 and not a recent regression.
I can imagine custom import plugins not working on the first attempt because of the missing class names. It's the same issue that you get when you actually open a project in the editor for the first time in non headless mode - plugins are typically broken until a restart. I would suggest opening a dedicated issue about this, and any further complex project that doesn't export properly from the command line which doesn't match this description.
I think my problem is related to the moving the global script cache out of project.godot; the new system seems a bit buggy.
I made a little python script that populates global_script_class_cache.cfg
to fix the issue.