vips-sys
Low-level Rust FFI bindings for libvips. Provides the foundation for higher-level, safer wrappers.
- Docs: https://houseme.github.io/vips-sys/vips_sys/
- Requirement:
libvips >= 8.2(validated with8.17.2) - Goal: stable builds, cross-platform reuse, and in-sync with upstream
libvips
Installation
- macOS
brew install vips pkg-config
- Debian/Ubuntu
sudo apt-get install -y libvips-dev pkg-config
- Windows (MSVC)
vcpkg install vipsand ensure the environment is visible tocargo
Make sure pkg-config --cflags --libs vips works (Windows linking via vcpkg).
Features and versions
- Optional features
static: prefer static linkingdynamic: prefer dynamic linking (default)helpers: minimal safe helpers (init/shutdown/version)
- Build-time exports
LIBVIPS_VERSION: detectedlibvipsversion stringcfg(vips_8_17): set when version>= 8.17for conditional compilation upstream
- Versioned bindings
- Default to
OUT_DIR/binding.rs - Compatible path: include versioned outputs when needed (e.g.
binding_8_74.rs)
- Default to
Usage example (with helpers)
use helpers;
Cargo snippet:
[]
= { = "0.1.3-beta.1", = ["helpers"] }
Build notes
This crate uses bindgen at build time:
- Discover include paths via
pkg-configand pass them toclang - Disable
layout_tests, enablerustified_enum(".*") - Use
blocklist_*to avoid platform conflicts
Environment variables:
PKG_CONFIG_PATH: search path forpkg-config(e.g. macOS M1:/opt/homebrew/lib/pkgconfig)LIBVIPS_NO_BINDGEN: skip bindgen and reuse existing outputBINDGEN_EXTRA_CLANG_ARGS: extraclangargs (e.g. additional-I)LIBCLANG_PATH: location oflibclang(e.g. local LLVM)
Troubleshooting
vipsnot found:- Ensure
libvipsandpkg-configare installed (orvcpkgon Windows) - Check
PKG_CONFIG_PATHcontains the directory ofvips.pc
- Ensure
- Bindings generation fails:
- Set
LIBCLANG_PATHto a validlibclang - Add missing
-Ipaths viaBINDGEN_EXTRA_CLANG_ARGS
- Set
- Static linking issues (macOS):
- Prefer dynamic linking or review known Homebrew caveats
License
Changelog
See CHANGELOG.md.