A lightweight 64-bit Linux userspace tool that lets you run any dynamically linked program with a custom glibc (Conda, custom build, or alternate sysroot).
It uses ptrace to transparently replace the dynamic linker (PT_INTERP) and libc at every execve — no containers, no binary patching, no LD_* env hacks.
| Architecture | Minimum Kernel Version |
|---|---|
| x86_64 (X64) | Linux >= 2.6.18 |
| AMD64 | Linux >= 3.19 |
| RISC-V 64 | Linux >= 5.4 |
chlibc <target_program> [args...]Three paths control chlibc's behavior, auto-discovered in priority order:
| Path | Variable | Fallback Chain | Purpose |
|---|---|---|---|
| Interpreter | CHLIBC_INTERP |
CHLIBC_GLIBC_HOME → CONDA_PREFIX → dirname($0)/../<arch>/sysroot |
Target dynamic linker (ld.so). |
| GLIBC Home | CHLIBC_GLIBC_HOME |
CONDA_PREFIX → dirname(CHLIBC_INTERP) → dirname($0)/../<arch>/sysroot |
Custom glibc root directory. Injected as first entry in LD_LIBRARY_PATH. |
| Prefix / Scope | CHLIBC_PREFIX |
CONDA_PREFIX → dirname($0)/.. |
Replacement scope limit. Only binaries under this path (/proc/<pid>/exe) are intercepted. |
| Variable | Description |
|---|---|
CONDA_PREFIX |
Auto-detects everything (recommended) |
CHLIBC_INTERP |
Path to target dynamic linker (e.g. ld-linux-x86-64.so.2) |
CHLIBC_GLIBC_HOME |
Root directory of custom glibc |
CHLIBC_PREFIX |
Only replace when binary is under this path |
CHLIBC_LOGGER_FILE |
Path to log file. If unset, defaults to stderr (if TTY) or syslog fallback. |
export CONDA_PREFIX=/opt/conda/envs/myenv
chlibc python
chlibc /path/to/script.pyRequirements
- Linux x64 or MacOS aarch64
- CMake and Ninja
- pixi (recommended)
./pixiw run configure
./pixiw run buildUsing pixi, builds are fully reproducible.
cmake --preset clang-x86_64 -S .
./cmake-build --preset clang-x86_64-release