ascii-chat 0.8.38
Real-time terminal-based video chat with ASCII art conversion
Loading...
Searching...
No Matches

⛓️ External projects we rely on

⛓️ External projects we rely on

Dependencies README

This page walks you through installing everything you need to build ascii-chat. Once you're done here, head to Build System to compile.

Step 1: Get Submodules

ascii-chat uses git submodules for vendored dependencies. Get them first:

git submodule init
git submodule update --recursive

This fetches uthash, BearSSL, tomlc17, sokol, and libsodium-bcrypt-pbkdf into deps/.

Step 2: Install Dependencies

Automated Installation (Recommended)

The easiest way to install everything is with the install script:

# Linux/macOS
./scripts/install-deps.sh
# Windows (PowerShell)
./scripts/install-deps.ps1

The script detects your platform and installs all required dependencies using your system's package manager (Homebrew, apt, yum, pacman, or vcpkg).

Manual Installation

If you prefer to install manually or the script doesn't work for your system:

Ubuntu/Debian:

# Build tools
sudo apt-get install build-essential clang clang-tidy clang-format cmake ninja-build
# Core dependencies
sudo apt-get install libzstd-dev portaudio19-dev libsodium-dev libopus-dev \
libsqlite3-dev libminiupnpc-dev libabsl-dev libutf8proc-dev libpcre2-dev \
libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libswresample-dev \
libwebsockets-dev
# Testing (optional)
sudo apt-get install libcriterion-dev
# Release builds (optional)
sudo apt-get install musl-tools musl-dev libmimalloc-dev

Arch Linux:

sudo pacman -S pkg-config clang llvm cmake ninja make zstd portaudio libsodium \
opus sqlite miniupnpc abseil-cpp utf8proc pcre2 ffmpeg libwebsockets \
criterion musl mimalloc

macOS (Homebrew):

brew install cmake ninja make llvm zstd portaudio libsodium opus sqlite3 \
miniupnpc abseil utf8proc pcre2 ffmpeg libwebsockets criterion mimalloc

Windows (Scoop + vcpkg):

First, install Visual Studio Build Tools and select the "Desktop development with C++" workload. This provides nmake for building BearSSL.

# Build tools
scoop install cmake ninja llvm
# Dependencies via vcpkg
vcpkg install zstd:x64-windows portaudio:x64-windows libsodium:x64-windows \
opus:x64-windows sqlite3:x64-windows miniupnpc:x64-windows \
abseil:x64-windows utf8proc:x64-windows pcre2:x64-windows \
libwebsockets:x64-windows mimalloc:x64-windows

Ready to Build

Once dependencies are installed, you're ready to compile. See Build System for build instructions, or just run:

make CMAKE_BUILD_TYPE=RelWithDebInfo

Build Tools

These tools are required to build ascii-chat from source.

Clang/LLVM - C Compiler

Website: https://clang.llvm.org/

Version: 18.0 or later

ascii-chat is a Clang-only project. We use Clang for:

  • C23 standard support
  • AddressSanitizer and UndefinedBehaviorSanitizer
  • clang-format and clang-tidy integration
  • Consistent behavior across platforms
  • SIMD intrinsics (SSE2, AVX2, NEON)

CMake - Build System Generator

Website: https://cmake.org/

Version: 4.2 or later

CMake configures the build. We use:

  • CMake Presets for build configurations
  • Modern target-based dependency management
  • Cross-compilation support

Ninja - Build System

Website: https://ninja-build.org/

Version: Any

Ninja executes the build. Benefits:

  • Automatic parallelization
  • 2-3x faster than Make
  • Incremental builds with dependency tracking

Core Runtime Dependencies

Required for ascii-chat to function.

PortAudio - Cross-Platform Audio I/O

Purpose: Real-time audio capture and playback

Website: http://www.portaudio.com/

License: MIT License

Version: 19.7.0 or later

Used in lib/audio.c and lib/mixer.c for audio streaming. PortAudio abstracts platform differences (WASAPI on Windows, CoreAudio on macOS, ALSA/PulseAudio on Linux).

libsodium - Modern Cryptography

Purpose: End-to-end encryption and authentication

Website: https://libsodium.org/

License: ISC License

Version: 1.0.18 or later

Powers the cryptographic protocol in lib/crypto/. Provides:

  • X25519 key exchange
  • XSalsa20-Poly1305 authenticated encryption
  • Ed25519 signatures for SSH key authentication

zstd - Fast Compression

