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 LinuxLGPL
musl libcstandard C library for LinuxMIT
FreeBSD libcstandard C library for FreeBSDBSD
NetBSD libcstandard C library for NetBSDBSD
OpenBSD libcstandard C library for OpenBSDBSD
Dragonfly libcstandard C library for DragonflyBSDBSD
macOS libsystemstandard C library for macOSApple
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.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.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 protocolsApache v2 (3.0+), OpenSSL / SSLeay (1.x)
LibreSSLImplementation of the SSL and TLS protocols; forked from OpenSSL in 2014ISC / 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.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