| Crates.io | libsodium-sys-stable |
| lib.rs | libsodium-sys-stable |
| version | 1.22.4 |
| created_at | 2019-09-17 13:34:21.72993+00 |
| updated_at | 2025-09-12 11:37:36.142321+00 |
| description | Maintained FFI bindings for libsodium stable |
| homepage | |
| repository | https://github.com/jedisct1/libsodium-sys-stable |
| max_upload_size | |
| id | 165429 |
| size | 2,207,806 |
A patched version of the libsodium-sys crate that installs stable
versions of libsodium instead of point releases.
fetch-latest: Download the latest stable version of libsodiumoptimized: Build a version optimized for the current platformminimal: Do not build deprecated APIsuse-pkg-config: Force the use of pkg-config to find libsodiumThe build process can be controlled through several environment variables:
SODIUM_LIB_DIR: Path to a directory containing a pre-built libsodium library. When set, the build will use this library instead of building from source.SODIUM_SHARED: When set (any value), links dynamically to libsodium instead of statically. Only works with SODIUM_LIB_DIR.SODIUM_USE_PKG_CONFIG: When set (any value), uses pkg-config to find libsodium. Incompatible with SODIUM_LIB_DIR.When building libsodium from source, these variables apply:
SODIUM_DIST_DIR: Path to a local directory containing libsodium distribution archives (.tar.gz files with .minisig signatures). Useful for offline builds or using specific versions.SODIUM_DISABLE_PIE: When set (any value), disables Position Independent Executable during compilation.SODIUM_LDFLAGS: Additional linker flags to pass when building libsodium.NUM_JOBS: Number of parallel jobs to use during compilation (passed to make -j).On Windows, if libsodium is not found via environment variables or pkg-config, pre-compiled binaries are automatically downloaded for:
i686-pc-windows-msvc, x86_64-pc-windows-msvc, aarch64-pc-windows-msvci686-pc-windows-gnu, x86_64-pc-windows-gnuCompiling to WebAssembly/WASI targets requires the Zig compiler to be installed. The build automatically configures the appropriate flags for WASI compilation.
iOS builds are supported for multiple architectures:
aarch64-apple-ios: ARM64 iOS devicesarmv7-apple-ios: ARMv7 iOS devicesarmv7s-apple-ios: ARMv7s iOS devicesx86_64-apple-ios: x86_64 iOS simulatoraarch64-apple-ios-sim: ARM64 iOS simulatorThe build automatically detects Xcode paths and configures the appropriate SDK and deployment targets.
For cross-compilation to non-WebAssembly targets, consider using cargo zigbuild which handles C dependencies more easily.
The build system searches for libsodium in the following order:
SODIUM_LIB_DIR is set, use the specified library directorySODIUM_USE_PKG_CONFIG is set or the use-pkg-config feature is enabled, try pkg-configSODIUM_DIST_DIR)All downloaded archives are verified using minisign signatures to ensure authenticity.