Rust Support in OpenWRT: A Comprehensive Guide

  • Prepare the environment: Install the source package and xargo.
rustup add component rust-src
cargo install xargo

  • Specify the OpenWRT gcc environment: Copy the toolchain to the designated directory, or leave it in the source directory, and edit the specified toolchain's bin directory in the bash script ~/.bashrc for xargo to use.
  • Edit build.rs to specify the lib libraries needed during linking, as follows:
use std::env;

fn main() {
    let staging_dir = env::var("STAGING_DIR").unwrap();
    println!(
     					
Back to Top
Product has been added to your cart