Skip to content

zlib: fix static library path in pkg-config module#476830

Merged
doronbehar merged 1 commit intoNixOS:stagingfrom
marcin-serwin:push-mrpnmksllpqq
Jan 25, 2026
Merged

zlib: fix static library path in pkg-config module#476830
doronbehar merged 1 commit intoNixOS:stagingfrom
marcin-serwin:push-mrpnmksllpqq

Conversation

@marcin-serwin
Copy link
Copy Markdown
Contributor

Specify the correct paths for installation in configuration phase. This fixes the created pkg-config module and saves us from needing to move files manually into the desired outputs.

Fixes: #66461

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

Specify the correct paths for installation in configuration phase. This
fixes the created pkg-config module and saves us from needing to move
files manually into the desired outputs.

Fixes: NixOS#66461
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. labels Jan 4, 2026
@nixpkgs-ci nixpkgs-ci bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Jan 4, 2026
Copy link
Copy Markdown
Contributor

@doronbehar doronbehar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM, and I endorse this change.

@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jan 21, 2026
@doronbehar
Copy link
Copy Markdown
Contributor

I'm testing this change now, and will take a look at the files it produces. If everything looks fine to me, I will merge it.

@doronbehar
Copy link
Copy Markdown
Contributor

Looks perfectly fine to me:

tree $(nix build --no-link --print-out-paths -Lf. zlib.{out,dev,static})

Prints:

/nix/store/na03q4r0gwnx39ipg3mf4vh48ywb2gjh-zlib-1.3.1
├── lib
│   ├── libz.so -> libz.so.1.3.1
│   ├── libz.so.1 -> libz.so.1.3.1
│   └── libz.so.1.3.1
└── share
    └── man
        └── man3
            └── zlib.3.gz
/nix/store/x1ahgp3wkj4542lmkijg6sdybpw2blk1-zlib-1.3.1-dev
├── include
│   ├── zconf.h
│   └── zlib.h
├── nix-support
│   └── propagated-build-inputs
└── share
    └── pkgconfig
        └── zlib.pc
/nix/store/ri4nl959pj4iys7d0k0q963a7ajwyac9-zlib-1.3.1-static
└── lib
    └── libz.a

12 directories, 9 files

And:

cat /nix/store/x1ahgp3wkj4542lmkijg6sdybpw2blk1-zlib-1.3.1-dev/share/pkgconfig/zlib.pc

Shows:

prefix=/nix/store/na03q4r0gwnx39ipg3mf4vh48ywb2gjh-zlib-1.3.1
exec_prefix=${prefix}
libdir=/nix/store/ri4nl959pj4iys7d0k0q963a7ajwyac9-zlib-1.3.1-static/lib
sharedlibdir=/nix/store/na03q4r0gwnx39ipg3mf4vh48ywb2gjh-zlib-1.3.1/lib
includedir=/nix/store/x1ahgp3wkj4542lmkijg6sdybpw2blk1-zlib-1.3.1-dev/include

Name: zlib
Description: zlib compression library
Version: 1.3.1

Requires:
Libs: -L${libdir} -L${sharedlibdir} -lz
Cflags: -I${includedir}

@doronbehar doronbehar added this pull request to the merge queue Jan 25, 2026
Merged via the queue into NixOS:staging with commit e903e06 Jan 25, 2026
39 checks passed
@alexfmpe
Copy link
Copy Markdown
Member

This might have broken the build on windows - these both work on master and fail after this PR

nix-build -A pkgsCross.x86_64-cygwin.zlib
nix-build -A pkgsCross.ucrt64.zlib

with

shrinking RPATHs of ELF executables and libraries in /nix/store/mssliq64xv9p7hahrkc3lqzrfv09ij9p-zlib-x86_64-pc-cygwin-1.3.1
checking for references to /build/ in /nix/store/mssliq64xv9p7hahrkc3lqzrfv09ij9p-zlib-x86_64-pc-cygwin-1.3.1...
patching script interpreter paths in /nix/store/mssliq64xv9p7hahrkc3lqzrfv09ij9p-zlib-x86_64-pc-cygwin-1.3.1
shrinking RPATHs of ELF executables and libraries in /nix/store/x7zxybfvkcpag7lfij1c4f6yrsb3a7g1-zlib-x86_64-pc-cygwin-1.3.1-dev
checking for references to /build/ in /nix/store/x7zxybfvkcpag7lfij1c4f6yrsb3a7g1-zlib-x86_64-pc-cygwin-1.3.1-dev...
patching script interpreter paths in /nix/store/x7zxybfvkcpag7lfij1c4f6yrsb3a7g1-zlib-x86_64-pc-cygwin-1.3.1-dev
error: builder for '/nix/store/pv7dglxzgdp4622a5qm9rv7ikhbr0ayf-zlib-x86_64-pc-cygwin-1.3.1.drv' failed to produce output path for output 'static' at '/nix/store/pv7dglxzgdp4622a5qm9rv7ikhbr0ayf-zlib-x86_64-pc-cygwin-1.3.1.drv.chroot/root/nix/store/q55d3s1spnndcc1bpzfpmiv4qwykkn93-zlib-x86_64-pc-cygwin-1.3.1-static'

marcin-serwin added a commit to marcin-serwin/nixpkgs that referenced this pull request Feb 15, 2026
The install script ignores the configured libdir in case of
windows. We could move it manually like it was done before
<NixOS#476830> but even before that we
did not move `libz.dll.a` so I think it makes sense to just disable this
split on windows.

Fixes: NixOS#476830 (comment)
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
doronbehar added a commit to doronbehar/nixpkgs that referenced this pull request Feb 15, 2026
Help prepare to remove `zlib`'s `"static"` output, see related issues:

- NixOS#490608
- NixOS#66461
- NixOS#476830
@doronbehar doronbehar linked an issue Feb 15, 2026 that may be closed by this pull request
doronbehar added a commit to doronbehar/nixpkgs that referenced this pull request Feb 15, 2026
Help prepare to remove `zlib`'s `"static"` output, see related issues:

- NixOS#490608
- NixOS#66461
- NixOS#476830
alexfmpe pushed a commit to alexfmpe/nixpkgs that referenced this pull request Feb 18, 2026
The install script ignores the configured libdir in case of
windows. We could move it manually like it was done before
<NixOS#476830> but even before that we
did not move `libz.dll.a` so I think it makes sense to just disable this
split on windows.

Fixes: NixOS#476830 (comment)
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
@ghpzin ghpzin mentioned this pull request Mar 1, 2026
13 tasks
@marcin-serwin marcin-serwin deleted the push-mrpnmksllpqq branch March 3, 2026 16:47
@ghpzin ghpzin mentioned this pull request Mar 7, 2026
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to use pkg-config with split-outputs for static libs?

3 participants