Purpose: Real-time video frame compression

Website: https://facebook.github.io/zstd/

License: BSD License

Version: 1.4.0 or later

Used in lib/compression.c to compress ASCII frames before transmission. Level 1 compression gives ~50% size reduction at 400+ MB/s.

utf8proc - UTF-8 String Processing

Purpose: UTF-8 string processing and character width calculations

Website: https://github.com/JuliaStrings/utf8proc

License: MIT License

Version: 2.0 or later

Provides Unicode character width calculations for proper terminal display, normalization, and UTF-8 string manipulation.

PCRE2 - Regular Expressions

Purpose: Regular expressions for string validation and parsing

Website: https://www.pcre.org/

License: BSD License

Version: 10.0 or later

Used throughout the codebase for URL validation, session string parsing, SSH crypto format parsing, and protocol validation. Provides performance benefits via JIT compilation.

miniupnpc - UPnP IGD Client

Purpose: Automatic router port forwarding via UPnP

Website: https://miniupnp.tuxfamily.org/

License: BSD License

Version: 2.3.x (tested with 2.3.2+)

Enables automatic port forwarding on home routers, allowing approximately 70% of home users to establish direct TCP connections without requiring WebRTC fallback. This is an optional dependency - if not available, ascii-chat gracefully falls back to WebRTC for NAT traversal.

Opus - Audio Codec

Purpose: Real-time audio compression for low-bandwidth transmission

Website: https://opus-codec.org/

License: BSD License

Version: 1.3.0 or later

Enables high-quality bidirectional voice and audio communication between clients with minimal latency and bandwidth overhead. Used in the audio pipeline for encoding outgoing audio and decoding incoming audio.

WebRTC AEC3 - Acoustic Echo Cancellation

Purpose: Real-time acoustic echo cancellation for voice chat

Website: https://github.com/nicnacnic/webrtc_AEC3

License: BSD License (WebRTC)

Extracted WebRTC audio processing module providing production-grade acoustic echo cancellation (AEC3). Used in the audio pipeline to remove echo when speakers and microphone are active simultaneously. This is the same AEC technology used by Google Meet, Zoom, Discord, and other major conferencing apps.

FFmpeg - Multimedia Framework

Purpose: Media file streaming support

Website: https://ffmpeg.org/

License: LGPL/GPL (depending on configuration)

Version: 4.0 or later

Enables streaming media files (video/audio) instead of live webcam capture. Used for testing, demos, and scenarios where a webcam isn't available.

SQLite3 - Embedded Database

Purpose: Persistent storage for the discovery service

Website: https://www.sqlite.org/

License: Public Domain

Version: 3.35.0 or later

Used in the ACDS (ascii-chat Discovery Service) to store active sessions, user identities, and connection metadata. Zero-configuration embedded database.

libdatachannel - WebRTC Library

Purpose: NAT traversal via WebRTC DataChannels

Website: https://github.com/paullouisageneau/libdatachannel

License: MPL 2.0

Version: 0.20.0 or later

Lightweight (~50k LOC) WebRTC library providing DataChannels for P2P connections. Enables NAT traversal via ICE/STUN/TURN when UPnP port forwarding is unavailable. Falls back to relay servers for symmetric NAT scenarios.

libwebsockets - WebSocket Server

Purpose: WebSocket protocol for browser-based clients

Website: https://libwebsockets.org/

License: MIT License

Version: 4.3.0 or later

Provides WebSocket server functionality enabling browser clients to connect to ascii-chat servers via standard WebSocket protocol. Bridges the WebSocket transport to the ACIP protocol, allowing web-based clients to participate in video chat sessions alongside native terminal clients.

Vendored Dependencies (Git Submodules)

Included in deps/ and built from source for version consistency.

uthash - Hash Table for C

Purpose: O(1) hash table lookups for client management

Website: https://troydhanson.github.io/uthash/

License: BSD License

Header-only library for hash tables. Used for client ID lookups, symbol caching, and lock tracking.

BearSSL - Minimalist SSL/TLS

Purpose: HTTPS client for fetching public keys from GitHub/GitLab

Website: https://bearssl.org/

License: MIT License

Small (~100KB) SSL library used in lib/crypto/http_client.c. Much smaller and simpler than OpenSSL.

tomlc17 - TOML Parser

Purpose: Configuration file parsing (future feature)

Website: https://github.com/cktan/tomlc17

License: MIT License

Prepared for ~/.ascii-chat/config.toml support.

