Skip to content
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

CLI export fails #16949

Closed
Keetz opened this issue Feb 23, 2018 · 44 comments · Fixed by #34887
Closed

CLI export fails #16949

Keetz opened this issue Feb 23, 2018 · 44 comments · Fixed by #34887
Assignees
Milestone

Comments

@Keetz
Copy link
Contributor

Keetz commented Feb 23, 2018

Godot version:

Godot 3.0 stable

OS/device including version:

Linux Mint 18.3 Sylvia 64-bit

Issue description:

Trying to export via command line throws following error:

ERROR: copy: Condition ' err ' is true. returned: err
   At: core/os/dir_access.cpp:313.

Steps to reproduce:
Just create a bare minimum project, I used one just with a single node in a scene, nothing else.
Try to export via command line.

@Goutte
Copy link
Contributor

Goutte commented Mar 5, 2018

Confirmed. The error happens when the target file already exists. Here's what I tried :

$ godot --export nanogodo_linux64 /tmp/nanogodo/build/nanogodo_linux64

Exporting only works when

  • the first parameter is a valid target name
  • the target file does not exist, and
  • the directory containing the target file does

It's not a bug per se, it's a lack of documentation.

@rajeebk
Copy link

rajeebk commented Mar 16, 2018

The error occurs even when no target file exists. And the target file never gets generated from command line. So it is a valid bug.

I confirmed with 3.0.2 stable release:

godot --export "Linux/X11" /tmp
ERROR: copy: Condition 'err ' is true. returned: err
  At: core/os/dir_access.cpp:305

I also confirmed that it exports fine from GUI editor menu.

@Goutte
Copy link
Contributor

Goutte commented Mar 16, 2018

You're right, I can't export at all using CLI with the latest master. It works with Godot 3.0 and 3.1 though.

@rajeebk
Copy link

rajeebk commented Mar 16, 2018

I tested with both Godot 3.0 and 3.0.2 they both fail. I haven't tested master, and I don't see 3.1 being released yet.

I guess I'll try master if you meant it was fixed in latest master. I uncommented the printf statement and it shows that it's trying to copy the templates/linux_x11_64_debug to the output directory. They both exist and have proper permissions.

@rajeebk
Copy link

rajeebk commented Mar 16, 2018

Ok, that was it. The output path is not supposed be a directory, but a filename. I guess the documentation wasn't updated after all.

Not a bug. It's working if I provide an output filename.

@Goutte
Copy link
Contributor

Goutte commented Mar 16, 2018

I don't see 3.1 being released yet

I mixed up the versions, my bad. I meant 3.0.1. I can export using CLI in 3.0.1 (I just did again), but not using master, with the exact same project and the exact same command.

@rajeebk
Copy link

rajeebk commented Mar 16, 2018

Thank you for the solution.

@lstep
Copy link

lstep commented Apr 5, 2018

Hello, I have this exact problem, and I specified a filename, not a directory as argument Check #17977 (I closed it as it is related to this bug report).
I just rechecked, toto does not exist, so as you commented, it should have been working/ :

$ ../../godot-server --export "Linux/X11" /tmp/toto
ERROR: initialize: AudioDriverManager: all drivers failed, falling back to dummy driver
   At: servers/audio_server.cpp:153.
ERROR: copy: Condition ' err ' is true. returned: err
   At: core/os/dir_access.cpp:305.

One difference is that I use the server version, not the GUI version which works fine (even for exporting).
Can we reopen this ticket?

@Keetz
Copy link
Contributor Author

Keetz commented Apr 5, 2018

@lstep when you say that the GUI version works fine, you mean exporting from the interface right?
Have you tried exporting through the command line, using the "normal" version of Godot? That should fail too, if not, please report back.

As I wrote in #17977 I don't think this is related to the server version, as I can reproduce the error not using the server version.

@lstep
Copy link

lstep commented Apr 9, 2018

I confirm, using the command line options from the "normal" version of Godot also fails:

~/Apps/GODOT/3.0/PRJS/vide:
$ ../../Godot_v3.0.2-stable_x11.64 --export "Linux/X11" /tmp/toto
OpenGL ES 3.0 Renderer: GeForce GTX 1050/PCIe/SSE2
ERROR: copy: Condition ' err ' is true. returned: err
   At: core/os/dir_access.cpp:305.

And just to be sure, there is no /tmp/foo file :

 ls -al /tmp/foo
ls: cannot access '/tmp/foo': No such file or directory

So the only way to export is to go through the GUI interface to export.

@akien-mga
Copy link
Member

$ ../../Godot_v3.0.2-stable_x11.64 --export "Linux/X11" /tmp/toto

It's "Linux X11"

@Keetz
Copy link
Contributor Author

Keetz commented Apr 10, 2018

@akien-mga actually "Linux/X11" is now the name when you add a new Linux export preset.
Before 3.x it was "Linux X11" indeed though.

But other than that, it is also possible to rename it now, so it could be anything.

@akien-mga
Copy link
Member

Ah thanks for the clarification :)

@Keetz
Copy link
Contributor Author

Keetz commented Jun 7, 2018

Still reproduceable at b4c6509

@Keetz
Copy link
Contributor Author

Keetz commented Aug 8, 2018

Tested in 3.0.6

--export --path /path/to/Project/test_project "Linux/X11" /path/to/export/project_folder/name_of_game

^ This works as long as the destination path exists.
Let's say the folder "project_folder" doesn't exist already, it throws the error

ERROR: copy: Condition ' err ' is true. returned: err
   At: core/os/dir_access.cpp:305.

@akien-mga
Copy link
Member

akien-mga commented Aug 15, 2018

I get a different error here (Linux DirAccess), if the destination folder is missing.

3.0.6:

$ godot-3.0 --export --path ~/tmp/godot/test/v3.0_test/ "Linux/X11" ~/test/game
OpenGL ES 3.0 Renderer: GeForce GTX 670MX/PCIe/SSE2
ERROR: copy: Failed to open /home/akien/test/game
   At: core/os/dir_access.cpp:313.
ERROR: _fs_changed: Project export failed with error code 12.
   At: editor/editor_node.cpp:471.

master:

$ godot-git --export --path ~/tmp/godot/test/v3.1_test/ "Linux/X11" ~/test/game
OpenGL ES 3.0 Renderer: GeForce GTX 670MX/PCIe/SSE2
ERROR: copy: Failed to open 
   At: core/os/dir_access.cpp:304.
ERROR: _fs_changed: Project export failed with error code 12.
   At: editor/editor_node.cpp:507.
WARNING: cleanup: ObjectDB Instances still exist!
   At: core/object.cpp:2053.

If it's present, 3.0.6 works fine, and master still fails with this "Failed to open <nothing>".

@akien-mga
Copy link
Member

akien-mga commented Aug 15, 2018

BTW I'm surprised it even works, the preset name should come right after --export.

@karl-run
Copy link

On 3.0.6 I'm not able to get it to working, even with the strange order of args you provide above

root@9da3a3680c0e:~/project# godot --export --path $(pwd)/game/ "web" $(pwd)/server/dist/public/

Yields the error:

   At: servers/audio_server.cpp:165.
ERROR: _load: Method/Function Failed, returning: RES()
   At: core/io/resource_loader.cpp:186.
ERROR: start: Condition ' !scene ' is true. returned: false
   At: main/main.cpp:1688.
WARNING: cleanup: ObjectDB Instances still exist!
   At: core/object.cpp:1989.

Because it tries to load res://web

This export preset works fine locally on Windows both with GUI and CLI export.

@akien-mga
Copy link
Member

akien-mga commented Aug 26, 2018

As I mentioned in #16949 (comment), the preset name should come right after --export, so it should be:

godot --export "web" --path $(pwd)/game/ $(pwd)/server/dist/public/

