godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.22k stars 20.23k forks source link

Cannot build in headless mode for iOS #76749

Open AdrKacz opened 1 year ago

AdrKacz commented 1 year ago

Godot version

4.0.2

System information

macOS

Issue description

I cannot build in headless mode on a server in my CI/CD. The build works fine on my computer. This is not related to the project structure, I got the same error unrelated to the projects.

  1. I "trick" Godot into a false build to re-create the import (there should be a command to do it, but well, that works for now, see https://github.com/godotengine/godot-proposals/issues/1362#issuecomment-1379140108)
  2. I run the export-release and it fails with almost no logs, so it is impossible to debug

Steps to reproduce

(bash)

# Create the build_ipa folder
# First, do a fake build to re-create the import
${GODOT_EXEC} --path mobile-game/ --headless --export-pack "${EXPORT_TYPE}"  ./build_pck/app.pck || true

# Do the real build
${GODOT_EXEC} --path mobile-game/ --headless --export-release "${EXPORT_TYPE}" ./build_ipa/app.ipa

That outputs (without firing errors, which is the most suspicious)

2023-05-05 13:25:21.470 Godot[1209:8260] *** +[NSString stringWithUTF8String:]: NULL cString
Godot Engine v4.0.2.stable.official.7a0977ce2 - https://godotengine.org

WARNING: Custom cursor shape not supported by this display server.
     at: cursor_set_custom_image (servers/display_server.cpp:480)
export: begin: Exporting for iOS steps: 5
export: end
ERROR: Project export for preset "iOS Production" failed.
   at: _fs_changed (editor/editor_node.cpp:1044)

Minimal reproduction project

N/A, any will work

AdrKacz commented 1 year ago

In case needed, here is the preset (this preset works, Godot succeeds to build on my local device)

Preset ``` [preset.1] name="iOS Production" platform="iOS" runnable=false dedicated_server=false custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" export_path="../exports/ios/scaling-broccoli.ipa" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false encrypt_directory=false script_encryption_key="" [preset.1.options] custom_template/debug="" custom_template/release="" architectures/arm64=true application/app_store_team_id="XXX" application/provisioning_profile_uuid_debug="" application/code_sign_identity_debug="Apple Development" application/export_method_debug=0 application/provisioning_profile_uuid_release="" application/code_sign_identity_release="Apple Development" application/export_method_release=0 application/targeted_device_family=2 application/bundle_identifier="XXX" application/signature="" application/short_version="1.2" application/version="1.2" application/icon_interpolation=4 application/launch_screens_interpolation=4 capabilities/access_wifi=true capabilities/push_notifications=false user_data/accessible_from_files_app=false user_data/accessible_from_itunes_sharing=false privacy/camera_usage_description="" privacy/camera_usage_description_localized={} privacy/microphone_usage_description="" privacy/microphone_usage_description_localized={} privacy/photolibrary_usage_description="" privacy/photolibrary_usage_description_localized={} icons/iphone_120x120="res://../arts/game-icon/GameIcon-120.png" icons/iphone_180x180="" icons/ipad_76x76="res://../arts/game-icon/GameIcon-76.png" icons/ipad_152x152="res://../arts/game-icon/GameIcon-152.png" icons/ipad_167x167="" icons/app_store_1024x1024="res://../arts/game-icon/GameIcon-1024.png" icons/spotlight_40x40="" icons/spotlight_80x80="" icons/settings_58x58="" icons/settings_87x87="" icons/notification_40x40="" icons/notification_60x60="" storyboard/use_launch_screen_storyboard=false storyboard/image_scale_mode=0 storyboard/custom_image@2x="" storyboard/custom_image@3x="" storyboard/use_custom_bg_color=false storyboard/custom_bg_color=Color(0, 0, 0, 1) landscape_launch_screens/iphone_2436x1125="" landscape_launch_screens/iphone_2208x1242="" landscape_launch_screens/ipad_1024x768="" landscape_launch_screens/ipad_2048x1536="" portrait_launch_screens/iphone_640x960="" portrait_launch_screens/iphone_640x1136="" portrait_launch_screens/iphone_750x1334="" portrait_launch_screens/iphone_1125x2436="" portrait_launch_screens/ipad_768x1024="" portrait_launch_screens/ipad_1536x2048="" portrait_launch_screens/iphone_1242x2208="" ```
AdrKacz commented 1 year ago

The command won't work also on my local device, no need to run it elsewhere.

So, this works:

  1. Open project in Godot
  2. Click Project > Exports...
  3. Select iOS Production preset
  4. Click Export Project...

PS: it doesn't work 100% as it fires an error at the end, but at least it build the correct .ipa file that I can use later on xCode and xCode can open it. Godot fails because of a problem of signatures

But that doesn't work:

  1. Open terminal and go to project folder (project parent folder in fact, the root of the git repo)
  2. Run godot --path mobile-game/ --headless --export-debug "iOS Production" exports/ios/scaling-broccoli.ipa
  3. Got the "too short build" pasted above (export: begin: Exporting for iOS steps: 5\nexport: end)

So, do you know what the editor and the command line are doing differently?

Thank you for your help ☺️

kyubuns commented 10 months ago

I am having the same problem with v4.1.3. Does anyone have any information on this?

dulvui commented 5 months ago

For my github action this works, but it can be replaced with --import once this pull request https://github.com/godotengine/godot/pull/90431 is available in a stable version

    - name: Install coreutils for gtimeout
      shell: bash
      run: brew install coreutils

    - name: Open project once to import assets
      shell: bash
      continue-on-error: true # timeout will exit with code 124 (can be replaced with "|| true")
      run: gtimeout 60 ./Godot.app/Contents/MacOS/Godot --headless --path ${{ inputs.working-directory }} -e