sgerrand / alpine-pkg-glibc

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

__rawmemchr: symbol not found #115

Closed lmadarasz closed 5 years ago

lmadarasz commented 5 years ago

I try to use a binary built for ubuntu using glibc on a docker image based on alpine: The environment:

FROM python:2.7-alpine
...
RUN apk upgrade && \
    apk update && \
    apk --no-cache add ca-certificates wget && \
    ALPINE_GLIBC_PACKAGE_VERSION="2.29-r0" && \
    wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
    wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${ALPINE_GLIBC_PACKAGE_VERSION}/glibc-${ALPINE_GLIBC_PACKAGE_VERSION}.apk && \
    apk add --no-cache glibc-${ALPINE_GLIBC_PACKAGE_VERSION}.apk && \
    apk add libstdc++ && \
    rm glibc-*${ALPINE_GLIBC_PACKAGE_VERSION}.apk && \
    apk del ca-certificates wget
...

When I enter into the container I get the following:

# ldd test_prog
    /lib64/ld-linux-x86-64.so.2 (0x7fb466a8a000)
    libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fb466a8a000)
    libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fb466a8a000)
    librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7fb466a8a000)
    libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fb466a8a000)
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fb466a76000)
    libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fb466a8a000)
Error relocating test_prog: __rawmemchr: symbol not found
Error relocating test_prog: __strtok_r: symbol not found

Which libraries are missing here? Unfortunately building the source on alpine is not an option currently so I should make it work if possible. Thanks.

frol commented 5 years ago

You should not mix different libc implementations in a single runtime (your Python seems to be built for musl libc, but you want to load glibc-linked shared library into that musl libc runtime). Learn more: #111, #56, #59.

lmadarasz commented 5 years ago

Thank you for the quick answer. This means that I have to use a glibc-based image or build the binary for musl libc.