FillZpp / sys-info-rs

Get system information in Rust.
MIT License
169 stars 58 forks source link

sys-info can't be installed on termux #116

Open Kreijstal opened 8 months ago

Kreijstal commented 8 months ago

Describe the bug try cargo install sys-info

To Reproduce I tried running cargo install bat, since sys-info is a dependency.

error: failed to run custom build command for `sys-info v0.9.1`

Caused by:
  process didn't exit successfully: `/data/data/com.termux/files/usr/tmp/cargo-installKZRXcQ/release/build/sys-info-26f569e1e06f06ef/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("aarch64-linux-android")
  OPT_LEVEL = Some("3")
  HOST = Some("aarch64-linux-android")
  cargo:rerun-if-env-changed=CC_aarch64-linux-android
  CC_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CC_aarch64_linux_android
  CC_aarch64_linux_android = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("false")
  CARGO_CFG_TARGET_FEATURE = Some("neon")
  cargo:rerun-if-env-changed=CFLAGS_aarch64-linux-android
  CFLAGS_aarch64-linux-android = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_linux_android
  CFLAGS_aarch64_linux_android = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  running: "aarch64-linux-android-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-o" "/data/data/com.termux/files/usr/tmp/cargo-installKZRXcQ/release/build/sys-info-51d975ed4f6238fe/out/c/linux.o" "-c" "c/linux.c"
  cargo:warning=c/linux.c:96:11: error: call to undeclared library function 'index' with type 'char *(const char *, int)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

  cargo:warning=   96 |                 mount = index(procline, ' ');

  cargo:warning=      |                         ^

  cargo:warning=c/linux.c:96:11: note: include the header <strings.h> or explicitly provide a declaration for 'index'

  cargo:warning=1 error generated.

  exit status: 1

  --- stderr

  error occurred: Command "aarch64-linux-android-gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-o" "/data/data/com.termux/files/usr/tmp/cargo-installKZRXcQ/release/build/sys-info-51d975ed4f6238fe/out/c/linux.o" "-c" "c/linux.c" with args "aarch64-linux-android-gcc" did not execute successfully (status code exit status: 1).

warning: build failed, waiting for other jobs to finish...
error: failed to compile `bat v0.24.0`, intermediate artifacts can be found at `/data/data/com.termux/files/usr/tmp/cargo-installKZRXcQ`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Biswa96 commented 3 weeks ago

You can patch the sys-info crate like this https://github.com/termux/termux-packages/commit/f4b20cc4c6e4d580700c41509f995e5f235031ba