[Nix-dev] Re: nixpkgs: libpng, rpath and transitive zlib dependency

Ludovic Courtès ludo at gnu.org
Mon Aug 17 20:14:28 CEST 2009


Hi,

Nathaniel Griswold <griswold at cs.wisc.edu>
writes:

> In nixpkgs, i found that programs that use libpng such as pnmtopng (in
> tools/graphics/netpbm) never get the rpath for zlib injected into
> their linker line and fail at runtime.

[...]

> Has this come up before and what is the correct fix for this?

This has to do with pkg-config's handling of `Libs.private'.
`libpng.pc' reads this:

--8<---------------cut here---------------start------------->8---
prefix=/nix/store/n8zp4wflmpi5fi5ysf7whidgivcz0s3h-libpng-1.2.35
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/libpng12

Name: libpng
Description: Loads and saves PNG files
Version: 1.2.35
Libs: -L${libdir} -lpng12
Libs.private: -lz -lm 
Cflags: -I${includedir} 
--8<---------------cut here---------------end--------------->8---

What happens is that `pkg-config' shows `-lz -lm' when passed `--libs
--static' but does not show it when passed `--libs' only (because it
assumes a proper ELF platform where shared objects record their
dependencies, as on GNU systems).

I suppose you'd need to patch `pkg-config' to always show the contents
of `Libs.private' (and this should be reported upstream).

BTW, which OS is it?

Thanks,
Ludo'.




More information about the nix-dev mailing list