rust-rodio-wsl2-audio

Compile Rust rodio/cpal projects on WSL2 by extracting ALSA headers and routing audio through PulseAudio.

Updated Jan 24, 2026
One-click install
npx skills add https://github.com/strataga/claude-setup --skill rust-rodio-wsl2-audio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rust-rodio-wsl2-audio
Source: https://github.com/strataga/claude-setup/tree/main/skills/rust-rodio-wsl2-audio
Command: npx skills add https://github.com/strataga/claude-setup --skill rust-rodio-wsl2-audio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill fixes Rust audio issues on WSL2 by providing a reliable workaround to make rodio/cpal work with ALSA and PulseAudio routing.

Core Features & Use Cases

  • Compilation workaround: Enables building Rust audio projects on WSL2 by extracting required ALSA dev headers from .deb packages without sudo.
  • Runtime audio routing: Redirects ALSA through PulseAudio under WSLg to produce working sound output.
  • Use Case: Imagine a Rust project that fails with "The system library 'alsa' required by crate 'alsa-sys' was not found"; this Skill provides a reproducible fix.

Quick Start

Follow the steps in SKILL.md to compile ALSA headers and configure PulseAudio routing for WSL2.

Frequently Asked Questions about rust-rodio-wsl2-audio

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix the 'alsa-sys' library not found error when compiling Rust audio projects on WSL2?

Fix the 'alsa-sys' not found error on WSL2 by manually extracting required ALSA dev headers from .deb packages. This compilation workaround bypasses the missing system library issue without requiring sudo access.

Why does rodio fail with 'Unknown PCM default' or 'cannot find card' errors on WSL2?

Rodio fails with 'Unknown PCM default' or 'cannot find card' errors on WSL2 because ALSA lacks a configured audio device. Redirecting ALSA through PulseAudio under WSLg resolves the runtime routing to produce working sound output.

Can I compile cpal and rodio Rust audio projects on WSL2 without sudo access?

Yes, you can compile cpal and rodio projects on WSL2 without sudo by manually extracting ALSA dev headers from .deb packages. This approach provides the necessary build environment setup for restricted user accounts.

How do I configure ALSA to PulseAudio routing for Rust audio playback in WSL2?

Configure ALSA to PulseAudio routing for Rust audio playback by setting up WSLg audio forwarding. This redirects ALSA outputs through PulseAudio, enabling rodio and cpal applications to successfully produce sound.

What's the best way to make Rust rodio audio work on WSL2 with missing ALSA dev headers?

The best way to make rodio audio work on WSL2 with missing ALSA dev headers is manual .deb extraction combined with PulseAudio routing. This reproducible workflow fixes both compilation and runtime audio failures.

Does rodio audio work with WSLg PulseAudio routing on WSL2?

Yes, rodio audio works with WSLg PulseAudio routing on WSL2. By configuring ALSA to route through PulseAudio, Rust audio projects can successfully output sound despite missing native ALSA hardware configurations.