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

Nathaniel Griswold griswold at cs.wisc.edu
Mon Aug 17 19:36:52 CEST 2009


Hey all,

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.

Doing some investigative work, the reason for this is that
libpng-config --libs contains only -lpng. The programs in question
link correctly on linux (the entire build succeeds) because transitive
lib deps are honored on linux. The problem is that this transitive
dependency is invisible to the nix ld wrapper (it never sees an -l on
linux). On non-linux platforms (where transitive dependencies are NOT
honored), proper pkg-config scripts would likely include the -lzlib
dep.

Has this come up before and what is the correct fix for this? In
linux, it does not seem correct to adjust the libpng-config --libs
path. I've adjust the netpbm build, but this also doesn't seem quite
right. It seems more correct to adjust the ld-wrapper. Maybe something
extending the rpath like a recursive scan of any specified -l libs who
reference the nix store.

So what do you folks think?

-nate



More information about the nix-dev mailing list