build android fail
Opened this issue · 0 comments
build 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
code:
///compress lz4
fn compress_lz4(bytes: &Vec<u8>, level: u32) -> anyhow::Result<Vec<u8>> {
let output = LzBuffer{
buffer: vec![0x2, 0, 0, 0, 0],
wpos: 5,
};
let mut encoder = EncoderBuilder::new()
.level(level)
.build(output)?;
let mut buffer = CompressInput{
buffer: bytes,
rpos: 0,
};
std::io::copy(&mut buffer, &mut encoder)?;
let (mut output, r) = encoder.finish();
r?;
Ok(output.buffer)
}
///decompress lz4 bytes buffer
fn decompress_lz4(bytes: &[u8], size: usize) -> anyhow::Result<Vec<u8>> {
let mut decoder = Decoder::new(std::io::Cursor::new(bytes))?;
let mut out_buffer = Vec::with_capacity(size);
std::io::copy(&mut decoder, &mut out_buffer)?;
Ok(out_buffer)
}
config:
[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"
build error:
error: failed to run custom build command for lz4-sys v1.9.3
Caused by:
process didn't exit successfully: /home/banagame/BattleServer/server/Rust/target/release/build/lz4-sys-5910c428c3e500ee/build-script-build
(exit status: 1)
--- stdout
TARGET = Some("aarch64-linux-android")
HOST = Some("x86_64-unknown-linux-gnu")
CC_aarch64-linux-android = None
CC_aarch64_linux_android = None
TARGET_CC = None
CC = None
CFLAGS_aarch64-linux-android = None
CFLAGS_aarch64_linux_android = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
running: "aarch64-linux-android-clang" "-O3" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-Wall" "-Wextra" "-o" "/home/banagame/BattleServer/server/Rust/target/aarch64-linux-android/release/build/lz4-sys-f443fb51687be329/out/liblz4/lib/lz4.o" "-c" "liblz4/lib/lz4.c"
--- stderr
error occurred: Failed to find tool. Is aarch64-linux-android-clang
installed?