Building the rustc compiler from source

I am currently trying to build a toolchain that will include the rustc, rustup, cargo utilities. The toolchain is being built with buildroot + custom scripts. But I can try to manually build it without the toolchain too and get the same issues. Before going into detail, an alternative is to just cross-compile using cargo build --target=armv7-unknown-linux-gnueabi. I'm not sure if this will work for us in the long term when adding C++ code to the Rust project. Currently this works to run a simple "Hello world" on the target device.

The use case is that we are trying to start using Rust in the development process and test cross-compiling Rust to run on an armv7 32-bit platform. I have done the following:

./configure --target=armv7-unknown-linux-gnueabi --prefix=${INSTALL_DIRECTORY}/usr

The host machine is x86_64-unknown-linux-gnu.

Then I run "x.py build".

It builds the x86_64-unknown-linux-gnu llvm using my /usr/bin/g++ and gcc (11.4.0). Next it starts building compiler artifacts for the host and on stage 2 library artifacts it fails. Here is the ending output:

Building stage2 library artifacts (x86_64-unknown-linux-gnu -> armv7-unknown-linux-gnueabi)
Compiling cc v1.0.90
Compiling core v0.0.0 (/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/library/core)
Compiling libc v0.2.153
Compiling memchr v2.5.0
Compiling std v0.0.0 (/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/library/std)
Compiling compiler_builtins v0.1.108
The following warnings were emitted during compilation:

warning: compiler_builtins@0.1.108: Compiler version doesn't include clang or GCC: "/usr/bin/gcc" "--version"
warning: compiler_builtins@0.1.108: Compiler version doesn't include clang or GCC: "/usr/bin/gcc" "--version"
warning: compiler_builtins@0.1.108: Compiler version doesn't include clang or GCC: "/usr/bin/gcc" "--version"
warning: compiler_builtins@0.1.108: cc1: error: bad value (β€˜armv7-a’) for β€˜-march=’ switch
warning: compiler_builtins@0.1.108: cc1: note: valid arguments to β€˜-march=’ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 btver1 btver2 native

error: failed to run custom build command for compiler_builtins v0.1.108

Caused by:
process didn't exit successfully: /opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/build/x86_64-unknown-linux-gnu/stage2-std/release/build/compiler_builtins-1c67468359afa6f9/build-script-build (exit status: 1)
--- stdout
cargo:rerun-if-changed=build.rs
cargo:compiler-rt=/home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.108/compiler-rt
cargo:rustc-cfg=feature="unstable"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/absvdi2.c
cargo:rustc-cfg=__absvdi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/absvsi2.c
cargo:rustc-cfg=__absvsi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/absvti2.c
cargo:rustc-cfg=__absvti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/addvdi3.c
cargo:rustc-cfg=__addvdi3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/addvsi3.c
cargo:rustc-cfg=__addvsi3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/addvti3.c
cargo:rustc-cfg=__addvti3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/aeabi_cdcmp.S
cargo:rustc-cfg=__aeabi_cdcmp="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/aeabi_cdcmpeq_check_nan.c
cargo:rustc-cfg=__aeabi_cdcmpeq_check_nan="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/aeabi_cfcmp.S
cargo:rustc-cfg=__aeabi_cfcmp="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/aeabi_cfcmpeq_check_nan.c
cargo:rustc-cfg=__aeabi_cfcmpeq_check_nan="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/aeabi_div0.c
cargo:rustc-cfg=__aeabi_div0="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/aeabi_drsub.c
cargo:rustc-cfg=__aeabi_drsub="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/aeabi_frsub.c
cargo:rustc-cfg=__aeabi_frsub="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/bswapdi2.S
cargo:rustc-cfg=__bswapdi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/bswapsi2.S
cargo:rustc-cfg=__bswapsi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/clzdi2.S
cargo:rustc-cfg=__clzdi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/clzsi2.S
cargo:rustc-cfg=__clzsi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/clzti2.c
cargo:rustc-cfg=__clzti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/cmpdi2.c
cargo:rustc-cfg=__cmpdi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/cmpti2.c
cargo:rustc-cfg=__cmpti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/ctzdi2.c
cargo:rustc-cfg=__ctzdi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/ctzsi2.c
cargo:rustc-cfg=__ctzsi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/ctzti2.c
cargo:rustc-cfg=__ctzti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/divdc3.c
cargo:rustc-cfg=__divdc3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/divmodsi4.S
cargo:rustc-cfg=__divmodsi4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/divsc3.c
cargo:rustc-cfg=__divsc3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/divsi3.S
cargo:rustc-cfg=__divsi3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/extendhfsf2.c
cargo:rustc-cfg=__extendhfsf2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/ffsti2.c
cargo:rustc-cfg=__ffsti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/int_util.c
cargo:rustc-cfg=__int_util="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/modsi3.S
cargo:rustc-cfg=__modsi3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/muldc3.c
cargo:rustc-cfg=__muldc3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/mulsc3.c
cargo:rustc-cfg=__mulsc3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/mulvdi3.c
cargo:rustc-cfg=__mulvdi3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/mulvsi3.c
cargo:rustc-cfg=__mulvsi3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/mulvti3.c
cargo:rustc-cfg=__mulvti3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/negdf2.c
cargo:rustc-cfg=__negdf2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/negdi2.c
cargo:rustc-cfg=__negdi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/negsf2.c
cargo:rustc-cfg=__negsf2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/negti2.c
cargo:rustc-cfg=__negti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/negvdi2.c
cargo:rustc-cfg=__negvdi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/negvsi2.c
cargo:rustc-cfg=__negvsi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/negvti2.c
cargo:rustc-cfg=__negvti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/paritydi2.c
cargo:rustc-cfg=__paritydi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/paritysi2.c
cargo:rustc-cfg=__paritysi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/parityti2.c
cargo:rustc-cfg=__parityti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/popcountdi2.c
cargo:rustc-cfg=__popcountdi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/popcountsi2.c
cargo:rustc-cfg=__popcountsi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/popcountti2.c
cargo:rustc-cfg=__popcountti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/subvdi3.c
cargo:rustc-cfg=__subvdi3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/subvsi3.c
cargo:rustc-cfg=__subvsi3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/subvti3.c
cargo:rustc-cfg=__subvti3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/switch16.S
cargo:rustc-cfg=__switch16="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/switch32.S
cargo:rustc-cfg=__switch32="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/switch8.S
cargo:rustc-cfg=__switch8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/switchu8.S
cargo:rustc-cfg=__switchu8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_add_4.S
cargo:rustc-cfg=__sync_fetch_and_add_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_add_8.S
cargo:rustc-cfg=__sync_fetch_and_add_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_and_4.S
cargo:rustc-cfg=__sync_fetch_and_and_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_and_8.S
cargo:rustc-cfg=__sync_fetch_and_and_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_max_4.S
cargo:rustc-cfg=__sync_fetch_and_max_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_max_8.S
cargo:rustc-cfg=__sync_fetch_and_max_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_min_4.S
cargo:rustc-cfg=__sync_fetch_and_min_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_min_8.S
cargo:rustc-cfg=__sync_fetch_and_min_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_nand_4.S
cargo:rustc-cfg=__sync_fetch_and_nand_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_nand_8.S
cargo:rustc-cfg=__sync_fetch_and_nand_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_or_4.S
cargo:rustc-cfg=__sync_fetch_and_or_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_or_8.S
cargo:rustc-cfg=__sync_fetch_and_or_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_sub_4.S
cargo:rustc-cfg=__sync_fetch_and_sub_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_sub_8.S
cargo:rustc-cfg=__sync_fetch_and_sub_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_umax_4.S
cargo:rustc-cfg=__sync_fetch_and_umax_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_umax_8.S
cargo:rustc-cfg=__sync_fetch_and_umax_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_umin_4.S
cargo:rustc-cfg=__sync_fetch_and_umin_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_umin_8.S
cargo:rustc-cfg=__sync_fetch_and_umin_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_xor_4.S
cargo:rustc-cfg=__sync_fetch_and_xor_4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_fetch_and_xor_8.S
cargo:rustc-cfg=__sync_fetch_and_xor_8="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/sync_synchronize.S
cargo:rustc-cfg=__sync_synchronize="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/truncdfhf2.c
cargo:rustc-cfg=__truncdfhf2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/truncsfhf2.c
cargo:rustc-cfg=__truncsfhf2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/ucmpdi2.c
cargo:rustc-cfg=__ucmpdi2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/ucmpti2.c
cargo:rustc-cfg=__ucmpti2="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/udivmodsi4.S
cargo:rustc-cfg=__udivmodsi4="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/udivsi3.S
cargo:rustc-cfg=__udivsi3="optimized-c"
cargo:rerun-if-changed=/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/arm/umodsi3.S
cargo:rustc-cfg=__umodsi3="optimized-c"
TARGET = Some("armv7-unknown-linux-gnueabi")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
cargo:rerun-if-env-changed=CC_armv7-unknown-linux-gnueabi
CC_armv7-unknown-linux-gnueabi = None
cargo:rerun-if-env-changed=CC_armv7_unknown_linux_gnueabi
CC_armv7_unknown_linux_gnueabi = Some("/usr/bin/gcc")
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:warning=Compiler version doesn't include clang or GCC: "/usr/bin/gcc" "--version"
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some("false")
CARGO_CFG_TARGET_FEATURE = Some("aclass,d32,dsp,thumb2,v5te,v6,v6k,v6t2,v7,vfp2,vfp3")
cargo:rerun-if-env-changed=CFLAGS_armv7-unknown-linux-gnueabi
CFLAGS_armv7-unknown-linux-gnueabi = None
cargo:rerun-if-env-changed=CFLAGS_armv7_unknown_linux_gnueabi
CFLAGS_armv7_unknown_linux_gnueabi = Some("-ffunction-sections -fdata-sections -fPIC -march=armv7-a")
cargo:rerun-if-env-changed=CC_armv7-unknown-linux-gnueabi
CC_armv7-unknown-linux-gnueabi = None
cargo:rerun-if-env-changed=CC_armv7_unknown_linux_gnueabi
CC_armv7_unknown_linux_gnueabi = Some("/usr/bin/gcc")
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:warning=Compiler version doesn't include clang or GCC: "/usr/bin/gcc" "--version"
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("aclass,d32,dsp,thumb2,v5te,v6,v6k,v6t2,v7,vfp2,vfp3")
cargo:rerun-if-env-changed=CFLAGS_armv7-unknown-linux-gnueabi
CFLAGS_armv7-unknown-linux-gnueabi = None
cargo:rerun-if-env-changed=CFLAGS_armv7_unknown_linux_gnueabi
CFLAGS_armv7_unknown_linux_gnueabi = Some("-ffunction-sections -fdata-sections -fPIC -march=armv7-a")
cargo:rerun-if-env-changed=CC_armv7-unknown-linux-gnueabi
CC_armv7-unknown-linux-gnueabi = None
cargo:rerun-if-env-changed=CC_armv7_unknown_linux_gnueabi
CC_armv7_unknown_linux_gnueabi = Some("/usr/bin/gcc")
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:warning=Compiler version doesn't include clang or GCC: "/usr/bin/gcc" "--version"
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("aclass,d32,dsp,thumb2,v5te,v6,v6k,v6t2,v7,vfp2,vfp3")
cargo:rerun-if-env-changed=CFLAGS_armv7-unknown-linux-gnueabi
CFLAGS_armv7-unknown-linux-gnueabi = None
cargo:rerun-if-env-changed=CFLAGS_armv7_unknown_linux_gnueabi
CFLAGS_armv7_unknown_linux_gnueabi = Some("-ffunction-sections -fdata-sections -fPIC -march=armv7-a")
cargo:warning=cc1: error: bad value (β€˜armv7-a’) for β€˜-march=’ switch
cargo:warning=cc1: note: valid arguments to β€˜-march=’ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 btver1 btver2 native

--- stderr

error occurred: Command "/usr/bin/gcc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv7-a" "-ffunction-sections" "-fdata-sections" "-fPIC" "-march=armv7-a" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/build/x86_64-unknown-linux-gnu/stage2-std/armv7-unknown-linux-gnueabi/release/build/compiler_builtins-08cab28235ff9874/out/a72306d9fae7044f-absvdi2.o" "-c" "/opt/armv7_PLATFORM_linux_gnueabi_8.1-LSC/armv7-PLATFORM-linux-gnueabi/build/HOST-rust-1.77.2/src/llvm-project/compiler-rt/lib/builtins/absvdi2.c" with args "gcc" did not execute successfully (status code exit status: 1).

warning: build failed, waiting for other jobs to finish...
Building bootstrap
Build completed unsuccessfully in 0:30:47

Previously, like you, I had to build the toolset from source for that platform. I built on the target. It took many hours.

Since then, I recall rustup working on an old Raspberry Pi which I believe is armv7-unknown-linux-gnueabi. Is that not an option for you?

1 Like

Currently, it is not since the target device has no toolchain installed and runs many things via Busybox.

You need a cross-compilation C toolchain and point to it's linker and C compiler in the target section of config.toml for the target you are cross compiling for.

2 Likes

Ok.

[target.armv7-unknown-linux-gnueabi]
linker="<path_to_linker>"

But what to specify for compiler?

Assuming that the cross-toolchain uses armv7-linux-gnueabi- as prefix (so armv7-linux-gnueabi-gcc, armv7-linux-gnueabi-ld, ...) it would be something like

[target.armv7-unknown-linux-gnueabi]
linker = "armv7-linux-gnueabi-gcc"
cc = "armv7-linux-gnueabi-gcc"
cxx = "armv7-linux-gnueabi-g++"
1 Like