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

Build for aarch64-linux-android #605

Merged
merged 3 commits into from
Jan 2, 2025

Conversation

AsbjornOlling
Copy link
Contributor

@AsbjornOlling AsbjornOlling commented Dec 19, 2024

...does what it says on the tin.

We're building a Godot plugin, and people are requesting android support.

It seems to work for us:
nobodywho-ooo/nobodywho#67

There are two changes:

  1. I add the cmake flags suggested in the llama.cpp docs here, if the target string contains "android" and "aarch64"
  2. The DRY sampler contains an i8 type that is an u8 in the android NDK. I just set this type to be a u8 whe compiling for android.

I'm not really an android dev, so not an expert on any of this. But it seems to work.

Copy link
Contributor

@MarcusDunn MarcusDunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR. LGTM.

@@ -254,7 +263,7 @@ impl LlamaSampler {
.into_iter()
.map(|s| CString::new(s.as_ref()).unwrap())
.collect();
let mut seq_breaker_pointers: Vec<*const i8> =
let mut seq_breaker_pointers: Vec<*const CChar> =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let mut seq_breaker_pointers: Vec<*const CChar> =
let mut seq_breaker_pointers =

Comment on lines +23 to +31
// this is needed for the dry sampler to typecheck on android
// ...because what is normally an i8, is an u8
#[cfg(target_os = "android")]
type CChar = u8;

#[cfg(not(target_os = "android"))]
type CChar = i8;


Copy link
Contributor

@MarcusDunn MarcusDunn Dec 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// this is needed for the dry sampler to typecheck on android
// ...because what is normally an i8, is an u8
#[cfg(target_os = "android")]
type CChar = u8;
#[cfg(not(target_os = "android"))]
type CChar = i8;

@MarcusDunn
Copy link
Contributor

If the compiler can infer the type (and we avoid the platform-specific-types) that would be best.

bindgen often also generates types that work accross platforms, unsure what it should be in this case.

@MarcusDunn MarcusDunn merged commit 5df1501 into utilityai:main Jan 2, 2025
2 of 5 checks passed
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