@karl-run
Copy link

That does not work either:

root@9c1411505f27:~/project# godot -v --export "web" --path $(pwd)/game/ $(pwd)/server/dist/public/
ERROR: initialize: AudioDriverManager: all drivers failed, falling back to dummy driver
   At: servers/audio_server.cpp:165.
CORE API HASH: 0
EDITOR API HASH: 0
load resource: res://web
ERROR: _load: Method/Function Failed, returning: RES()
   At: core/io/resource_loader.cpp:186.
ERROR: start: Condition ' !scene ' is true. returned: false
   At: main/main.cpp:1688.
WARNING: cleanup: ObjectDB Instances still exist!
   At: core/object.cpp:1989.

@akien-mga
Copy link
Member

Seems like you have to give the binary name you want:

godot --export <preset name> /export/folder/binary_name

@karl-run
Copy link

This is a HTML5 export, so the result should be 5 files. So if giving the binary name similar to the GUI export, where one would give the name "index" and the all the files would be index.js, index.pck etc, then this command would make sense:

root@acd0e0b415bb:~/project#  godot -v --export "web" --path $(pwd)/game/ $(pwd)/server/dist/public/index
ERROR: initialize: AudioDriverManager: all drivers failed, falling back to dummy driver
   At: servers/audio_server.cpp:165.
CORE API HASH: 0
EDITOR API HASH: 0
load resource: res://web
ERROR: _load: Method/Function Failed, returning: RES()
   At: core/io/resource_loader.cpp:186.
ERROR: start: Condition ' !scene ' is true. returned: false
   At: main/main.cpp:1688.
WARNING: cleanup: ObjectDB Instances still exist!
   At: core/object.cpp:1989.

But it still does not work.

@leonkrause
Copy link
Contributor

leonkrause commented Aug 26, 2018 via email

@hedin-hiervard
Copy link
Contributor

hedin-hiervard commented Sep 4, 2018

I confirm I'm getting Error 12 with headless 3.0.6 when exporting Mac OS version and Error 7 when exporting Window version.

@hedin-hiervard
Copy link
Contributor

Ok, I resolved this.
The templates path should be as mentioned here:
godotengine/godot-docs#1247

@reduz
Copy link
Member

reduz commented Sep 6, 2018

@akien-mga, @hpvb what should we do with this?

@akien-mga
Copy link
Member

I'll rework the mess that is our command line interface eventually.

@tle-stratus
Copy link

I'm getting the exact same error, and error code as @karl-run

ERROR: initialize: AudioDriverManager: all drivers failed, falling back to dummy driver
At: servers/audio_server.cpp:165.
exporting res://snip.tscn
...
ERROR: _fs_changed: Project export failed with error code 7.
At: editor/editor_node.cpp:471.
ERROR: ~List: Condition ' _first != __null ' is true.
At: core/self_list.h:100.
ERROR: cleanup: There are still MemoryPool allocs in use at exit!

when attempting to HTML5 export via the headless linux binary on an ubuntu 18.04 server. I also created the template path as described by @hedin-hiervard: godotengine/godot-docs#1247 with no difference at all. Any suggestions?

@fire
Copy link
Member

fire commented Nov 9, 2018

I was able to export from my continuous delivery server. (gocd)

Hope this can help someone else.

- buildStage: 
          jobs:            
            buildJob:
              resources:
                - linux
                - mingw5
              artifacts:
                - build:
                    source: "export_windows"
                - build:
                    source: "export_osx"
                - build:
                    source: "export_linux"
                - build:
                    source: "export_linux_server"
              tasks:
                - fetch:
                    artifact_origin: gocd
                    source: "godot_server.x11.opt.tools.64.llvm"
                    destination: ""
                    is_file: yes
                    pipeline: godot-groups
                    stage: defaultStage
                    job: serverJob
                - fetch:
                    artifact_origin: gocd
                    source: "godot.templates.tpz"
                    destination: ""
                    is_file: yes
                    pipeline: godot-groups
                    stage: templateZipStage
                    job: defaultJob      
                - exec: 
                    arguments:
                      - "-c"
                      - "mkdir -p groups"
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "chmod +x ../b/repo && HOME=`pwd` ../b/repo init -u https://example.com/example/example.git -m build.xml"
                    command: "/bin/bash"
                    working_directory: "groups"
                - exec:
                    arguments:
                      - "-c"
                      - "chmod +x ../b/repo && HOME=`pwd` ../b/repo sync --force-sync"
                    command: "/bin/bash"
                    working_directory: "groups"
                - exec:
                    arguments:
                      - "-c"
                      - "git lfs fetch" 
                    command: "/bin/bash"
                    working_directory: "groups"
                - exec:
                    arguments:
                      - "-c"
                      - "mkdir -p .local/share/godot/ .config .cache" 
                    command: "/bin/bash"
                    working_directory: "groups"
                - exec:
                    arguments:
                      - "-c"
                      - "unzip godot.templates.tpz" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "rm -rf .local/share/godot/templates/" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "mkdir -p .local/share/godot/templates/`cat templates/version.txt`" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "mkdir -p .local/share/godot/templates/`cat templates/version.txt`" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "cp templates/* .local/share/godot/templates/`cat templates/version.txt`" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "cp templates/* .local/share/godot/templates/`cat templates/version.txt`" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "rm -rf templates" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "rm -rf export_windows" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "mkdir -p export_windows" 
                    command: "/bin/bash"
                # ./godot_server.x11.opt.tools.64.llvm --version and version.txt must be corresponding
                - exec:
                    arguments:
                      - "-c"
                      - chmod +x godot_server.x11.opt.tools.64.llvm && HOME=`pwd` ./godot_server.x11.opt.tools.64.llvm --export "Windows Desktop" --path groups ../export_windows/groups.exe || true
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "rm -rf export_osx" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "mkdir -p export_osx" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - chmod +x godot_server.x11.opt.tools.64.llvm && HOME=`pwd` ./godot_server.x11.opt.tools.64.llvm --export "Mac OSX" --path groups ../export_osx/groups.zip || true
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "rm -rf export_linux_server" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "mkdir -p export_linux_server" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - chmod +x godot_server.x11.opt.tools.64.llvm && HOME=`pwd` ./godot_server.x11.opt.tools.64.llvm --export "Linux/X11 Server" --path groups ../export_linux_server/groups.x86_64 || true
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "rm -rf export_linux" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - "mkdir -p export_linux" 
                    command: "/bin/bash"
                - exec:
                    arguments:
                      - "-c"
                      - chmod +x godot_server.x11.opt.tools.64.llvm && HOME=`pwd` ./godot_server.x11.opt.tools.64.llvm --export "Linux/X11" --path groups ../export_linux/groups.x86_64 || true
                    command: "/bin/bash"

Edit: typos.

@Cygon
Copy link
Contributor

Cygon commented Nov 10, 2018

I'm trying to export a blank Godot project on Gentoo Linux (with xdg-user-dirs installed). The headless build acts as if the ._sc_ file is present (which makes some sense, I guess, as headless is usually used for automated builds on servers).

