cpdb-sys
Raw FFI bindings for the Common Print Dialog Backends C library (cpdb-libs).
This crate is automatically generated using bindgen and contains raw, unsafe declarations for the complete CPDB C API (libcpdb and libcpdb-frontend).
[!NOTE] Looking for a safe Rust API? Most users should depend on the high-level safe async crate cpdb-rs instead, which provides pure-Rust D-Bus capabilities without C library dependencies.
Supported Platforms
| Target | Status | Notes |
|---|---|---|
| Linux (any glibc distro) | ✅ Fully supported | The intended target. CI runs on Ubuntu. |
| macOS | ⚠️ Headers-only | Bindgen can parse the headers and the crate compiles with CPDB_NO_LINK=1, but linking requires Linux D-Bus. Useful only for compile-checking. |
| Windows | ❌ Not supported | cpdb-libs has no Windows port (D-Bus / GLib stack). Compilation will hard-fail with a compile_error!. Develop inside WSL Ubuntu. |
Prerequisites
cpdb-libs (≥ 3.0)
cpdb-sys targets the cpdb-libs 3.x ABI and links against libcpdb and libcpdb-frontend.
[!IMPORTANT] Distro packages may be too old. As of mid-2026, Debian / Ubuntu ship
cpdb-libs2.0~b5 inlibcpdb-dev. That is incompatible with this crate — installing it leaves you with bothlibcpdb.so.2(from apt) andlibcpdb.so.3(from source) and the linker picks the wrong one. Either:
- Build from source (recommended until distros catch up), or
- Verify your package gives
libcpdb.so.3.*withls /usr/lib*/libcpdb.so.*before relying on it.
Build cpdb-libs 3.x from source:
# If you previously installed apt's older libcpdb*, remove it first:
||
Fedora / RHEL: install cpdb-libs-devel from a 3.x-shipping repository, or build from source the same way.
libclang (for bindgen)
bindgen needs libclang at build time to parse C headers. On Debian/Ubuntu:
Build Configuration
If the library is installed to a non-standard location where pkg-config cannot locate it, you can specify the prefix path by setting the CPDB_LIBS_PATH environment variable: