corretto / corretto-17

Amazon Corretto 17 is a no-cost, multi-platform, production-ready distribution of OpenJDK 17
GNU General Public License v2.0
201 stars 47 forks source link

Issue with amazoncorretto:17-alpine3.17-jdk to use libsapjco3.so #142

Closed kartheek-reddy-gv closed 11 months ago

kartheek-reddy-gv commented 1 year ago

Describe the bug

java.lang.UnsatisfiedLinkError: /usr/lib/libsapjco3.so: Error loading shared library libuuid.so.1:No such file or directory(needed by /usr/lib/libsapjco3.so). Getting this issue when I use amazoncorretto:17-alpine3.17-jdk, no issue with other Debian based docker images.

To Reproduce

Dockerfile FROM amazoncorretto:17-alpine3.17-jdk LABEL vendor="---" VOLUME ["---"] ADD maven/@file@ app.jar COPY libsapjco3.so /usr/lib/libsapjco3.so RUN chmod a+x -R /usr/lib/libsapjco3.so

Expected behavior

Copies the file libsapjco3.so from the build context to the /usr/lib/ directory inside the Docker image and make it executable

Platform information

OS: Linux
Version :amazoncorretto:17-alpine3.17-jdk
benty-amzn commented 1 year ago

libuuid.so.1 is provided by libuuid on alpine linux, but as far as I can tell it is not installed by default - you can try adding apk add libuuid to your dockerfile and it may resolve the issue

kartheek-reddy-gv commented 1 year ago

libuuid.so.1 is provided by libuuid on alpine linux, but as far as I can tell it is not installed by default - you can try adding apk add libuuid to your dockerfile and it may resolve the issue

I tried adding libuuid but still facing same issue.

lutkerd commented 1 year ago

Can you run ldd /usr/lib/libsapjco3.so and let us know the full list of required shared libraries?

kartheek-reddy-gv commented 1 year ago

Can you run ldd /usr/lib/libsapjco3.so and let us know the full list of required shared libraries?

Below is the list of libraries /1ib/1d-musl-x86_64.s0.1 (0x7£d1d01e9000) libdl.so.2 => /lib/ld-musl-x86_64.s0.1 (0x7£d1d01e9000) librt.so.l => /lib/ld-musl-x8664.so0.1 (0x7£d1d01e9000) libuuid.so.l => /lib/libuuid.so.l (0x7£dlcf9ec000) libc.so.6 => /lib/ld-musl-x86 64.s0.1 (0x7£d1d01e9000) libstdc++.s50.6 => /usr/lib/libstdc++.s0.6 (0x7£d1cf79e000) libm.so.6 => /lib/ld-musl-x86_ 64.s0.1 (0x7£d1d01e9000) libgcc_s.so.l => /usr/lib/libgcc s.so.l (0x7£d1c£780000) libpthread.so.0 => /lib/ld-musl-x86_64.s0.1 (0x7£d1d01e9000)

benty-amzn commented 1 year ago

After running apk add libuuid is the file /lib/libuuid.so.1 present in the container?

kartheek-reddy-gv commented 12 months ago

After running apk add libuuid is the file /lib/libuuid.so.1 present in the container?

libuuid-2.38.1-r1 is present in the container Below is the list of libraries in the container

alpine-baselayout-3.4.0-r0 - Alpine base dir structure and init scripts alpine-baselayout-data-3.4.0-r0 - Alpine base dir structure and init scripts alpine-keys-2.4-r1 - Public keys for Alpine Linux packages amazon-corretto-17-17.0.7.7.1-r0 - Corretto17 apk-tools-2.12.10-r1 - Alpine Package Keeper - package manager for alpine busybox-1.35.0-r29 - Size optimized toolbox of many common UNIX utilities busybox-binsh-1.35.0-r29 - busybox ash /bin/sh ca-certificates-bundle-20220614-r4 - Pre generated bundle of Mozilla certificates java-common-0.5-r0 - Java common (updates java links) libcrypto3-3.0.8-r3 - Crypto library from openssl libc-utils-0.7.2-r3 - Meta package to pull in correct libc libssl3-3.0.8-r3 - SSL shared libraries libuuid-2.38.1-r1 - DCE compatible Universally Unique Identifier library musl-1.2.3-r4 - the musl c library (libc) implementation musl-utils-1.2.3-r4 - the musl c library (libc) implementation scanelf-1.3.5-r1 - Scan ELF binaries for stuff ssl_client-1.35.0-r29 - EXternal ssl_client for busybox wget unzip-6.0-r13 - Extract PKZIP-compatible .zip files zlib-1.2.13-r0 - A compression/decompression Library

benty-amzn commented 12 months ago

Thanks. I think we've reached the point where a reproducer would be helpful. It seems like you're trying to run SAP java connector, is there a particular version or set of steps to reproduce the error? Can you share a minimal dockerfile?

simonis commented 12 months ago

@kartheek-reddy-gv I'm not sure if the "SAP java connector" is supported on Alpine Linux. Maybe @RealCLanger from SAP can help?

Apart from that, I don't understand how you can get a java.lang.UnsatisfiedLinkError: /usr/lib/libsapjco3.so: Error loading shared library libuuid.so.1:No such file or directory(needed by /usr/lib/libsapjco3.so). error if ldd /usr/lib/libsapjco3.so could locate the library:

...
libuuid.so.l => /lib/libuuid.so.l (0x7£dlcf9ec000)
...

Can you please run your offending java command in the same shell like ldd and verify that you still get the same error. If you do, the error might be just misleading and libsapjco3.so might be just not build for and compatible with Alpine Linux. You should ask your SAP contact for further assistance in that case.

RealCLanger commented 12 months ago

@kartheek-reddy-gv I'm not sure if the "SAP java connector" is supported on Alpine Linux. Maybe @RealCLanger from SAP can help?

I'm quite sure it is not supported, at least not if you don't install/use the glibc. But for the final word on that I'm paging @mtolksdorf... what's your take?

mtolksdorf commented 12 months ago

SAP Java Connector 3.1 (currently, the only version in maintenance) is not supported on Alpine Linux. For details about supported operating system (versions) you can read SAP note https://me.sap.com/notes/2786882. If you need to use JCo, you have to switch to one of the supported platforms.

Best regards, Markus

lutkerd commented 12 months ago

You should be able to use the public.ecr.aws/docker/library/amazoncorretto:17-al2023-headless if you don't need javac and that is actually smaller than the 17-alpine-jdk image. If you require a full JDK you can use public.ecr.aws/docker/library/amazoncorretto:17-al2023-jdk which is slightly larger of an image than the Alpine JDK.

kartheek-reddy-gv commented 11 months ago

You should be able to use the public.ecr.aws/docker/library/amazoncorretto:17-al2023-headless if you don't need javac and that is actually smaller than the 17-alpine-jdk image. If you require a full JDK you can use public.ecr.aws/docker/library/amazoncorretto:17-al2023-jdk which is slightly larger of an image than the Alpine JDK.

Thank you @lutkerd It's working fine with amazoncorretto:17-al2023-jdk. Will the SAP Java Connector supports Alpine JDK in future??

mtolksdorf commented 11 months ago

If there is a valid Business Case, it will be for sure taken into consideration. But so far there are no plans.

Best regards, Markus