:::{note} AI Translation Notice
This document was automatically translated by Qwen/Qwen3-8B
model, for reference only.
Source document: userland/appdev/rust-quick-start.md
Translation time: 2025-05-19 01:41:52
Translation model: Qwen/Qwen3-8B
Please report issues via Community Channel
:::
DragonOS has partial binary compatibility with Linux, so you can use the Rust compiler for Linux to compile.
:::{note} This feature requires dadk version 0.2.0 or higher. For older versions, please refer to the historical DragonOS documentation. :::
bootstrap.sh
script in the tools directory of DragonOS to initialize the environment.cargo install cargo-generate
in the terminal.Enter the following command in the terminal:
cargo generate --git https://github.com/DragonOS-Community/Rust-App-Template
To create the project. If your network is slow, please use a mirror site.
cargo generate --git https://git.mirrors.dragonos.org/DragonOS-Community/Rust-App-Template
cargo run
to run the project.user/dadk/config
directory of DragonOS, refer to the template userapp_config.toml to create a compilation configuration, and install it to the /
directory of DragonOS.
(When using the compilation command options of dadk, please use the make install
configuration in the Makefile for compilation and installation)If you need to port other libraries or programs to DragonOS, please refer to the configuration in the template.
Since DragonOS currently does not support dynamic linking, you need to specify -C target-feature=+crt-static -C link-arg=-no-pie
in RUSTFLAGS.