How do I cross-compile the Rodio / alsa-sys crate for a Raspberry PI (armv7-unknown-linux-gnueabihf)?

Viewed 369

I would like to cross-compile some Rust code for a Raspberry Pi, i.e. use the armv7-unknown-linux-gnueabihf linker. In this package, I used the Rodio library for interfacing with the sound system. This package compiles and runs fine on the build OS (macOS) but I cant compile it to the target, because I then get this error.

Compiling backtrace-sys v0.1.33    Compiling alsa-sys v0.1.2    Compiling minimp3-sys v0.3.2    Compiling syn v1.0.16    Compiling lewton v0.9.4 error: failed to run custom build command for `alsa-sys v0.1.2`

Caused by:   process didn't exit successfully: `$HOME/Documents/Personal/Code/Projects/rust_playground/handtekening/target/debug/build/alsa-sys-643139a54771ba41/build-script-build` (exit code: 101)
--- stderr thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "Cross compilation detected. Use PKG_CONFIG_ALLOW_CROSS=1 to override"', src/libcore/result.rs:1188:5 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish... error: failed to run custom build command for `backtrace-sys v0.1.33`

Caused by:   process didn't exit successfully: `$HOME/Documents/Personal/Code/Projects/rust_playground/handtekening/target/debug/build/backtrace-sys-3dc6e67ada300248/build-script-build` (exit code: 1)
--- stdout cargo:rustc-cfg=rbt TARGET = Some("armv7-unknown-linux-gnueabihf") OPT_LEVEL = Some("0") HOST = Some("x86_64-apple-darwin") CC_armv7-unknown-linux-gnueabihf = None CC_armv7_unknown_linux_gnueabihf = None TARGET_CC = None CC = None CROSS_COMPILE = None CFLAGS_armv7-unknown-linux-gnueabihf = None CFLAGS_armv7_unknown_linux_gnueabihf = None TARGET_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None CARGO_CFG_TARGET_FEATURE = None running: "arm-linux-gnueabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv7-a" "-I" "src/libbacktrace" "-I" "/Users/tresink/Documents/Personal/Code/Projects/rust_playground/handtekening/target/armv7-unknown-linux-gnueabihf/debug/build/backtrace-sys-771c80e09bcc7056/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" "-Dmacho_get_view=__rbt_macho_get_view" "-Dmacho_symbol_type_relevant=__rbt_macho_symbol_type_relevant" "-Dmacho_get_commands=__rbt_macho_get_commands" "-Dmacho_try_dsym=__rbt_macho_try_dsym" "-Dmacho_try_dwarf=__rbt_macho_try_dwarf" "-Dmacho_get_addr_range=__rbt_macho_get_addr_range" "-Dmacho_get_uuid=__rbt_macho_get_uuid" "-Dmacho_add=__rbt_macho_add" "-Dmacho_add_symtab=__rbt_macho_add_symtab" "-Dmacho_file_to_host_u64=__rbt_macho_file_to_host_u64" "-Dmacho_file_to_host_u32=__rbt_macho_file_to_host_u32" "-Dmacho_file_to_host_u16=__rbt_macho_file_to_host_u16" "-o" "$HOME/Documents/Personal/Code/Projects/rust_playground/handtekening/target/armv7-unknown-linux-gnueabihf/debug/build/backtrace-sys-771c80e09bcc7056/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c"

--- stderr


error occurred: Failed to find tool. Is `arm-linux-gnueabihf-gcc` installed?



warning: build failed, waiting for other jobs to finish... error: failed to run custom build command for `minimp3-sys v0.3.2`

Caused by:   process didn't exit successfully: `$HOME/Documents/Personal/Code/Projects/rust_playground/handtekening/target/debug/build/minimp3-sys-592af14148b11e3c/build-script-build` (exit code: 1)
--- stdout TARGET = Some("armv7-unknown-linux-gnueabihf") OPT_LEVEL = Some("0") HOST = Some("x86_64-apple-darwin") CC_armv7-unknown-linux-gnueabihf = None CC_armv7_unknown_linux_gnueabihf = None TARGET_CC = None CC = None CROSS_COMPILE = None CFLAGS_armv7-unknown-linux-gnueabihf = None CFLAGS_armv7_unknown_linux_gnueabihf = None TARGET_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None DEBUG = Some("true") CARGO_CFG_TARGET_FEATURE = None running: "arm-linux-gnueabihf-gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-march=armv7-a" "-I" "minimp3/" "-Wall" "-Wextra" "-DMINIMP3_IMPLEMENTATION" "-o" "$HOME/Documents/Personal/Code/Projects/rust_playground/handtekening/target/armv7-unknown-linux-gnueabihf/debug/build/minimp3-sys-0a9af7541b5f3089/out/minimp3.o" "-c" "minimp3.c"

--- stderr


error occurred: Failed to find tool. Is `arm-linux-gnueabihf-gcc` installed?



warning: build failed, waiting for other jobs to finish... error: linker `arm-linux-gnueabihf` not found   |   = note: No such file or directory (os error 2)

error: aborting due to previous error

error: could not compile `lewton`. warning: build failed, waiting for other jobs to finish... error: build failed`

I think it is because I didn't compile the rodio package for the target, because all the failing compiling targets are audio related, but I can't find how to include this library in the cross-compilation process.

0 Answers
Related