Repository: sharkdp/fd (language: rust)

Issue:
Fd does not build inside termux on Android (aarch64) due to jemalloc usage
**Describe the bug you encountered:**
fd fails to build on aarch64

**Describe what you expected to happen:**
jemalloc not being used, so the build does not crash

**What version of `fd` are you using?**
<!-- paste the output of `fd --version` here -->
8.1.1

**Which operating system / distribution are you on?**
Unix: Linux 4.4.226-lineageos aarch64 and *no lsb_release* (Android)

Appended logfile.

What kind of performance boost does jemalloc offer? Do you plan on supporting Android-like platforms? 


Discussion / hints:
[err_install_fd.txt](https://github.com/sharkdp/fd/files/5011543/err_install_fd.txt)

> Do you plan on supporting Android-like platforms?

I'd be okay to merge changes if someone wants to work on that. Ideally, we should also add CI support for that platform. Otherwise we can not guarantee that things won't break in the future. I'm most probably not going to work on this myself.

> What kind of performance boost does jemalloc offer?

See this blog post: https://dev.to/sharkdp/an-unexpected-performance-regression-11ai

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2fe4ed1c4..a3e32ca94 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,9 @@
 - Improved the usability of the time-based options, see #624 and #645 (@gorogoroumaru)
 
 ## Bugfixes
+
+- Disable jemalloc on Android, see #662
+
 ## Changes
 ## Other
 
diff --git a/Cargo.toml b/Cargo.toml
index 2c052feeb..4ef3d796e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -61,7 +61,7 @@ libc = "0.2"
 # FIXME: Re-enable jemalloc on macOS
 # jemalloc is currently disabled on macOS due to a bug in jemalloc in combination with macOS
 # Catalina. See https://github.com/sharkdp/fd/issues/498 for details.
-[target.'cfg(all(not(windows), not(target_os = "macos"), not(target_env = "musl")))'.dependencies]
+[target.'cfg(all(not(windows), not(target_os = "android"), not(target_os = "macos"), not(target_env = "musl")))'.dependencies]
 jemallocator = "0.3.0"
 
 [dev-dependencies]
diff --git a/src/main.rs b/src/main.rs
index 4c95f06a2..235866936 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -34,7 +34,7 @@ use crate::regex_helper::pattern_has_uppercase_char;
 
 // We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/481
 // FIXME: re-enable jemalloc on macOS, see comment in Cargo.toml file for more infos
-#[cfg(all(not(windows), not(target_os = "macos"), not(target_env = "musl")))]
+#[cfg(all(not(windows), not(target_os = "android"), not(target_os = "macos"), not(target_env = "musl")))]
 #[global_allocator]
 static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
 


Test patch: