Migrating from zlib to zlib-ng and concerns about compat build. #1467
-
This discussion helped me a lot and I would appreciate if you guys can help me to avoid making very bad things. I was going to automatically override all vcpkg packages installation behavior by changing zlib dependency with zlib-ng COMPAT mode on the false belief that in this way they would use automatically next gen instructions when available and old zlib when not. From what I have understood, this would only happen if the source code of each package is modified to call functions from
So, I'm wondering why I see here and elsewhere people trying to do a direct replacement when without recompiling and changing the source code it will just have the speed of the old zlib or a bit faster at best.
In the case of vcpkg packages, they're always compiled locally prior to installation. I have yet to understand how to modify the source code during the process, but by giving a quick look, patches can be applied by installing in editable mode. By reading the PORTING help, seems to be that all is needed is just a I've also like to know if support for legacy zlib compatibility is going to be dropped in the future in order to save myself from wasting time and resources for nothing. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You seem to be confused about what is compat api vs native api, or perhaps what an API is to begin with. zlib-ng compiled in zlib compat mode results in a dll/so file that acts like it is a stock zlib, but it is the full zlib-ng under the hood, all speedups included. Those two are not interchangeable. An application uses the dll/so file from one or the other API.
If you are looking for information about how to change your application to from using zlib API to zlib-ng API, you can have a look at the patch I have made for Nginx, it switches Nginx from using zlib API to zlib-ng API, but it is a bit crude since it does not do compile-time detection and choice. https://github.com/zlib-ng/patches/blob/master/nginx/1.18.0-zlib-ng.patch I hope that clears things up a bit. |
Beta Was this translation helpful? Give feedback.
You seem to be confused about what is compat api vs native api, or perhaps what an API is to begin with.
zlib-ng compiled in zlib compat mode results in a dll/so file that acts like it is a stock zlib, but it is the full zlib-ng under the hood, all speedups included.
zlib-ng compiled with its own api is very similar but it uses different function names to avoid linker conflicts, and we have cleaned away several old functions, macros, and are using updated datatypes, etc.
Those two are not interchangeable. An application uses the dll/so file from one or the other API.
If you have a bunch of old applications that don't support the zlib-ng API (If you make a linux distro for example), they…