-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add ZLIB_DIR config option, and don't vendor zlib or zlib-ng automatically #147
Comments
Thanks compiling this request, it makes sense to me, and especially the example of A major version bump seems like the right path to release such a change, and I think that In any case, it's quite a journey, but one that seems to make sense to take. |
One issue with a major version bump is that the ecosystem would all have to migrate over, and no crate could have two versions in its dependency tree at the same time, because you can't have two versions of zlib linked into your program at the same time. |
I wonder if there is a way to do this without a major version bump, as that seems like something to generally be avoided. Maybe it's also possible to 'protect' the current release before creating a new major version to support multiple major versions in the same tree. |
I proposed this was SemVer breaking because the way to choose which zlib is built is incompatible. That point may be debatable in light of other potential issues from a major version bump. Removing vendoring is more likely to be an end-user-impacting change, rather than one seen by dependants' developers. The symptom will be along the lines of "package X (which depends on zlib) doesn't build anymore", because the end-user's build environment. This is most likely to impact building on Windows (where you need to bring your own For end-users, it's all fixable pretty easily – this needs some communication with downstream dependants. However, they have limited actions they could take:
Unfortunately, I don't believe that the Rust ecosystem has any way to manage this sort of detection or communication at scale. In any case, the problem is generally with individuals' build environments rather than dependants "holding it wrong", and the current state of The risk with any version bump and symbol renaming is shaking out all the dependants which are holding their version of I think there's going to be some short term pain no matter what, but this is still a defect which needs fixing. |
Actually, there may be one channel to communicate via: rustsec. While it's not a security bug in the traditional sense, I'd argue that "silent auto-vendoring" is a soundness issue in the sense it causes unexpected behaviour, that may warrant an "informational" advisory. |
After having re-read the thread, here is the major points as I understand them:
First of all, if it's a bug it's something that could be fixed without a major version change. This would cause downstream churn for everyone who used auto-vendoring by default who will now have to chose vendoring at the very least. If I see this correctly, this would be an issue for those who build binaries, but also for those who want to run tests of their libraries. If I remember correctly, compiling anything with OpenSSL fails by default if the developer sources aren't installed on the system ( This is why I want to consider the current convenience as valuable and thus as something worth protecting. What if the auto-vendoring could be turned off?Doing so should be another solution to the problem, as it would allow those who have trouble due to vendoring could turn it off. When off, it could act similarly to To me this seems feasible, but please help point out the propositions flaws. |
Any progress or ideas on this? If you build on a system which has a static zlib/libz already compiled, thus a While it probably doesn't hit any errors right now, it could of course. |
There were no additional comments related to the question "What if the auto-vendoring could be turned off?", which might make it the way to go. Such a change would have to be contributed though. |
Any updates on this thread? |
libz-sys
should have a configuration option likeZLIB(_LIB|_INCLUDE)_DIR
which allows you to explicitly point at whichzlib
to use on all platforms, similar to whatopenssl-sys
does withOPENSSL(_LIB|_INCLUDE)_DIR
(documentation).If those environment variables are unset, then
libz-sys
should continue to usevcpkg
,pkg-config
or system paths to findzlib
.Additionally, vendoring should be behind a feature flag, disabled by default, so that
libz-sys
failng to findzlib
is a hard error by default:While auto-vendoring makes
libz-sys
build in more scenarios with zero configuration, it leads to surprising behaviour, and makes it more difficult to track down your dependencies. Again, this is something thatopenssl-sys
does well.There's also no way to reliably force the library to be vendored, except by setting the
static
option - which is itself implemented incorrectly, as it never checks for a system-installed staticzlib
except withvcpkg
.These changes would require a major version bump, as they're SemVer incompatible changes, and will likely break some environments until they can be fixed up.
Some related issues include:
curl-sys
' auto-vendoring having a transitive dependency onlibz-sys
buildingzlib
from source on Windows; which was only noticed whenlibz-sys
improved its dependency management so it didn't auto-vendor)zlib_installed
does not use the correct flags #132 (cross compiling not using system zlib or correct flags)pkg-config
withzlib-ng
, but there's no controls)zlib-ng
build process tries to install to/usr/local
as part of a fall-back)zlib
doesn't work)#83 has a similar request to disable auto-vendoring for
zlib-ng
.The text was updated successfully, but these errors were encountered: