sgerrand / alpine-pkg-glibc

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

jvm can not start after updating glibc from 2.33 to 2.34 #166

Closed lp2jx0309 closed 2 years ago

lp2jx0309 commented 2 years ago

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.

sgerrand commented 2 years ago

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:

lp2jx0309 commented 2 years ago

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

sgerrand commented 2 years ago

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

lp2jx0309 commented 2 years ago

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

lp2jx0309 commented 2 years ago

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 2 years ago

same problem, have any solutions? @lp2jx0309 @sgerrand

sgerrand commented 2 years ago

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)
sgerrand commented 2 years ago

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

sgerrand commented 2 years ago

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

lp2jx0309 commented 2 years ago

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

@sgerrand Thanks!