Wrong TARGET when crosscompiling rust package for aarch64.
I am not sure this is a problem of pmbootstrap.
I made a toy APK build example so you can reproduce the issue.APKBUILD.
When using pmbootstrap --details-to-stdout build --arch aarch64 libloading
, his will fail:
aused by:
process didn't exit successfully: `/home/pmos/build/src/rust_libloading-0.5.0/target/release/build/libloading-c14ce05bc0f3c16b/build-script-build` (exit code: 1)
--- stdout
cargo:rustc-link-lib=dl
TARGET = Some("x86_64-alpine-linux-musl")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-alpine-linux-musl")
CC_x86_64-alpine-linux-musl = None
CC_x86_64_alpine_linux_musl = None
HOST_CC = None
CC = Some("gcc")
CFLAGS_x86_64-alpine-linux-musl = None
CFLAGS_x86_64_alpine_linux_musl = None
HOST_CFLAGS = None
CFLAGS = Some("-Os -fomit-frame-pointer")
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = None
running: "gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-Os" "-fomit-frame-pointer" "-o" "/home/pmos/build/src/rust_libloading-0.5.0/target/release/build/libloading-aca586fba11c4de6/out/src/os/unix/global_static.o" "-c" "src/os/unix/global_static.c"
cargo:warning=aarch64-alpine-linux-musl-gcc: error: unrecognized command line option '-m64'
exit code: 1
--- stderr
error occurred: Command "gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-Os" "-fomit-frame-pointer" "-o" "/home/pmos/build/src/rust_libloading-0.5.0/target/release/build/libloading-aca586fba11c4de6/out/src/os/unix/global_static.o" "-c" "src/os/unix/global_static.c" with args "gcc" did not execute successfully (status code exit code: 1).
As you can see TARGET = Some("x86_64-alpine-linux-musl")
which is used by cc
to generate correct gcc
options. Here cc
is used in libloading
crate in build.rs
to compile a c file.
However doing:
pmbootstrap chroot -b aarch64
/home/pmos/build/src/rust_libloading-0.5.0/
cargo build --release
works fine.
Edited by Administrator