-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Summary
When trying to build Ruff in Termux on Android, it fails with the error unable to find library -lgcc
First, the following message is repeated many times:
'+fpmr' is not a recognized feature for this target (ignoring feature)
To finally conclude with:
...
'+fpmr' is not a recognized feature for this target (ignoring feature)
'+fpmr' is not a recognized feature for this target (ignoring feature)
error: linking with `cc` failed: exit status: 1
|
= note: "cc" "<sysroot>/tmp/rustc7xXo1P/symbols.o" "<2201 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/tmp/rustc7xXo1P/{libtikv_jemalloc_sys-*,libzstd_sys-*}.rlib" "<sysroot>/lib/rustlib/aarch64-linux-android/lib/{libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc" "-ldl" "-llog" "-lunwind" "-ldl" "-lm" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/data/data/com.termux/files/home/ruff/target/release/build/zstd-sys-8e4a345f2fc1e8e3/out" "-L" "/data/data/com.termux/files/home/ruff/target/release/build/tikv-jemalloc-sys-c141053eefecffab/out/build/lib" "-L" "/data/data/com.termux/files/home/ruff/target/release/build/tikv-jemalloc-sys-c141053eefecffab/out" "-o" "/data/data/com.termux/files/home/ruff/target/release/deps/ruff-b7c7594f40f7712c" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-Wl,-O1" "-Wl,--strip-debug" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: ld.lld: error: unable to find library -lgcc
cc: error: linker command failed with exit code 1 (use -v to see invocation)
I've found a similar issue reported to termux about vim-clap [1],
which was resolved upstream by disabling tikv-jemallocator on Android [2].
When duplicating that resolution by also disabling tikv-jemallocator in Ruff, cargo build --release will succeed, and running cargo run -p ruff -- check /path/to/file.py --no-cache also succeeds.
I don't know if that's the best solution, or even an acceptable (I'm not familiar with the Rust nor Android ecosystem), but I can create a PR with my changes for consideration.
I know there's a pre-built termux package that I can install with pkg install ruff, but I'd like to install ruff as part of a venv, for which it needs to be able to build from source.
Steps to reproduce in Termux:
pkg install build-essential rust
git clone https://github.com/astral-sh/ruff.git
cd ruff
cargo build --release
Environment:
- TERMUX_VERSION=0.118.1
- Android version: 14
- Kernel build information:
Linux localhost 5.15.153-android13-3-29539737 #1 SMP PREEMPT Fri Feb 14 18:09:51 KST 2025 aarch64 Android - Device: Samsung Galaxy Tab S9 FE (SM-X510)
- SUPPORTED_ABIS: arm64-v8a,armeabi-v7a,armeabi
- cargo: 1.86.0 (adf9b6ad1 2025-02-28)
- ruff: main branch, g1918c6162
[1] termux/termux-packages#20063
[2] liuchengxu/vim-clap#1079
Version
ruff 0.11.6 (1918c61 2025-04-18)