Merge _configs/ into config/ for single configuration directory. Update all path references. Changes: - Move _configs/* to config/ - Update .gitignore for new patterns - No code references to _configs/ found Impact: -1 root directory (layout_conventions.md compliance)
410 lines
8.6 KiB
Markdown
410 lines
8.6 KiB
Markdown
# Comandos Bash Usados para Investigar Target Selection
|
|
|
|
## 1. DETECTAR INFORMACIÓN DEL SISTEMA
|
|
|
|
### 1.1 Detectar el OS
|
|
```bash
|
|
uname -s
|
|
```
|
|
**Para qué:** Identifica el sistema operativo
|
|
**Resultado posible:** "Darwin" (macOS) o "Linux"
|
|
|
|
### 1.2 Detectar la Arquitectura
|
|
```bash
|
|
uname -m
|
|
```
|
|
**Para qué:** Identifica la arquitectura del procesador
|
|
**Resultado posible:** "arm64" (Apple Silicon), "x86_64" (Intel), "aarch64" (Linux ARM)
|
|
|
|
### 1.3 Información Completa del Sistema
|
|
```bash
|
|
uname -a
|
|
```
|
|
**Para qué:** Muestra toda la información: kernel, nombre host, procesador, etc.
|
|
**Ejemplo:** "Darwin MacBook.local 25.1.0 Darwin Kernel Version 25.1.0"
|
|
|
|
---
|
|
|
|
## 2. INFORMACIÓN DE RUST Y CARGO
|
|
|
|
### 2.1 Versión de Rustc
|
|
```bash
|
|
rustc --version
|
|
```
|
|
**Para qué:** Verificar versión instalada de Rust
|
|
**Resultado:** "rustc 1.91.1 (ed61e7d7e 2025-11-07)"
|
|
|
|
### 2.2 Información Detallada de Rustc
|
|
```bash
|
|
rustc --version --verbose
|
|
```
|
|
**Para qué:** Ver detalles incluyendo LLVM version
|
|
**Muestra:**
|
|
- release
|
|
- commit-hash
|
|
- commit-date
|
|
- host (target del sistema)
|
|
- LLVM version
|
|
|
|
### 2.3 El Target Host (LA CLAVE)
|
|
```bash
|
|
rustc --print host-triple
|
|
```
|
|
**Para qué:** Obtener el "triple" del sistema actual
|
|
**Resultado en M1 Mac:** "aarch64-apple-darwin"
|
|
**Resultado en Intel Mac:** "x86_64-apple-darwin"
|
|
**Resultado en Linux ARM:** "aarch64-unknown-linux-gnu"
|
|
|
|
### 2.4 Información del Toolchain
|
|
```bash
|
|
rustup toolchain list
|
|
```
|
|
**Para qué:** Ver qué toolchains están instalados
|
|
**Resultado:** "stable-aarch64-apple-darwin (default)"
|
|
|
|
### 2.5 Ruta del Toolchain
|
|
```bash
|
|
rustup which rustc
|
|
```
|
|
**Para qué:** Saber dónde está instalado rustc
|
|
**Resultado:** "/Users/jesusperezlorenzo/.rustup/toolchains/stable-aarch64-apple-darwin/bin/rustc"
|
|
|
|
### 2.6 Versión de Cargo
|
|
```bash
|
|
cargo --version
|
|
```
|
|
**Para qué:** Verificar versión de cargo
|
|
**Resultado:** "cargo 1.91.1"
|
|
|
|
---
|
|
|
|
## 3. INFORMACIÓN DE RUST AVANZADA
|
|
|
|
### 3.1 Features/Capacidades del CPU
|
|
```bash
|
|
rustc --print cfg
|
|
```
|
|
**Para qué:** Ver qué características del CPU detecta Rust
|
|
**Muestra:** target_arch, target_os, target_vendor, etc.
|
|
**Ejemplo:**
|
|
```
|
|
target_arch="aarch64"
|
|
target_os="macos"
|
|
target_vendor="apple"
|
|
target_pointer_width="64"
|
|
target_endian="little"
|
|
target_family="unix"
|
|
```
|
|
|
|
### 3.2 Todos los Targets Disponibles
|
|
```bash
|
|
rustc --print sysroot | xargs -I {} ls {}/lib/rustlib/
|
|
```
|
|
**Para qué:** Ver qué targets tiene instalados
|
|
**Ejemplo:**
|
|
```
|
|
aarch64-apple-darwin
|
|
aarch64-apple-ios
|
|
x86_64-apple-darwin
|
|
aarch64-unknown-linux-gnu
|
|
```
|
|
|
|
### 3.3 Target Triples Soportados
|
|
```bash
|
|
rustc --print target-list | head -20
|
|
```
|
|
**Para qué:** Ver todos los targets que Rust puede soportar (no solo instalados)
|
|
|
|
---
|
|
|
|
## 4. INVESTIGACIÓN DEL PROYECTO
|
|
|
|
### 4.1 Listar Estructura del Proyecto
|
|
```bash
|
|
ls -la
|
|
```
|
|
**Para qué:** Ver archivos en directorio actual
|
|
**Muestra:** Cargo.toml, scripts/, etc.
|
|
|
|
### 4.2 Verificar Config de Cargo Personalizada
|
|
```bash
|
|
cat .cargo/config.toml
|
|
```
|
|
**Para qué:** Ver si hay configuración especial de compilación
|
|
**En este proyecto:** No existe (usa valores por defecto)
|
|
|
|
### 4.3 Ver Configuración de Build en Cargo.toml
|
|
```bash
|
|
grep -A 10 "\[profile.release\]" Cargo.toml
|
|
```
|
|
**Para qué:** Ver las optimizaciones del release build
|
|
**Muestra:**
|
|
```toml
|
|
opt-level = 3
|
|
lto = true
|
|
codegen-units = 1
|
|
strip = true
|
|
```
|
|
|
|
### 4.4 Verificar Workspace Members
|
|
```bash
|
|
cargo metadata --format-version=1 --no-deps | grep -o '"name":"[^"]*"' | head -15
|
|
```
|
|
**Para qué:** Ver todos los crates en el workspace
|
|
**Muestra 14 crates diferentes**
|
|
|
|
---
|
|
|
|
## 5. BUILD Y COMPILACIÓN
|
|
|
|
### 5.1 Hacer un Dry-Run (sin compilar)
|
|
```bash
|
|
cargo build --release --dry-run --workspace
|
|
```
|
|
**Para qué:** Ver qué se compilaría sin hacerlo realmente
|
|
|
|
### 5.2 Compilar con Output Detallado
|
|
```bash
|
|
cargo build --release --workspace -v
|
|
```
|
|
**Para qué:** Ver cada comando que cargo ejecuta
|
|
**Muestra:** rustc flags, linker commands, etc.
|
|
|
|
### 5.3 Compilar Solo Debug
|
|
```bash
|
|
cargo build --workspace
|
|
```
|
|
**Para qué:** Compilación rápida para desarrollo
|
|
|
|
### 5.4 Compilar Release
|
|
```bash
|
|
cargo build --release --workspace
|
|
```
|
|
**Para qué:** Compilación optimizada para producción
|
|
|
|
---
|
|
|
|
## 6. INSPECCIÓN DEL TARGET DIRECTORY
|
|
|
|
### 6.1 Ver Tamaño de Builds
|
|
```bash
|
|
du -sh target/debug target/release
|
|
```
|
|
**Para qué:** Comparar tamaño de debug vs release
|
|
**Resultado:**
|
|
```
|
|
12G target/debug
|
|
2.4G target/release
|
|
```
|
|
|
|
### 6.2 Ver Archivos de Cache de Rustc
|
|
```bash
|
|
cat target/.rustc_info.json
|
|
```
|
|
**Para qué:** Ver información cacheada del host
|
|
**Contiene:** target_arch, target_os, CPU features, etc.
|
|
|
|
### 6.3 Listar Binarios Compilados
|
|
```bash
|
|
ls -lh target/release | grep -v "^d"
|
|
```
|
|
**Para qué:** Ver qué ejecutables se generaron
|
|
|
|
### 6.4 Ver Artifacts en target/release/deps
|
|
```bash
|
|
ls -lh target/release/deps/ | head -20
|
|
```
|
|
**Para qué:** Ver archivos objeto, librerías estáticas y dinámicas
|
|
|
|
---
|
|
|
|
## 7. CROSS-COMPILATION (EJEMPLO)
|
|
|
|
### 7.1 Listar Targets Instalados
|
|
```bash
|
|
rustup target list | grep installed
|
|
```
|
|
**Para qué:** Ver qué targets están disponibles
|
|
|
|
### 7.2 Instalar Nuevo Target
|
|
```bash
|
|
rustup target add x86_64-unknown-linux-gnu
|
|
```
|
|
**Para qué:** Agregar capacidad de compilar para Linux desde macOS
|
|
|
|
### 7.3 Compilar para Target Específico
|
|
```bash
|
|
cargo build --release --target x86_64-unknown-linux-gnu
|
|
```
|
|
**Para qué:** Cross-compile para otro sistema
|
|
|
|
### 7.4 Ver Binarios Para Diferentes Targets
|
|
```bash
|
|
ls -lh target/x86_64-unknown-linux-gnu/release/ | head -10
|
|
```
|
|
**Para qué:** Ver binarios compilados para Linux
|
|
|
|
---
|
|
|
|
## 8. VERIFICACIÓN Y TESTING
|
|
|
|
### 8.1 Verificar Compilación (sin compilar completo)
|
|
```bash
|
|
cargo check --workspace
|
|
```
|
|
**Para qué:** Verificación rápida de errores sin generar binarios
|
|
|
|
### 8.2 Ejecutar Tests
|
|
```bash
|
|
cargo test --workspace --release
|
|
```
|
|
**Para qué:** Correr todos los tests del proyecto
|
|
|
|
### 8.3 Ejecutar Tests de Librería Solo
|
|
```bash
|
|
cargo test --workspace --lib --release
|
|
```
|
|
**Para qué:** Tests sin incluir integration tests
|
|
|
|
### 8.4 Ver Qué se Compilará
|
|
```bash
|
|
cargo build --workspace --dry-run 2>&1 | head -50
|
|
```
|
|
**Para qué:** Preview sin compilar realmente
|
|
|
|
---
|
|
|
|
## 9. ANÁLISIS DE BINARIOS
|
|
|
|
### 9.1 Ver Info de Ejecutable (macOS)
|
|
```bash
|
|
file target/release/workspace
|
|
```
|
|
**Para qué:** Ver arquitectura del binario compilado
|
|
**Resultado:**
|
|
```
|
|
Mach-O 64-bit executable arm64
|
|
```
|
|
|
|
### 9.2 Ver Info de Ejecutable (Linux)
|
|
```bash
|
|
file target/release/workspace
|
|
```
|
|
**Para qué:** En Linux, muestra si es x86_64 o aarch64
|
|
**Resultado:**
|
|
```
|
|
ELF 64-bit LSB pie executable, x86-64
|
|
```
|
|
|
|
### 9.3 Ver Símbolos en Binario
|
|
```bash
|
|
nm target/release/workspace | head -20
|
|
```
|
|
**Para qué:** Ver funciones y símbolos (vacío si está stripped)
|
|
|
|
### 9.4 Ver Tamaño de Binarios
|
|
```bash
|
|
ls -lh target/release/{workspace,syntaxis-tui,syntaxis-dashboard}
|
|
```
|
|
**Para qué:** Comparar tamaños de cada binario
|
|
|
|
---
|
|
|
|
## 10. SETUP DE TOOLCHAIN
|
|
|
|
### 10.1 Ver Versión Default
|
|
```bash
|
|
rustup default
|
|
```
|
|
**Para qué:** Saber qué toolchain se usa por defecto
|
|
|
|
### 10.2 Cambiar Versión Default
|
|
```bash
|
|
rustup default stable
|
|
```
|
|
**Para qué:** Usar la versión stable actual
|
|
|
|
### 10.3 Actualizar Rust
|
|
```bash
|
|
rustup update
|
|
```
|
|
**Para qué:** Actualizar todo el toolchain a versiones más nuevas
|
|
|
|
### 10.4 Ver Sysroot (ubicación de librerías std)
|
|
```bash
|
|
rustc --print sysroot
|
|
```
|
|
**Para qué:** Donde está instalada la librería estándar de Rust
|
|
|
|
---
|
|
|
|
## RESUMEN DE COMANDOS MÁS IMPORTANTES
|
|
|
|
Para investigar **target selection**, estos fueron los CRÍTICOS:
|
|
|
|
```bash
|
|
# 1. Detectar el sistema
|
|
uname -s # OS
|
|
uname -m # Arquitectura
|
|
|
|
# 2. Saber qué target usa Rust
|
|
rustc --print host-triple
|
|
|
|
# 3. Ver qué se puede compilar
|
|
rustc --print cfg # Features del CPU
|
|
rustc --print target-list | grep -i linux
|
|
|
|
# 4. Verificar el proyecto
|
|
cargo metadata --format-version=1 --no-deps
|
|
|
|
# 5. Ver cómo se compila
|
|
cargo build --release -v
|
|
|
|
# 6. Verificar binarios generados
|
|
file target/release/workspace
|
|
ls -lh target/release/
|
|
```
|
|
|
|
---
|
|
|
|
## FLUJO COMPLETO DE INVESTIGACIÓN
|
|
|
|
1. **Entender el Sistema Host**
|
|
```bash
|
|
uname -s && uname -m
|
|
```
|
|
|
|
2. **Ver qué Target Usa Rust**
|
|
```bash
|
|
rustc --print host-triple
|
|
```
|
|
|
|
3. **Inspeccionar El Proyecto**
|
|
```bash
|
|
cat Cargo.toml | grep -E "\[package\]|\[workspace\]"
|
|
```
|
|
|
|
4. **Ver Config de Cargo**
|
|
```bash
|
|
ls -la .cargo/
|
|
cat .cargo/config.toml 2>/dev/null || echo "No custom config"
|
|
```
|
|
|
|
5. **Compilar y Verificar**
|
|
```bash
|
|
cargo build --release -v 2>&1 | head -50
|
|
file target/release/workspace
|
|
```
|
|
|
|
6. **Investigar Cache**
|
|
```bash
|
|
cat target/.rustc_info.json | python -m json.tool
|
|
```
|
|
|
|
7. **Ver Cross-Compilation Posible**
|
|
```bash
|
|
rustup target list | grep installed
|
|
rustc --print sysroot | xargs -I {} ls {}/lib/rustlib/
|
|
```
|
|
|