sgerrand/alpine-pkg-glibc

jvm can not start after updating glibc from 2.33 to 2.34

lp2jx0309 opened this issue · 10 comments

Are there major incompatible changes,and how to resolve? tks ! @sgerrand
alpine: 3.13.2
glibc: 2.34
openjdk: 8u302
the error info:
/tmp/apk # openj9-8u302-linux-x64/bin/java -version
Error: Port Library failed to initialize: -1
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Hello. Thank you for reporting this issue. In order for me to investigate this further for you, would you please provide more details about the setup of your Alpine Linux environment:

  • Are you running Alpine in Docker or otherwise?
  • If in Docker would you please share the Dockerfile.
  • How did you install the OpenJDK version and where was it downloaded from?

I running Alpine in Docker ,some apks and jdk are installed in Dockerfile.
jdk was downloaded from https://adoptopenjdk.net/releases.html?variant=openjdk8&jvmVariant=openj9.
the repositories can be replaced by others.
RUN echo "http://repositories/alpine/v3.13/main" > /etc/apk/repositories
&& apk add --no-cache --allow-untrusted glibc
libgcc
glibc-bin
glibc-i18n
tzdata
&& /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true
&& echo "export LANG=$LANG" > /etc/profile.d/locale.sh
&& apk add --no-cache --allow-untrusted brotli-libs
libcrypto1.1
busybox
zlib
nghttp2-libs
curl
libcurl
libssl1.1
ca-certificates
libpng
libuuid
libbz2
freetype
expat
fontconfig
libfontenc
mkfontscale
encodings
ttf-dejavu
&& fc-cache
&& echo "" > /etc/apk/repositories

Thanks, that's helpful. What is "$LANG" set to?

Thanks, the env are:
ENV LANG=C.UTF-8
LD_LIBRARY_PATH=/lib64
TMOUT=600

Thanks, that's helpful. What is "$LANG" set to?

Thanks, the env are:
ENV LANG=C.UTF-8
LD_LIBRARY_PATH=/lib64
TMOUT=600

dpzin commented

same problem, have any solutions? @lp2jx0309 @sgerrand

I've looked into this further and this Dockerfile will work for that Java version:

FROM alpine:3.13.2 AS adoptopenjdk-downloader
WORKDIR /tmp
RUN wget https://github.com/AdoptOpenJDK/semeru8-binaries/releases/download/jdk8u302-b08_openj9-0.27.0/ibm-semeru-open-jre_x64_linux_8u302b08_openj9-0.27.0.tar.gz
RUN tar -xzf ibm-semeru-open-jre_x64_linux_8u302b08_openj9-0.27.0.tar.gz

FROM alpine:3.13.2 AS final
ENV LANG=C.UTF-8 
ENV LD_LIBRARY_PATH=/lib64 

COPY --from=adoptopenjdk-downloader /tmp/jdk8u302-b08-jre /usr/local/jdk8u302-b08-jre

WORKDIR /tmp
RUN 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/2.34-r0/glibc-2.34-r0.apk \
  && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-bin-2.34-r0.apk \
  && wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.34-r0/glibc-i18n-2.34-r0.apk \
  && apk add glibc-2.34-r0.apk glibc-bin-2.34-r0.apk glibc-i18n-2.34-r0.apk
#RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
#COPY glibc*.apk ./
RUN apk add glibc-2.34-r0.apk glibc-bin-2.34-r0.apk glibc-i18n-2.34-r0.apk \
  && rm -v ./glibc*.apk

WORKDIR /

RUN apk add --no-cache \
  libgcc \
  tzdata
RUN /usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true
RUN echo "export LANG=$LANG" > /etc/profile.d/locale.sh
RUN apk add --no-cache --allow-untrusted \
  brotli-libs \
  libcrypto1.1 \
  busybox \
  zlib \
  nghttp2-libs \
  curl \
  libcurl \
  libssl1.1 \
  ca-certificates \
  libpng \
  libuuid \
  libbz2 \
  freetype \
  expat \
  fontconfig \
  libfontenc \
  mkfontscale \
  encodings \
  ttf-dejavu \
  libstdc++6 \
  && fc-cache \
  && ln -sv /usr/lib/gcc/x86_64-alpine-linux-musl/6.4.0/libstdc++.so.6 /usr/glibc-compat/lib/libstdc++.so.6
/usr/local/jdk8u302-b08-jre/bin/java -version
openjdk version "1.8.0_302"
IBM Semeru Runtime Open Edition (build 1.8.0_302-b08)
Eclipse OpenJ9 VM (build openj9-0.27.0, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20210728_193 (JIT enabled, AOT enabled)
OpenJ9   - 1851b0074
OMR      - 9db1c870d
JCL      - de702c3174 based on jdk8u302-b08)

The key elements are to install the libstdc++6 library and ensure that your Java installation can find it.

(@lp2jx0309, please accept my apologies for the delay in looking into your issue! ❤️)

(@lp2jx0309, please accept my apologies for the delay in looking into your issue! heart)

@sgerrand Thanks!