-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Get it working with 0.12.0-dev / latest nightly Zig #37
Conversation
Signed-off-by: Stephen Gutekanst <[email protected]>
Signed-off-by: Stephen Gutekanst <[email protected]>
25.1.8937393 does not provide Apple Silicon toolchain binaries, only x86 ones. It also does not correctly invoke Rosetta emulation in the build scripts, BUT 24.0.8215888 actually does. [details](https://stackoverflow.com/questions/69541831/unknown-host-cpu-architecture-arm64-android-ndk-siliconm1-apple-macbook-pro) so it seems prudent to downgrade the version. Additionally, when building from an Apple Silicon host, adjust the `toolchainHostTag()` appropriately for Rosetta emulation. Signed-off-by: Stephen Gutekanst <[email protected]>
Signed-off-by: Stephen Gutekanst <[email protected]>
On macOS, `adb devices` ALWAYS has an 'offline' emulator device: ``` List of devices attached emulator-5562 offline ``` As a result, all the `adb` commands in build.zig only work if you are using the emulator. The second that you connect an actual Android device, you have two devices in the list - and it all the adb commands error out with a 'ambiguous device' error. Adding the `-d` flag everywhere tells adb to prefer physical devices, which results in build.zig only working with physical devices in practice. Long-term, I imagine you would want to make `-d` a CLI flag that can be passed to `zig build` - or perhaps even let the user select a device somehow. But this was good enough for my purposes. Signed-off-by: Stephen Gutekanst <[email protected]>
Signed-off-by: Stephen Gutekanst <[email protected]>
…OpenSL support Signed-off-by: Stephen Gutekanst <[email protected]>
Not sure if i can merge it like that, especially as you unnecessarily changed several versions of SDK/NDK/Android version where it wouldn't be necessary (you can just declare those in the build setup instead of changing the defaults) |
Can you explain that? I really don't like to see that we have two implementations of the Android stuff, as it means we both have to make either the same mistake twice or constantly monitor the other repository to backport things. What exactly would you change, and why? And can we make those changes as optional features of this repository? |
No worries, as I mentioned this was less of a 'please merge this' but rather more of a 'here's what I did, just sharing the results, hope any of this is useful to you' PR. Not asking for this to be merged as-is :) I'll close the PR, I just wanted you to be aware the code is here if you want to cherry-pick anything from it. Changing the NDK version was for good reason, see the commit message for details.
Yeah, I get that.. happy to explain:
I am grateful for ZigAndroidTemplate/you pioneering the way here, and giving me something I can reference/look at. In short I think that Mach has different constraints/goals than you w.r.t. Android support and that's not straightforward to unify with little time. |
Thanks for the clarification! |
This PR gets ZigAndroidTemplate working again with the latest Zig version.
This requires > current nightly Zig, and will not work with Zig 0.11, as
std.c
actually needs to be patched to support Android bionic libc: ziglang/zig#17176Context: I did this work as I am using this as a reference for Mach's own Android support. At this point, I will probably diverge from this repository and may not update this PR. So if anything here is not useful to you feel free to discard it - this achieved what I wanted to achieve, so I am just sharing the results with you. Feel free to integrate (or not integrate) any parts of this, I don't mind what you do with it.
I was able to confirm on an Apple Silicon host machine (any host OS should work) that:
works as expected, displays a Zig logo and when volume is turned all the way up, tapping the screen plays a quiet 'beeeep' sound with AAudio.
see individual commit messages for details, I explained the changes in there.
Helps hexops/mach#17