pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

FFI Library Can't Be Loaded on Ubuntu 18.04 LTS #202

Closed adamrodger closed 1 year ago

adamrodger commented 2 years ago

The libpact_ffi.so file requires GLIBC 2.28 and 2.29 by the looks of things, which is missing on Ubuntu 18.04 containers. See https://github.com/pact-foundation/pact-net/issues/402 for further details.

From inside an Ubuntu 18.04 container:

# ldd bin/Debug/net6.0/runtimes/linux-x64/native/libpact_ffi.so

bin/Debug/net6.0/runtimes/linux-x64/native/libpact_ffi.so: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.29' not found (required by bin/Debug/net6.0/runtimes/linux-x64/native/libpact_ffi.so)
bin/Debug/net6.0/runtimes/linux-x64/native/libpact_ffi.so: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by bin/Debug/net6.0/runtimes/linux-x64/native/libpact_ffi.so)
        linux-vdso.so.1 (0x00007fff635f6000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f612634e000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f612612f000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6125d91000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6125b8d000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f612579c000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f61276ca000)
adamrodger commented 2 years ago

Ubuntu 18.04 appears to support up to libc 2.27: https://www.ubuntuupdates.org/package/core/bionic/main/updates/glibc

mefellows commented 2 years ago

We have a similar issue with the current most popular Node Image (16) - see https://github.com/pact-foundation/pact-js/issues/888.

It works on the latest (Node 18) however many will still be stuck on older versions. I'm comfortable recommending against Alpine and have recently improved our official guidance on that, but I wonder if we aren't using any particular features of glibc, could we link against an older version to increase compatibility across the ecosystems?

omajid commented 2 years ago

Hey folks. I did a run down of which Linux distributions include which version of glibc:

Distribution glibc version
Arch Linux 2.36
Alpine 3.13 N/A
CentOS 7 2.17
CentOS Stream 8 2.28
CentOS Stream 9 2.34
Debian 9 (Stretch) 2.24
Debian 10 (Buster) 2.28
Debian 11 (Bullseye) 2.31
Fedora 35 2.34
Homebrew 2.23
OpenSUSE Leap 15.3 2.31
OpenSUSE Tumbleweed 2.35
RHEL 7 2.17
RHEL 8 2.28
RHEL 9 2.34
Ubuntu 18.04 2.27
Ubuntu 20.04 2.31
Ubuntu 22.04 2.35

You can see that requiring glibc 2.29 leaves out a number of large and popular distirubtions, including CentOS 7, CentOS 8, Debian 9, Debian 10, RHEL 7, RHEL 8, Ubuntu 18.04.

Would it be possible to revisit this decision and make the ffi library more compatible? IIRC, it's a matter of rebuilding in an environment that has an old version of glibc. Is there something I can do to help make that happen?

mefellows commented 2 years ago

At the very least, this build would need to be ported to run on an older OS. As a starting point, pinning it to 20.04 would mean we don't make the problem worse when GH automatically migrates us to the latest.

It looks like GH have deprecated the Ubuntu 18.04 release, so presumably the only option will be to create our own runner, probably on CentOS 7 if you want to go back as far as possible and stick with an open distro.

I think SmartBear (my and several other Core Maintainers current employer) will be willing to foot the bill, but somebody needs to do the work to create an image that would work.

rholshausen commented 2 years ago

Library built on Ubuntu 18.04 seems to work on 20.04 and 22.04.

omajid commented 2 years ago

We could just continue to run the build on ubuntu-latest VM, but run the builds (ci or otherwise) inside a container. That will allow us to easily run CI on multiple Linux distributions too. I am prototyping that now.

rholshausen commented 2 years ago

Using an official Rust Debian stretch image, the built shared lib works on Ubuntu 18.04.

mefellows commented 2 years ago

Of course, docker. makes sense 🤦‍♂️

On Fri, 19 Aug 2022, 10:13 Ronald Holshausen, @.***> wrote:

Using an official Rust Debian stretch image, the built shared lib works on Ubuntu 18.04.

— Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-reference/issues/202#issuecomment-1220098942, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAANFDBRXIZQJ47YE7BXZXTVZ3GS3ANCNFSM5ZGTKQZA . You are receiving this because you commented.Message ID: @.***>

omajid commented 2 years ago

Thanks, @rholshausen! I think that gets us to glibc 2.24, which means that only CentOS 7 and RHEL 7 from the matrix above are not covered. I suppose that's something we can live with?

Is there anything remaining here that I can help with?

mefellows commented 2 years ago

I think it's a great start and is going to make a big difference already.

Building on a centos 7 image would get us the best traction obviously, but I don't think it's urgent just yet. Perhaps we wait for demand on those images before we go back that far? I'd prefer to run on a debian based image if possible.

omajid commented 2 years ago

That works for me. (I reserve the right to change my mind :wink: )

Do you know when I should expect a release that works with glibc 2.24?

I see https://github.com/pact-foundation/pact-reference/releases/tag/libpact_ffi-v0.3.8. Thanks!

mefellows commented 2 years ago

That works for me. (I reserve the right to change my mind 😉 )

hahaha

I think it's on the way out, so stay tuned on the releases page as the actions run all of the builds

On Fri, Aug 19, 2022 at 12:19 PM Omair Majid @.***> wrote:

That works for me. (I reserve the right to change my mind 😉 )

Do you know when I should expect a release that works with glibc 2.24?

— Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-reference/issues/202#issuecomment-1220166269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAANFDFYCK3UQKXCCBKKIP3VZ3VJ3ANCNFSM5ZGTKQZA . You are receiving this because you commented.Message ID: @.***>

-- Matt Fellows www.onegeek.com.au calendly.com/mfellows

rholshausen commented 2 years ago

Ok, release build has completed.

@omajid Thanks for all the help. Your table of versions was really useful.

rholshausen commented 1 year ago

Closing this, as I think it is reasonable to have the min version run on Centos/RHEL 8.