Alpine Linux executable file crash report error / lib / x86 not found_ 64 Linux GNU / libc.so solution

reason:

reason:

Most linux software is connected with glibc, GNU libc Library (libc provides standard C library and POSIX API).

Most Linux distributions are based on glibc.

Alpine Linux is based on the musl libc library, which is a minimal implementation and strictly follows POSIX.

For example, executable files built on glibc distribution depend on/lib/x86_ 64 Linux GNU/libc. So. 6, which cannot be used on Alpine (except for static links).

resolvent:

Method 1: install the libc6 compatible package: APK add libc6 compat. This wrapper provides a lightweight glibc compatible layer. For simple applications, that’s enough.

Method 2, install the appropriate glibc on alpine, and provide all glibc methods and functions. Alpine can be built using glibc and should be installed in the following programs (for example):

# Source: https://github.com/anapsix/docker-alpine-java

ENV GLIBC_REPO=https://github.com/sgerrand/alpine-pkg-glibc
ENV GLIBC_VERSION=2.30-r0

RUN set -ex && \
    apk --update add libstdc++ curl ca-certificates && \
    for pkg in glibc-${GLIBC_VERSION} glibc-bin-${GLIBC_VERSION}; \
        do curl -sSL ${GLIBC_REPO}/releases/download/${GLIBC_VERSION}/${pkg}.apk -o /tmp/${pkg}.apk; done && \
    apk add --allow-untrusted /tmp/*.apk && \
    rm -v /tmp/*.apk && \
    /usr/glibc-compat/sbin/ldconfig /lib /usr/glibc-compat/lib

Method 3, using statically linked executable files. The static executable does not have dynamic dependencies and can run on any Linux.

Method 4, the software execution file can be built on alpine

 
 

Read More: