Cargo build script to compile binaries as static library to be linked with an external linker

⚓ Rust    📅 2025-10-08    👤 surdeus    👁️ 5      

surdeus

I have been programming in rust on the PS3 with no_std.
As part of my build process I do the following.

cargo +nightly build -Zbuild-std --lib --target powerpc64-unknown-linux-gnu
cp target/powerpc64-unknown-linux-gnu/debug/libmain.a /opt/blackbox
make -C /opt/blackbox
cp /opt/main.self .

I would prefer to be able to just run

cargo +nightly build -Zbuild-std --target powerpc64-unknown-linux-gnu
cargo +nightly run -Zbuild-std --target powerpc64-unknown-linux-gnu

I am very unfamiliar with build scripts, and building a static library as a build script is an uncommon one.

2 posts - 2 participants

Read full topic

🏷️ Rust_feed