Aller au contenu principal

Installer HDDS sur macOS

Ce guide couvre l'installation de HDDS depuis les sources sur macOS (Intel et Apple Silicon).

Prérequis

  • macOS 12+ (Monterey ou ultérieur)
  • Xcode Command Line Tools : xcode-select --install
  • Rust 1.75+ (installer via rustup)
  • Git
# Install Xcode Command Line Tools
xcode-select --install

# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source ~/.cargo/env

# Verify Rust version
rustc --version # Should be 1.75.0 or higher

Cloner et compiler

# Clone the repository
git clone https://git.hdds.io/hdds/hdds.git
cd hdds

# Build in release mode
cargo build --release

# Run tests to verify
cargo test
Apple Silicon

HDDS est entièrement natif sur Apple Silicon (M1/M2/M3). Rosetta n'est pas nécessaire.

Utiliser HDDS dans votre projet

Ajoutez HDDS comme dépendance locale dans le Cargo.toml de votre projet :

[dependencies]
hdds = { path = "/path/to/hdds/crates/hdds" }

Avec des features optionnelles :

[dependencies]
hdds = { path = "/path/to/hdds/crates/hdds", features = ["xtypes", "security"] }

Features disponibles

FeatureDescription
xtypesSystème de types XTypes (par défaut)
securitySupport DDS Security 1.1
tcp-tlsChiffrement TLS pour le transport TCP
cloud-discoveryDiscovery AWS/Azure/Consul
k8sDiscovery Kubernetes
rpcDDS-RPC Request/Reply
telemetryCollecte de métriques

Générateur de code (hdds_gen)

# Clone hdds_gen
git clone https://git.hdds.io/hdds/hdds_gen.git
cd hdds_gen

# Build and install
cargo build --release

# Add to PATH (optional)
export PATH="$PATH:$(pwd)/target/release"

# Verify
./target/release/hdds_gen --version

Développement C/C++

Après avoir compilé HDDS :

# Build the C bindings
cd /path/to/hdds
cargo build --release -p hdds-c

# The library will be at target/release/libhdds.dylib

Intégration CMake

# Point to your HDDS build
set(HDDS_ROOT "/path/to/hdds")

add_executable(myapp main.cpp)
target_include_directories(myapp PRIVATE ${HDDS_ROOT}/crates/hdds-c/include)
target_link_directories(myapp PRIVATE ${HDDS_ROOT}/target/release)
target_link_libraries(myapp PRIVATE hdds)

Vérifier l'installation

# Check version
hdds --version

# Run self-test
hdds self-test

# List interfaces
hdds interfaces

Sortie attendue :

HDDS 1.0.0
Platform: macOS arm64
RTPS Version: 2.5
Security: Enabled

Self-test: PASSED (12/12 tests)

Network Interfaces:
- en0: 192.168.1.100 (multicast: enabled)
- lo0: 127.0.0.1 (multicast: disabled)

Configuration spécifique macOS

Pare-feu

Le pare-feu macOS peut bloquer le trafic DDS. Autorisez-le :

  1. Ouvrez Préférences Système -> Sécurité et confidentialité -> Coupe-feu
  2. Cliquez sur Options du coupe-feu
  3. Ajoutez votre application ou autorisez les connexions entrantes

Ou via la ligne de commande :

# Disable firewall for testing (not recommended for production)
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off

Multicast

macOS supporte le multicast par défaut. Vérification :

# Check multicast route
netstat -rn | grep 239

# If missing, add route
sudo route add -net 239.255.0.0/16 -interface en0

Prévention de la mise en veille

Pour les applications DDS longue durée :

# Prevent sleep while app runs
caffeinate -i ./my_dds_app

Dépannage

Erreur "Library not loaded"

# Set library path
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH

Multicast ne fonctionne pas

# Check interface multicast capability
ifconfig en0 | grep MULTICAST

# Check firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --listapps

Compatibilité Apple Silicon

HDDS est natif ARM64. Si vous voyez des avertissements Rosetta :

# Verify architecture
file $(which hdds)
# Should show: Mach-O 64-bit executable arm64

Prochaines étapes