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 android fail #82

Open
DrYaling opened this issue Jun 21, 2022 · 2 comments
Open

build android fail #82

DrYaling opened this issue Jun 21, 2022 · 2 comments

Comments

@DrYaling
Copy link

DrYaling commented Jun 21, 2022

buid command:
RUSTFLAGS='-C strip=symbols' cargo build -p 'lib_project' --release --target aarch64-linux-android
RUSTFLAGS='-C strip=symbols' cargo build -p 'lib_project' --release --target armv7-linux-androideabi
config file

[target.aarch64-linux-android]
ar = "NDK/aarch64/bin/aarch64-linux-android-ar"
linker = "NDK/aarch64/bin/aarch64-linux-android22-clang"

[target.armv7-linux-androideabi]
ar = "NDK/armv7/bin/arm-linux-androideabi-ar"
linker = "NDK/armv7/bin/armv7a-linux-androideabi22-clang"

code:

///zip compress
fn compress_zip(bytes: &Vec<u8>, level: u32) -> anyhow::Result<Vec<u8>> {
    use bzip2::write::{BzEncoder};
    let mut compressor = BzEncoder::new(vec![0x1, 0, 0, 0, 0], Compression::new(level.min(9)));
    compressor.write_all(bytes)?;
    let mut result = compressor.finish()?;
    Ok(result)
}

///zip decompress bytes buffer
fn depress_zip(bytes: &[u8], size: usize) -> anyhow::Result<Vec<u8>>{
    let mut decompressor = bzip2::read::BzDecoder::new(std::io::Cursor::new(bytes));
    let mut out_buffer = Vec::with_capacity(size);
    std::io::copy(&mut decompressor, &mut out_buffer)?;
    Ok(out_buffer)
}

error msg:

error: failed to run custom build command for bzip2-sys v0.1.11+1.0.8

Caused by:
process didn't exit successfully: /home/banagame/BattleServer/server/Rust/target/release/build/bzip2-sys-5c05721eef23dbb9/build-script-build (exit status: 1)
--- stdout
cargo:rerun-if-env-changed=BZIP2_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7-linux-androideabi
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_armv7_linux_androideabi
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_armv7-linux-androideabi
cargo:rerun-if-env-changed=PKG_CONFIG_armv7_linux_androideabi
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7-linux-androideabi
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_armv7_linux_androideabi
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
TARGET = Some("armv7-linux-androideabi")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
CC_armv7-linux-androideabi = None
CC_armv7_linux_androideabi = None
TARGET_CC = None
CC = None
CFLAGS_armv7-linux-androideabi = None
CFLAGS_armv7_linux_androideabi = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running: "arm-linux-androideabi-clang" "-O3" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "bzip2-1.0.8" "-D_FILE_OFFSET_BITS=64" "-DBZ_NO_STDIO" "-o" "/home/banagame/BattleServer/server/Rust/target/armv7-linux-androideabi/release/build/bzip2-sys-16baeea8c12f7af8/out/lib/bzip2-1.0.8/blocksort.o" "-c" "bzip2-1.0.8/blocksort.c"

--- stderr

error occurred: Failed to find tool. Is arm-linux-androideabi-clang installed?

@copoer
Copy link

copoer commented Jan 7, 2023

I am facing the same issue. I am wondering if it is possible to export some environment variable to force it to use a certain library or path.

@copoer
Copy link

copoer commented Jan 7, 2023

I was able to work around my issue using this fix: termux/termux-packages#8214

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

No branches or pull requests

2 participants