How to use zlib-ng in place of zlib

740 views
Skip to first unread message

Gregory Sjaardema

unread,
May 19, 2021, 6:30:49 PM5/19/21
to Spack
The zlib-ng package provides a "next generation" optimized implementation of zlib functionality.  If built with the `+compat` option, then it provides a drop-in replacement for zlib including a `libz.a` and `libz.so` and `zlib.h` with the correct defines/symbols.

I would like to use zlib-ng instead of zlib in a spack build, but am unsure as to how to do this in the best way.

Is there a way to tell spack that whereever `zlib` is needed to instead replace it with `zlib-ng+compat` ?

I don't want to have to go to all packages that have a zlib dependency and add a `zlib-ng` variant, instead it seems like there should be a place where I can specify that zlib-ng provides `libz.so` and then everything proceeds automatically.

Thanks,
..Greg

Rob Groner

unread,
May 20, 2021, 9:28:50 AM5/20/21
to Spack
What you're looking for is in the packages.yaml file.  In there, you can indicate that a certain package provides another package or capability.

packages:
  all:
    providers:
      zlib: [zlib-ng]

Take a look in the docs, I think this is covered there.  It's the way you indicate what packages are providing mpi or blas, etc.
Reply all
Reply to author
Forward
0 new messages