However, it fails to create the cache dir (get_cache_path() returns './godot/cache' but it isn't created) and if I manually create that one, it get this:

Exporting Godot project to bin/Linux-AMD64/Test.x86_64
/opt/godot-3.0/bin/godot_headless.x11.tools.64 --export "Linux-AMD64" "bin/Linux-AMD64/Test.x86_64" project.godot -v
ERROR: initialize: AudioDriverManager: all drivers failed, falling back to dummy driver
   At: servers/audio_server.cpp:165.
CORE API HASH: 6850056324485626191
EDITOR API HASH: 2577452685349188824
load resource: res://default_env.tres
ERROR: create: Cannot create cache directory!
   At: editor/editor_settings.cpp:768.
load resource: res://default_env.tres
ERROR: copy: Failed to open 
   At: core/os/dir_access.cpp:304.
ERROR: _fs_changed: Project export failed with error code 12.
   At: editor/editor_node.cpp:471.
ERROR: save: Cannot save EditorSettings config, no valid path
   At: editor/editor_settings.cpp:938.
ERROR: ~List: Condition ' _first != __null ' is true.
   At: core/self_list.h:100.
ERROR: cleanup: There are still MemoryPool allocs in use at exit!
   At: core/dvector.cpp:70.
scons: done building targets.

The failed "Failed to open" message is supposed to be followed by a path, I believe.

@tle-stratus
Copy link

Thanks @fire, finally got the headless linux binary cli export to work. The bit that finally did it for me was the fact that ~/.local/share/godot/templates/{version} has to match the version.txt in the export template's version.txt.

# This will work
cat ~/.local/share/godot/templates/3.0.6.stable/version.txt 
3.0.6.stable
# This will not work
cat ~/.local/share/godot/templates/3.0.5.stable/version.txt 
3.0.6.stable

After that the export worked on the project like a charm.

@akien-mga akien-mga modified the milestones: 3.1, 3.2 Jan 19, 2019
@Keetz
Copy link
Contributor Author

Keetz commented Feb 11, 2019

Further info:

Godot 3.0.6-stable

Trying to export using a self contained version of Godot causes:

ERROR: copy: Failed to open 
   At: core/os/dir_access.cpp:304.
ERROR: _fs_changed: Project export failed with error code 12.
   At: editor/editor_node.cpp:471.

EDIT:
Templates should be in 'editor_data/templates/3.0.6.stable/' and not just 'editor_data/templates/'
That is why it didn't work.

@razcore-rad
Copy link
Contributor

Hello there. As it so happens I'm also trying to set up a CI and had this not found export template error.

When we first build the game via the godot GUI editor it creates for us a file called export_presets.cfg in the project directory. I bet that --export uses this file to search for defined presets which is counter-intuitive.

So CLI works only after you manually create this file (in the proper format of course) or after you first export for the presets you want to use. And sure, have those version/editor_data/templates etc. properly set-up too.

@Calinou
Copy link
Member

Calinou commented Mar 9, 2019

You can commit export_presets.cfg into version control, but only if it doesn't contain sensitive information like an Android keystore password. (This is why sensitive information ought to be moved to a separate file, so that export_presets.cfg can be safely committed no matter what platforms you're exporting to.)

@razcore-rad
Copy link
Contributor

That's a good point. So what's the option here then? I mean where do you store the android pass so that godot reads it and sets up the settings? If you can't use export_presets.cfg for it?

@akien-mga akien-mga modified the milestones: 3.2, 4.0 Dec 13, 2019
@akien-mga akien-mga modified the milestones: 4.0, 3.2 Jan 7, 2020
akien-mga added a commit to akien-mga/godot that referenced this issue Jan 7, 2020
I'm barely scratching the surface of the changes needed to make the
--export command line interface easy to use, but this should already
improve things somewhat.

- Streamline `can_export()` templates check in all platforms, checking
  first for the presence of official templates, then of any defined
  custom template, and reporting on the absence of any.
  Shouldn't change the actual return value much which is still true if
  either release or debug is usable - we might want to change that
  eventually and better validate against the requested target.

- Fix discrepancy between platforms using `custom_package/debug` and
  `custom_template/debug` (resp. `release`).
  All now use `custom_template`, which will break compatibility for
  `export_presets.cfg` with earlier projects (but is easy to fix).

- Use `can_export()` when attempting a command line export and report
  the same errors that would be shown in the editor.

- Improve error reporting after a failed export attempt, handling
  missing template and invalid path more gracefully.

- Cleanup of unused stuff in EditorNode around the export workflow.

- Improve --export documentation in --help a bit.

Fixes godotengine#16949 (at least many of the misunderstandings listed there).
Fixes godotengine#18470.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.