mix fix_nif_rpaths (ExZarr v1.1.0)

View Source

Adds rpaths to compiled Zig NIF libraries for macOS dynamic library loading.

This task runs after compilation to ensure that the Zig NIFs can find their dependent compression libraries at runtime on macOS.

Background

On macOS, dynamic libraries need to know where to find their dependencies at runtime. The Zig NIFs link against system compression libraries (zstd, lz4, snappy, blosc, bzip2), but without proper rpaths, the dynamic linker can't find them.

This task uses install_name_tool to add rpaths for each compression library to the compiled .so file.

Usage

This task is automatically run after compilation via a Mix alias:

mix compile

Or run manually:

mix fix_nif_rpaths

Platform Support

  • macOS: Fully supported, adds rpaths using install_name_tool
  • Linux: Not needed (uses standard library paths)
  • Windows: Not supported (different dynamic library mechanism)