Environment:1jehuang Jcode Cargo Toolchain
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, DevTools |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
Rust toolchain (edition 2024) required for building the jcode binary via cargo build --profile selfdev.
Description
The Cargo Toolchain environment provides the Rust compiler and Cargo package manager needed to compile the jcode workspace. The repository uses Rust edition 2024 and contains a large workspace with 100+ member crates. Self-dev builds use the selfdev profile, which enables optimized serde_json/serde dependencies for faster incremental compilation while keeping debug symbols. The toolchain must support the edition = "2024" syntax in Cargo.toml.
Usage
Use this environment when running jcode self-dev --build to compile a fresh binary from source. It is the mandatory prerequisite for the run_self_dev implementation and any contributor who wants to build and test changes locally.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, Windows (WSL2) | Unix-like preferred for socket support |
| Hardware | Modern CPU, 4+ cores | Large workspace benefits from parallel compilation |
| Disk | 5GB+ free space | target/ directory grows large with 100+ crates
|
Dependencies
System Packages
- `rustc` (edition 2024 support, stable channel >= 1.85)
- `cargo` (matching version)
- `pkg-config` (for native TLS/openssl linkage on Linux compat builds)
Workspace Dependencies
- `tokio` = 1 (async runtime)
- `reqwest` = 0.12 (HTTP client, rustls-tls)
- `ratatui` = 0.30 (TUI framework)
- `crossterm` = 0.29 (terminal backend)
- `clap` = 4 (CLI parsing)
- `serde` / `serde_json` = 1 (serialization)
Credentials
No credentials required for building. Provider API keys are needed only at runtime, not compile time.
Quick Install
# Install Rust toolchain via rustup (provides edition 2024 support)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
# Verify edition 2024 support
rustc --edition 2024 --version
# Build the self-dev profile
cargo build --profile selfdev
Code Evidence
Edition declaration from Cargo.toml:5:
edition = "2024"
Self-dev profile configuration from Cargo.toml:299:
[profile.selfdev]
# Optimized serde_json/serde for faster incremental compilation
Large workspace declaration from Cargo.toml:8-99:
[workspace]
members = [
".",
"crates/jcode-agent-runtime",
"crates/jcode-app-core",
"crates/jcode-base",
# ... 100+ crates total
]
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `edition2024 is unstable` | Rust toolchain too old | rustup update stable to get >= 1.85
|
| `linking with cc failed` | Missing C compiler or pkg-config | apt install build-essential pkg-config
|
| `cargo build` takes very long | 100+ crate workspace | Use --profile selfdev for optimized incremental builds
|
Compatibility Notes
- Linux: CentOS 7 compatibility builds require
linux-compat-vendored-opensslfeature for bundled OpenSSL with glibc 2.17 baseline. - macOS: Requires Xcode command-line tools for linking. Uses
global-hotkeyandobjc2crates for native integrations. - Windows: Uses
windows-syscrate; Unix socket support limited. The harness API bridge is Unix-only ([target.'cfg(unix)'.dependencies]).