libssh2 packaged with Zig
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-13 21:27:11 -04:00
.github/workflows fix(actions): fix github 2026-06-13 21:20:46 -04:00
.gitattributes fix(windows): use correct eol for Windows, update README link 2025-09-29 07:20:23 -04:00
.gitignore feat(0.16.0): update version 2026-06-13 21:17:20 -04:00
build.zig fix(0.16): remove noop header config 2026-06-13 21:27:11 -04:00
build.zig.zon feat(0.16.0): update version 2026-06-13 21:17:20 -04:00
LICENSE feat(zig-0.15): clean up build process and update to Zig 0.15 2025-09-29 07:10:45 -04:00
README.md feat(0.16.0): update version 2026-06-13 21:17:20 -04:00

CI

libssh2

This is libssh2, packaged for Zig.

Installation

First, update your build.zig.zon:

# Initialize a `zig build` project if you haven't already
zig init
zig fetch --save git+https://github.com/allyourcodebase/libssh2.git#libssh2-1.11.1

You can then import libssh2 in your build.zig with:

const libssh2_dependency = b.dependency("libssh2", .{
    .target = target,
    .optimize = optimize,
});
your_exe.root_module.linkLibrary(libssh2_dependency.artifact("ssh2"));

Build Options

libssh2 offers a few options which you can control like so:

const libssh2_dependency = b.dependency("libssh2", .{
    .target = target,
    .optimize = optimize,
    .zlib = true, // links to zlib for payload compression if enabled (default=true)
    .strip = true, // Strip debug information (default=false)
    .linkage = .static, // Whether to link statically or dynamically (default=static)
    .@"crypto-backend" = .auto, // auto will to default to wincng on windows, openssl everywhere else. (default=auto)
    .@"link-system-crypto-backend" = true, // If enabled will link against system libraries (default=true)
});