Skip to content

Add -lz when PHOBOS_SYSTEM_ZLIB=on and -link-defaultlib-shared #4963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2025

Conversation

the-horo
Copy link
Contributor

@the-horo the-horo commented Aug 3, 2025

Some projects use the zlib C function directly and, given that those symbols are available when phobos embeds zlib (the default) and when linking the stdlib statically, the projects often don't include a -lz in their build settings. This omission then prevents a successful build with PHOBOS_SYSTEM_ZLIB=on and
-link-defaultlib-shared.

Until a permanent decision is made if those projects should change their build scripts or if the compiler should always add -lz, add the library anyway, to minimize breakages.

This also makes the behavior consistent with gdc which also adds an unconditional -lz when zlib is not embedded.

See-Also: #4742

Some projects use the zlib C function directly and, given that those
symbols are available when phobos embeds zlib (the default) and when
linking the stdlib statically, the projects often don't include a
`-lz` in their build settings. This omission then prevents a
successful build with PHOBOS_SYSTEM_ZLIB=on and
-link-defaultlib-shared.

Until a permanent decision is made if those projects should change
their build scripts or if the compiler should always add `-lz`, add
the library anyway, to minimize breakages.

This also makes the behavior consistent with gdc which also adds an
unconditional `-lz` when zlib is not embedded.

See-Also: ldc-developers#4742
Signed-off-by: Andrei Horodniceanu <[email protected]>
@the-horo
Copy link
Contributor Author

the-horo commented Aug 3, 2025

ping @schveiguy

@thewilsonator thewilsonator merged commit 9db6d95 into ldc-developers:master Aug 3, 2025
18 checks passed
@schveiguy
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants