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

Fix Android build #629

Merged
merged 4 commits into from
Jan 30, 2025
Merged

Fix Android build #629

merged 4 commits into from
Jan 30, 2025

Conversation

vlovich
Copy link
Contributor

@vlovich vlovich commented Jan 29, 2025

The standard library predefines c_char exactly for this purpose to get rid of manual CChar type aliases. While the alias in theory looks fine, it's actually not if building for x64 Android. Similar problems exist in the CMake setup around assuming Android only targets aarch64. There's also a problem where openmp is enabled by default but for me on Android this just results in a bunch of undefined OpenMP symbols. Finally, I had issues linking against the C++ stdlib statically so made a default feature that links to the dynamic C++ library. I have confirmed that a complex Android project builds and links under cargo-ndk for all the triples listed by the cargo-ndk project.

@vlovich vlovich changed the title Fix Android build: Use FFI types directly instead of maintaining own c_char definition Fix Android x86_64 build Jan 29, 2025
@vlovich vlovich marked this pull request as draft January 29, 2025 16:22
The standard library predefines c_char exactly for this purpose to get
rid of manual CChar type aliases. While the alias in theory looks fine
it was making cargo-ndk unhappy for some reason whereas using the
natural stdlib c_char type works perfectly.
AFAICT trying to build with OpenMP support just results in a bunch of
linker errors about missing OpenMP symbols. Disable for now.
Android can target x86_64 systems too. Add support for all the triples
cargo-ndk lists as possibilities.
It's a configurable feature that can be disabled if needed, but I got a
bunch of linker errors about unavailable C++ symbols from the static
c++.a for some reason.
@vlovich vlovich changed the title Fix Android x86_64 build Fix Android builds Jan 29, 2025
@vlovich vlovich changed the title Fix Android builds Fix Android build Jan 29, 2025
@vlovich vlovich marked this pull request as ready for review January 29, 2025 17:15
@vlovich
Copy link
Contributor Author

vlovich commented Jan 29, 2025

I don't believe the build failures have anything to do with my change. Looks like some platforms have bitrotted?

@MarcusDunn MarcusDunn merged commit 9b54cac into utilityai:main Jan 30, 2025
2 of 5 checks passed
@MarcusDunn
Copy link
Contributor

Yeah they have, they've been failing for a while now. Thanks for the PR!

@vlovich vlovich deleted the fix-android-build branch January 31, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants