alpine-pkg-glibc icon indicating copy to clipboard operation
alpine-pkg-glibc copied to clipboard

__snprintf_chk: symbol not found

Open inf3cti0n95 opened this issue 5 years ago • 8 comments

I am trying out a python library which depends on glibc and it throws error on alpine.

/code # ldd /usr/local/lib/python3.7/site-packages/pyarmor/platforms/linux64/_pytransform.so
	ldd (0x7fa1693c4000)
	libdl.so.2 => ldd (0x7fa1693c4000)
	libc.so.6 => ldd (0x7fa1693c4000)
Error relocating /usr/local/lib/python3.7/site-packages/pyarmor/platforms/linux64/_pytransform.so: __snprintf_chk: symbol not found
Error relocating /usr/local/lib/python3.7/site-packages/pyarmor/platforms/linux64/_pytransform.so: __memcpy_chk: symbol not found
Error relocating /usr/local/lib/python3.7/site-packages/pyarmor/platforms/linux64/_pytransform.so: __fgets_chk: symbol not found
Error relocating /usr/local/lib/python3.7/site-packages/pyarmor/platforms/linux64/_pytransform.so: __strcpy_chk: symbol not found
Error relocating /usr/local/lib/python3.7/site-packages/pyarmor/platforms/linux64/_pytransform.so: __fprintf_chk: symbol not found
Error relocating /usr/local/lib/python3.7/site-packages/pyarmor/platforms/linux64/_pytransform.so: __sprintf_chk: symbol not found

inf3cti0n95 avatar Feb 22 '19 07:02 inf3cti0n95

@inf3cti0n95 Do you use Python built against glibc or official Alpine package? You should not mix libraries/binaries compiled against different libc. I can only suggest you try frolvlad/alpine-miniconda3 image, which bundles Miniconda Python distribution on top of Alpine + glibc.

frol avatar Feb 22 '19 07:02 frol

The miniconda library works fine thanks!

inf3cti0n95 avatar Feb 23 '19 09:02 inf3cti0n95

@frol Is there a simple python3 version of this image. conda wont work for my entire project.

inf3cti0n95 avatar Feb 26 '19 06:02 inf3cti0n95

@inf3cti0n95 I am not aware of such an image, but you can try building your own by using Arch Linux packages following my mono image as an example.

I wonder what exactly is broken in miniconda so your project doesn’t work with it.

frol avatar Feb 26 '19 07:02 frol

@frol I tried, But somehow that on throws me the same error.

inf3cti0n95 avatar Feb 27 '19 06:02 inf3cti0n95

I am experiencing the same behavior with docker-compose:

ERROR: gcloud failed to load: Error relocating /tmp/_MEI7p4C7w/libz.so.1: __snprintf_chk: symbol not found
    gcloud_main = _import_gcloud_main()
    import googlecloudsdk.gcloud_main
    from googlecloudsdk.api_lib.iamcredentials import util as iamcred_util
    from googlecloudsdk.api_lib.util import apis_internal
    from googlecloudsdk.api_lib.util import apis_util
    from googlecloudsdk.core import exceptions
    from googlecloudsdk.core.util import platforms
    import subprocess
    import pickle
    import binascii as _binascii

This usually indicates corruption in your gcloud installation or problems with your Python interpreter.

Please verify that the following is the path to a working Python 2.7 executable:
    /usr/bin/python2

If it is not, please set the CLOUDSDK_PYTHON environment variable to point to a working Python 2.7 executable.

If you are still experiencing problems, please reinstall the Cloud SDK using the instructions here:
    https://cloud.google.com/sdk/
[223] Failed to execute script docker-compose
Traceback (most recent call last):
  File "site-packages/dockerpycreds/store.py", line 74, in _execute
  File "subprocess.py", line 336, in check_output
  File "subprocess.py", line 418, in run
subprocess.CalledProcessError: Command '['/google-cloud-sdk/bin/docker-credential-gcloud', 'get']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages/docker/auth.py", line 129, in _resolve_authconfig_credstore
  File "site-packages/dockerpycreds/store.py", line 35, in get
  File "site-packages/dockerpycreds/store.py", line 87, in _execute
dockerpycreds.errors.StoreError: Credentials store docker-credential-gcloud exited with "".

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "bin/docker-compose", line 6, in <module>
  File "compose/cli/main.py", line 71, in main
  File "compose/cli/main.py", line 127, in perform_command
  File "compose/cli/main.py", line 287, in build
  File "compose/project.py", line 384, in build
  File "compose/project.py", line 366, in build_service
  File "compose/service.py", line 1082, in build
  File "site-packages/docker/api/build.py", line 251, in build
  File "site-packages/docker/api/build.py", line 313, in _set_auth_headers
  File "site-packages/docker/auth.py", line 96, in resolve_authconfig
  File "site-packages/docker/auth.py", line 146, in _resolve_authconfig_credstore
docker.errors.DockerException: Credentials store error: StoreError('Credentials store docker-credential-gcloud exited with "".',)

With the following image:

FROM node:11.10.0-alpine

RUN \
  apk add --no-cache --update \
    bash==4.4.19-r1 \
    ca-certificates==20190108-r0 \
    curl==7.64.0-r1 \
    git==2.20.1-r0 \
    libgcc==8.2.0-r2 \
    libressl2.7-libcrypto==2.7.5-r0 \
    openssl==1.1.1a-r1 \
    python==2.7.15-r3

RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf

RUN \
  export DOCKER_CHANNEL=stable && \
  export DOCKER_VERSION=18.06.3-ce && \
  curl -sfL -o docker.tgz https://download.docker.com/linux/static/${DOCKER_CHANNEL}/x86_64/docker-${DOCKER_VERSION}.tgz && \
  tar xzf docker.tgz --strip-components 1 -C /usr/local/bin && \
  rm docker.tgz

RUN \
  export GLIBC=2.29-r0 && \
  curl -sfL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub&& \
  curl -sfLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$GLIBC/glibc-$GLIBC.apk && \
  apk add --no-cache glibc-$GLIBC.apk && \
  rm glibc-$GLIBC.apk && \
  ln -s /lib/libz.so.1 /usr/glibc-compat/lib/ && \
  ln -s /lib/libc.musl-x86_64.so.1 /usr/glibc-compat/lib && \
  ln -s /usr/lib/libgcc_s.so.1 /usr/glibc-compat/lib

RUN \
  export DOCKER_COMPOSE_VERSION=1.23.2 && \
  curl -sfL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose && \
  chmod +x /usr/local/bin/docker-compose

ENV PATH /google-cloud-sdk/bin:$PATH
RUN \
  export CLOUD_SDK_VERSION=237.0.0 && \
  curl -sfLO https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
  tar xzf google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
  rm google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
  gcloud config set core/disable_usage_reporting true && \
  gcloud config set component_manager/disable_update_check true && \
  gcloud components install beta

kilianc avatar Mar 11 '19 18:03 kilianc

After my investigation I realized that docker-compose stops working if gcloud auth configure-docker is called before docker-compose build.

Looks like there are some incompatibilities between gcloud sdk and docker-compose, as mention in other places as well seems related to python. Any idea how to get around this?

kilianc avatar Nov 14 '19 03:11 kilianc

@inf3cti0n95 Do you use Python built against glibc or official Alpine package? You should not mix libraries/binaries compiled against different libc. I can only suggest you try frolvlad/alpine-miniconda3 image, which bundles Miniconda Python distribution on top of Alpine + glibc.

It works, thanks

StudyForZX avatar Jul 15 '20 02:07 StudyForZX