sgerrand / alpine-pkg-glibc

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

Can't get things to link properly #116

Open timarnold opened 5 years ago

timarnold commented 5 years ago

I'm trying to install a C NATS client (https://libraries.io/github/nats-io/cnats) on my Alpine Linux Docker image. One of their libraries (https://github.com/nats-io/nats.c/blob/master/pbuf/lib/linux/libprotobuf-c.so) links to libc.so.6, and so I followed the instructions for this project to install glibc.

Once I follow the instructions, I still get linker errors. Random facts that may be helpful:

Can anyone point me in the right direction?

timarnold commented 5 years ago

I'm still curious to learn how this works (and why these symbols weren't being found), but I do think I've solved my underlying problem by rebuilding the library in question rather than using this provided prebuilt library that was causing me issues.

sgerrand commented 5 years ago

👋 Alpine Linux uses the musl C library as its libc implementation. I suspect you had the libc6-compat package installed. That's part of the reason for the elements you've observed.

You can see more about how the musl packages are built here: https://git.alpinelinux.org/aports/tree/main/musl/APKBUILD?h=master

sgerrand commented 5 years ago

This package installs the libc.so* files to /usr/glibc-compat/lib/.

e.g.

# ls -l /usr/glibc-compat/lib/libc*
-rwxr-xr-x    1 root     root       1816304 Feb 11 19:28 /usr/glibc-compat/lib/libc-2.29.so
-rw-r--r--    1 root     root           294 Feb 10 17:26 /usr/glibc-compat/lib/libc.so
lrwxrwxrwx    1 root     root            12 Mar 18 02:04 /usr/glibc-compat/lib/libc.so.6 -> libc-2.29.so