Required libraries

This is a list of third-party libraries used by the Crystal compiler and the standard library.

Core runtime dependencies

The libraries in this section are always required by Crystal’s stdlib runtime. They must be present for building or running any Crystal program that uses the standard library. Avoiding these dependencies is only possible when not using the standard library (--prelude=none compiler option).

System library

A major component is the system library. Selection depends on the target platform and multiple are supported. This usually includes the C standard library as well as additional system libraries such as libdl, libm, libpthread, libcmt, or libiconv which may be part of the C library or standalone libraries. On most platforms all these libraries are provided by the operating system.

LibraryDescriptionLicense
glibcstandard C library for Linux
Supported versions: GNU libc 2.26+
LGPL
musl libcstandard C library for Linux
Supported versions: MUSL libc 1.2+
MIT
FreeBSD libcstandard C library for FreeBSD
Supported versions: 12+
BSD
NetBSD libcstandard C library for NetBSDBSD
OpenBSD libcstandard C library for OpenBSD
Supported versions: 6+
BSD
Dragonfly libcstandard C library for DragonflyBSDBSD
macOS libsystemstandard C library for macOS
Supported versions: 11+
Apple
MSVCRTstandard C library for MSVC compiler (Windows)
WASIWebAssembly System InterfaceApache v2 and others
bionic libcC library for AndroidBSD-like

Other runtime libraries

LibraryDescriptionLicense
Boehm GCThe Boehm-Demers-Weiser conservative garbage collector. Performs automatic memory management.
Supported versions: 8.2.0+; earlier versions require a patch for MT support
MIT-style
LibeventAn event notification library. Implements concurrency features such as Fiber and the event loop on POSIX platforms. Not used on Windows.Modified BSD
compiler-rt builtinsProvides optimized implementations for low-level routines required by code generation, such as integer multiplication. Several of these routines are ported to Crystal directly.MIT / UIUC

Optional standard library dependencies

These libraries are required by different parts of the standard library, only when explicitly used.

Regular Expression engine

Engine implementation for the Regex class. PCRE2 support was added in Crystal 1.7 and it’s the default since 1.8 (see Regex documentation).

LibraryDescriptionLicense
PCRE2Perl Compatible Regular Expressions, version 2.
Supported versions: all (recommended: 10.36+)
BSD
PCREPerl Compatible Regular Expressions.BSD

Big Numbers

Implementations for Big types such as BigInt.

LibraryDescriptionLicense
GMPGNU multiple precision arithmetic library.LGPL v3+ / GPL v2+
MPIRMultiple Precision Integers and Rationals, forked from GMP. Used on Windows.GPL-3.0 and LGPL-3.0

Internationalization conversion

This is either a standalone library or may be provided as part of the system library on some platforms. May be disabled with the -Dwithout_iconv compile-time flag. Using a standalone library over the system library implementation can be enforced with the -Duse_libiconv compile-time flag.

LibraryDescriptionLicense
libiconv (GNU)Internationalization conversion library.LGPL-3.0

TLS

TLS protocol implementation and general-purpose cryptographic routines for the OpenSSL API. May be disabled with the -Dwithout_openssl compile-time flag.

Both OpenSSL and LibreSSL are supported and the bindings automatically detect which library and API version is available on the host system.

LibraryDescriptionLicense
OpenSSLImplementation of the SSL and TLS protocols
Supported versions: 1.1.0+–3.3+
Apache v2 (3.0+), OpenSSL / SSLeay (1.x)
LibreSSLImplementation of the SSL and TLS protocols; forked from OpenSSL in 2014
Supported versions: 2.0–4.0+
ISC / OpenSSL / SSLeay

Other stdlib libraries

LibraryDescriptionLicense
LibXML2XML parser developed for the Gnome project. Implements the XML module.MIT
LibYAMLYAML parser and emitter library. Implements the YAML module.MIT
zlibLossless data compression library. Implements the Compress module. May be disabled with the -Dwithout_zlib compile-time flag.zlib
LLVMTarget-independent code generator and optimizer. Implements the LLVM API.
Supported versions: LLVM 8-19 (aarch64 requires LLVM 13+)
Apache v2 with LLVM exceptions

Compiler dependencies

In addition to the core runtime dependencies, these libraries are needed to build the Crystal compiler.

LibraryDescriptionLicense
PCRE2See above.
LLVMSee above.Apache v2 with LLVM exceptions
libffiForeign function interface. Used for implementing binary interfaces in the interpreter. May be disabled with the -Dwithout_interpreter compile-time flag.MIT