1

I am trying to create a statically linked version of a Rust program on ARMv7 (Raspian/Debian) by using the armv7-unknown-linux-musleabihf target in Cargo. The build fails for the dependency backtrace-sys v0.1.28 with

error: failed to run custom build command for `backtrace-sys v0.1.28`
process didn't exit successfully: `/home/pi/develop/balena.io/migrate/target/debug/build/backtrace-sys-7330a27c773191d1/build-script-build` (exit code: 101)
--- stdout
cargo:rustc-cfg=rbt
TARGET = Some("armv7-unknown-linux-musleabihf")
OPT_LEVEL = Some("0")
HOST = Some("armv7-unknown-linux-gnueabihf")
CC_armv7-unknown-linux-musleabihf = None
CC_armv7_unknown_linux_musleabihf = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_armv7-unknown-linux-musleabihf = None
CFLAGS_armv7_unknown_linux_musleabihf = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("crt-static")
running: "arm-linux-musleabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-static" "-march=armv7-a" "-I" "src/libbacktrace" "-I" "/home/pi/develop/balena.io/migrate/target/armv7-unknown-linux-musleabihf/debug/build/backtrace-sys-87487ee93f4ac0ac/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=32" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-o" "/home/pi/develop/balena.io/migrate/target/armv7-unknown-linux-musleabihf/debug/build/backtrace-sys-87487ee93f4ac0ac/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c"

--- stderr
thread 'main' panicked at '

I have tried this cross compiling from Ubuntu Linux x86_64 but also natively compiling on Raspian with the same result.

It looks like the setup is missing a compiler but I have no idea how to install and supply it.

1 Answer 1

1

On the native platform, installing musl-dev and musl-tools packages and calling Cargo as follows led to a sucessful build:

CC=/usr/bin/musl-gcc cargo build --target=armv7-unknown-linux-musleabihf
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.