sgerrand / alpine-pkg-glibc

A glibc compatibility layer package for Alpine Linux
2.05k stars 280 forks source link

Any chance of a packaged glibc-compatible zlib? #161

Open jalaziz opened 3 years ago

jalaziz commented 3 years ago

I realize this has been asked before in #75, but I'm creating this issue for two reasons:

  1. 75 does not directly mention zlib, so this may help others discover the issue.

  2. While I realize that it doesn't necessarily make sense to include zlib in the glibc package, would it make sense to distribute a glibc compatible zlib alongside the glibc package?

While not all glibc-compiled binaries require zlib, it does seem to be a somewhat common dependency and it's a bit of a gotcha when trying to run on Alpine.

One of the sources of confusion is when you run ldd, it would appear that libz is available:

    /lib64/ld-linux-x86-64.so.2 (0x7f90e4ac5000)
    libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f90e4ac5000)
    libz.so.1 => /lib/libz.so.1 (0x7f90e4aab000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f90e4ac5000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f90e4ac5000)

I personally ran into this issue not due to OpenJDK, but rather from trying to run a PyInstaller-based Python "binary".

While the solution of grabbing zlib from Archi Linux seems to work, it would be nice to be able to download a compatible version of zlib alongside the glibc package.

While I'm happy to give it a try myself, if there's any appetite for it to be included in this repo, that would be preferred as it would ease discovery.

sgerrand commented 3 years ago

One of the sources of confusion is when you run ldd, it would appear that libz is available

Which ldd are you running? The version from this package or one elsewhere in your operating system? It's not clear from this comment.

jalaziz commented 3 years ago

One of the sources of confusion is when you run ldd, it would appear that libz is available

Which ldd are you running? The version from this package or one elsewhere in your operating system? It's not clear from this comment.

Apologies, ldd from alpine. The image I was testing the issue on didn't have the bin package installed. I'm presuming that was an additional source of confusion for me. When comparing ldd output of different binaries, I saw some pointed to /lib/ld-musl-x86_64.so.1, which led me to believe /lib64/ld-linux-x86-64.so.2 meant it was pointed at this package. That was stupid in hindsight.

That was then compounded by noticing that libz was missing and then trying to install zlib using apk to no avail. Again, in hindsight, I should've realized that wouldn't have possibly worked.

However, given that it seems other have made a similar mistake, maybe the solution can be simpler?

sgerrand commented 3 years ago

No worries and thanks for the additional context! I have just realised that while I worked on creating a glibc-zlib package for this exact use case (specifically in this commit), I never got around to releasing it. 🤦

I'll correct that by releasing the additional package later today. I think that'll be the easiest way to make this process simpler.

brainthinks commented 3 years ago

This would did help me bigtime as well - thanks!

I realized that I needed to install the regular apk AND the bin apk.