Sokol - Cross-Platform APIs

Purpose: Future GPU-accelerated rendering

Website: https://github.com/floooh/sokol

License: zlib/libpng License

Header-only library for graphics, audio, and input. Available for future use.

libsodium-bcrypt-pbkdf

Purpose: OpenSSH private key decryption

Website: https://github.com/imaami/libsodium-bcrypt-pbkdf

License: BSD License

Implements bcrypt-pbkdf for decrypting password-protected SSH keys.

Testing Dependencies

Only required for building and running tests.

Criterion - Testing Framework

Purpose: Unit, integration, and performance testing

Website: https://criterion.readthedocs.io/

License: MIT License

Version: 2.4.0 or later

Platform: POSIX only (Linux, macOS). Windows tests run via Docker.

Provides automatic test discovery, fixtures, parameterized tests, and JUnit XML output for CI.

Release Build Dependencies

Optional for development, but required for portable static release builds.

musl - Lightweight C Standard Library

Purpose: Fully static executables with no glibc dependencies

Website: https://musl.libc.org/

License: MIT License

Platform: Linux only

musl enables building fully static executables that run on any Linux distribution without shared library dependencies. Used with -DUSE_MUSL=ON.

mimalloc - High-Performance Allocator

Purpose: Fast memory allocation for production builds

Website: https://github.com/microsoft/mimalloc

License: MIT License

Version: 2.0.0 or later

Up to 2x faster than system malloc. Enabled with -DUSE_MIMALLOC=ON and used by default in release builds.

Platform APIs

ascii-chat uses native platform APIs for webcam access and terminal I/O, eliminating heavy dependencies like OpenCV.

Video Capture:

  • Linux: Video4Linux2 (V4L2) - kernel interface, no library
  • macOS: AVFoundation - system framework
  • Windows: Media Foundation - system library

Terminal I/O:

  • POSIX: termios for raw mode and ANSI sequences
  • Windows: Console API with virtual terminal sequences

License Compatibility

All dependencies use permissive licenses compatible with ascii-chat:

License Dependencies
MIT BearSSL, PortAudio, Criterion, mimalloc, musl, tomlc17, utf8proc, libwebsockets
ISC libsodium
BSD zstd, uthash, libsodium-bcrypt-pbkdf, miniupnpc, Opus, WebRTC AEC3, PCRE2
zlib sokol
Apache 2.0 Abseil
MPL 2.0 libdatachannel
LGPL/GPL FFmpeg
Public Domain SQLite3

FFmpeg license depends on configuration; ascii-chat uses LGPL-compatible features.

Version Requirements

Dependency Minimum Rationale
CMake 4.2 CMake Presets, modern features
Clang 18.0 C23, sanitizers, defer/panic tools
PortAudio 19.7.0 Stable callback API
libsodium 1.0.18 Ed25519 support
zstd 1.4.0 Streaming API
utf8proc 2.0 UTF-8 string processing
PCRE2 10.0 Regular expression support
Opus 1.3.0 Stable audio codec API
FFmpeg 4.0 Stable libav API
SQLite3 3.35.0 Returning clause support
libdatachannel 0.20.0 WebRTC DataChannels
libwebsockets 4.3.0 WebSocket protocol support
miniupnpc 2.3.x UPnP IGD client (API changes in 2.3)
Criterion 2.4.0 Theories and fixtures

Git submodules are pinned to specific commits for reproducibility.

Updating Dependencies

Git Submodules:

# Update all submodules
git submodule update --remote --merge
# Update specific submodule
cd deps/ascii-chat-deps/bearssl && git checkout v0.6
cd ../.. && git add deps/ascii-chat-deps/bearssl && git commit -m "Update bearssl"

System Libraries:

# Linux
sudo apt-get update && sudo apt-get upgrade
# macOS
brew update && brew upgrade
# Windows
vcpkg upgrade

Troubleshooting

PortAudio Not Found

# macOS: Add Homebrew to PKG_CONFIG_PATH
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH"
# Windows: Set vcpkg toolchain
cmake -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake ..

Criterion on Windows

Criterion is POSIX-only. Run tests via Docker:

./tests/scripts/run-docker-tests.ps1

BearSSL Build Fails

BearSSL requires a native build tool:

Missing Submodules

git submodule init
git submodule update --recursive
See also
Build System - Compile ascii-chat after installing Dependencies
CMakeLists.txt
cmake/dependencies/Dependencies.cmake