How to compile rustc for a 32-bit little-endian PowerPC processor?
Asked Answered
F

0

7

I'm trying to compile rustc for the e5500 FreeScale process CPU, which is 32-bit and little-endian. I'm following the instructions from rust-cross.

I've tried two avenues:

powerpc-unknown-linux-gnu for 32 bits

I get an error as it can't figure out the endianess:

cargo:warning=In file included from ./compiler-rt/lib/builtins/int_types.h:21,
cargo:warning=                 from ./compiler-rt/lib/builtins/int_lib.h:75,
cargo:warning=                 from ./compiler-rt/lib/builtins/absvdi2.c:15:
cargo:warning=./compiler-rt/lib/builtins/int_endianness.h:113:2: error: #error Unable to determine endian
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "powerpc-linux-gnu-gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-fomit-frame-pointer" "-DVISIBILITY_HIDDEN" "-o" "/home/ykoehler/rust-build-powerpc-fsl-linux/build/x86_64-unknown-linux-gnu/stage2-std/powerpc-unknown-linux-gnu/release/build/compiler_builtins-05a438b00e7bb558/out/./compiler-rt/lib/builtins/absvdi2.o" "-c" "./compiler-rt/lib/builtins/absvdi2.c" with args "powerpc-linux-gnu-gcc" did not execute successfully (status code exit code: 1).

', /home/ykoehler/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.28/src/lib.rs:2314:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/home/ykoehler/rust-build-powerpc-fsl-linux/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "powerpc-unknown-linux-gnu" "-j" "4" "--release" "--features" "panic-unwind backtrace" "--manifest-path" "/home/ykoehler/rust/src/libstd/Cargo.toml" "--message-format" "json"
expected success, got: exit code: 101
failed to run: /home/ykoehler/rust-build-powerpc-fsl-linux/build/bootstrap/debug/bootstrap build
Build completed unsuccessfully in 0:00:39
make: *** [Makefile:18: all] Error 1

powerpc64le-unknown-linux-gnu for little-endian

I set -m32 in config.toml inside cflags. I get an error as the compiler I have doesn't support -m64:

CC_powerpc64le-unknown-linux-gnu = Some("powerpc64le-linux-gnu-gcc")
CFLAGS_powerpc64le-unknown-linux-gnu = Some("-ffunction-sections -fdata-sections -fPIC -m64")
running: "powerpc64le-linux-gnu-gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-m64" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/ykoehler/rust-build-powerpc-fsl-linux/build/x86_64-unknown-linux-gnu/stage2-std/powerpc64le-unknown-linux-gnu/release/build/compiler_builtins-05a438b00e7bb558/out/./compiler-rt/lib/builtins/absvdi2.o" "-c" "./compiler-rt/lib/builtins/absvdi2.c"
cargo:warning=./compiler-rt/lib/builtins/absvdi2.c:1: error: -m64 not supported in this configuration
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "powerpc64le-linux-gnu-gcc" "-O2" "-ffunction-sections" "-fdata-sections" "-fPIC" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-m64" "-fno-builtin" "-fvisibility=hidden" "-ffreestanding" "-DVISIBILITY_HIDDEN" "-o" "/home/ykoehler/rust-build-powerpc-fsl-linux/build/x86_64-unknown-linux-gnu/stage2-std/powerpc64le-unknown-linux-gnu/release/build/compiler_builtins-05a438b00e7bb558/out/./compiler-rt/lib/builtins/absvdi2.o" "-c" "./compiler-rt/lib/builtins/absvdi2.c" with args "powerpc64le-linux-gnu-gcc" did not execute successfully (status code exit code: 1).

', /home/ykoehler/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.28/src/lib.rs:2314:5
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Farnesol answered 3/7, 2019 at 19:26 Comment(1)
Hi, I've added a template project to compile rust binaries on this specific processor, please take a look github.com/DariuszOstolski/rust_ppc_e5500_templateOrphrey

© 2022 - 2024 — McMap. All rights reserved.