-
Notifications
You must be signed in to change notification settings - Fork 50
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
Dynamic linking zlib for Linux #118
Comments
'--with-zlib' is an option for configure. the term bundle here means the building system will pick up the libraries bundled with the repository. Alternatively, it could choose the libraries provided from the system or even find one from a custom location. https://github.com/corretto/corretto-17/blob/develop/make/autoconf/lib-bundled.m4 How to link zlib is not determine by configure. it's up by LDFLAGS, or the flags pass to your linker. We are supposed to link shared libraries dynamically. LDFLAGS usually is as simple as -labc. it denotes that we want to dynamically link libabc.so. if you really want to statically link a library, you need to find the archive file and link it explicitly for instance |
#125 merged. Closing. |
Reopening this issue for gathering feedback. |
I'm getting missing |
Depending on how you're installing corretto it's certainly possible. This change is linux only, to start with, so if you're on another platform you can stop reading, it's something else. The installer packages (deb, rpm, apk) were updated to depend on zlib, so it should have been installed if missing. However if you're using the .tar.gz bundles there's no automated dependency installation, so if your environment does not have zlib present it could cause that error. It should be fairly straightforward to test, if you can install packages in your environment - just install the package that provides libz.so.1 for your distro and see if the error goes away. |
I also use distroless, and recently updated from an older version. |
well, I can do the workaround mentioned in that other issue, but it is slightly inconvenient. |
Seeking for feedback
Let us know if you have concerns on this change and how we can improve.
Changes
Corretto now uses system zlib rather than bundled zlib.
In the past, Corretto would bundle zlib (use
libz.so
built from the zlib bundled in JDK source), for linux except for AL, code. Howver, OpenJDK usessystem
(uselibz.so
installed in system or passed inLD_LIBRARY_PATH
) for linux by default. code. We made zlib in Corretto asbundled
only for historical reason. In order to have the parity, we should make it dynamic linking for all linux platforms.Keep
bundled
for Windows as Windows doesn't have zlib out of box. Also keep mac asbundled
for https://bugs.openjdk.org/browse/JDK-8286623.User experience
Users are not expected to make any code change or observe behavior differences. Under the hood, instead of using the
libz.so
built from Corretto source, now Corretto will rely onlibz.so
on the system or in theLD_LIBRARY_PATH
if it is set.libz.so
is a low level library that majority of the systems have out of box (CentOS, Ubuntu, alpine etc.)With this change, you can use a different
libz.so
rather than stick with the bundled zlib. You can pass the library location toLD_LIBRARY_PATH
:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<libz.so path>
. You can then verify if the path set successfully vialdconfig -p | grep libz
.Target Release Date
The code enabling zlib dynamic linking has already been pushed to Corretto source. It will be published in our next quarterly release (2023-07-18).
In the meantime, you can download our latest nightly builds to try it out: https://downloads.corretto.aws/#/downloads?build=nightly
The text was updated successfully, but these errors were encountered: