Jarvis C2Rust
Jarvis C2Rust(jarvis-c2rust / jc2r)是 Jarvis 的 C/C++ → Rust 迁移套件,提供完整的自动化迁移流水线:扫描(scan)→ 库替代(lib-replace)→ 模块规划(prepare)→ 转译(transpile)→ 优化(optimize),支持渐进式迁移与断点续跑。
注意:本工具是 Jarvis 的独立组件,以
jarvis-ai-assistant为运行时依赖。安装后即可独立使用,无需安装完整 Jarvis 主包。
安装
pip install jarvis-c2rust
依赖要求:Python 3.12,运行时依赖 jarvis-ai-assistant>=7.0.1(提供 Agent、CodeAgent、配置与输出等基础能力)。
C/C++ 扫描依赖 libclang(Python 绑定 clang 16-22)。按需安装对应版本:
# 例如 clang 18
pip install "jarvis-c2rust[clang18]"
# 或直接
pip install "clang>=16,<23"
同时需确保系统已安装 libclang(如 apt install llvm-18 clang-18 libclang-18-dev),或设置 LIBCLANG_PATH / LLVM_HOME 指向 libclang 所在目录。
使用
# 查看帮助
jc2r --help
jarvis-c2rust --help
# 配置管理(根符号列表、禁用库列表、附加说明等)
jc2r config
# 执行完整转译流水线(scan -> lib-replace -> prepare -> transpile -> optimize),支持断点续跑
jc2r run
# 验证功能对齐
jc2r verify
或模块方式:
python -m jarvis.jarvis_c2rust.cli <subcommand>
核心数据
所有路径均推荐使用 <project_root>/.jarvis/c2rust 下的标准文件名,便于断点续跑与复用:
- 统一符号表(JSONL):
<project_root>/.jarvis/c2rust/symbols.jsonl(后续流程的主输入) - 原始符号表(JSONL):
<project_root>/.jarvis/c2rust/symbols_raw.jsonl - 其他产物:
translation_order.jsonl、library_replacements.jsonl、progress.json、config.json、symbol_map.jsonl等
开发
pip install -e ".[dev]"
pytest
许可证
MIT
Metadata
Release files for jarvis-c2rust 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jarvis_c2rust-0.1.0.tar.gz | 199.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jarvis_c2rust-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 437.0 kB
Release files / jarvis_c2rust-0.1.0.tar.gz
| Download URL | jarvis_c2rust-0.1.0.tar.gz |
|---|---|
| Size | 199.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
99bd1f5cca898a7ea49608b612bf7429fe05e099a4ff85fe08be00ce5668fade
|
|
BLAKE2b-256 checksum How to use checksums |
a1c7e950fa13f1aa0e3d2d36d96c4839f96d9d5e8e2872f96fbef842dbe560e8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / jarvis_c2rust-0.1.0-py3-none-any.whl
| Download URL | jarvis_c2rust-0.1.0-py3-none-any.whl |
|---|---|
| Size | 237.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a59c67a417bb3b178b8d1864c13d333f444189d33e355b739f5f0e24ebe05984
|
|
BLAKE2b-256 checksum How to use checksums |
6d515feab608a8b22c30e3de97dd56e73d030027c9566dfca4b21f3bbd290521
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|