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

iOS support #498

Open
moberer opened this issue Nov 26, 2023 · 6 comments
Open

iOS support #498

moberer opened this issue Nov 26, 2023 · 6 comments
Labels
c: ios iOS export target feature Adds functionality to the library

Comments

@moberer
Copy link

moberer commented Nov 26, 2023

This issue is for tracking the state of iOS support.

  • What are current hurdles?
  • What should be next steps anyone can take?

More specifically:

  • Has anyone gotten a gdext project to build & run for iOS yet?
    • If not, where did you get stuck?
    • If you have gotten it to run: Did you notice any higher level issues? (Certain calls not working, etc.)
@Bromeon Bromeon added the feature Adds functionality to the library label Nov 26, 2023
@MeganSpencer
Copy link

Tangentially related, but still related. Spent a few hours trying to see if I can use Godot + Rust to make a simple iOS app. I got stuck at the very start of the process. After creating a basic rust library with a simple test node and test function inside that node. It turns out doing something as simple as editing that function, and doing cargo build && cp ... into the Godot folder causes Godot 4.2 and 4.2.1 to crash. The solution is to quit Godot before you do the cargo build && cp ... and I just can't imagine quitting and restarting Godot every time I change a line of code.

If I can get past this pain point, I will test the next steps towards getting it working on my phone.

@johnsonbaugh
Copy link

johnsonbaugh commented Jan 3, 2024

I was able to export and run the book's Hello World project on an iPhone in 4.2.1. I had to disable the OpenXR APIs before it would work. I had no issues with the editor crashing.

@Bromeon
Copy link
Member

Bromeon commented Jan 3, 2024

@johnsonbaugh Great to hear! Apart from excluding OpenXR* classes, was there anything special you needed to configure?

What toolchain did you use?

@johnsonbaugh
Copy link

Using stable-aarch64-apple-darwin. Ultimately I think everything else I did was straightforward.

Added aarch64-apple-ios target:

rustup target add aarch64-apple-ios

Added .gdextension entries:

ios.debug.arm64 =        "res://../rust/target/aarch64-apple-ios/debug/librust_project.dylib"
ios.release.arm64 =      "res://../rust/target/aarch64-apple-ios/release/librust_project.dylib"

Built for iOS:

cargo build --target=aarch64-apple-ios

@Bromeon
Copy link
Member

Bromeon commented Jan 4, 2024

Great to hear! In gdnative we had a CI job to build iOS, based on cargo-dinghy. Probably we can reuse that here.

@leanmendoza
Copy link
Contributor

leanmendoza commented Mar 2, 2024

For those who compiling without lazy-functions-table is throwring:

USER ERROR: Panic msg:
  Failed to load class method OpenXRAPIExtension::get_instance (hash 2455072627).
  Make sure gdext and Godot are compatible: https://godot-rust.github.io/book/gdext/advanced/compatibility.html
   at: <function unset> (/Users/user/.cargo/git/checkouts/gdext-76630c89719e160c/5e18af8/godot-core/src/lib.rs:107)

The issue is this because OpenXR module is not being included for iOS: https://github.com/godotengine/godot/blob/master/modules/openxr/config.py#L2

To make it work https://github.com/godot-rust/gdext/blob/master/godot-codegen/src/special_cases/special_cases.rs#L75 this line is going to be modified :D

EDIT: After #639 this should be fixed

@Bromeon Bromeon added the c: ios iOS export target label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: ios iOS export target feature Adds functionality to the library
Projects
None yet
Development

No branches or pull requests

5 participants