snowdrop / java-buildpack-client

A simple buildpack (https://buildpacks.io/) platform implementation as a library for java..
Apache License 2.0
13 stars 7 forks source link

java.lang.UnsatisfiedLinkError JNA missing compatible architecture (have 'i386,x86_64', need 'arm64') #54

Closed cmoulliard closed 3 weeks ago

cmoulliard commented 9 months ago

Issue

When we try to run the following java application doing a buildpack build on Macos ARM machine, the followign error is reported

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/cmoullia/Library/Caches/JNA/temp/jna2423450550123200248.tmp: dlopen(/Users/cmoullia/Library/Caches/JNA/temp/jna2423450550123200248.tmp, 0x0001): tried: '/Users/cmoullia/Library/Caches/JNA/temp/jna2423450550123200248.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/cmoullia/Library/Caches/JNA/temp/jna2423450550123200248.tmp' (no such file), '/Users/cmoullia/Library/Caches/JNA/temp/jna2423450550123200248.tmp' (fat file, but missing compatible architecture (have 'i386,x86_64', need 'arm64'))
    at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2394)
    at java.base/java.lang.Runtime.load0(Runtime.java:755)
    at java.base/java.lang.System.load(System.java:1953)
    at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
    at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
    at com.sun.jna.Native.<clinit>(Native.java:195)
    at com.github.dockerjava.httpclient5.UnixDomainSocket.<clinit>(UnixDomainSocket.java:80)
    at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl$2.createSocket(ApacheDockerHttpClientImpl.java:120)
    at org.apache.hc.client5.http.impl.io.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:125)
    at org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:409)
    at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:164)
    at org.apache.hc.client5.http.impl.classic.InternalExecRuntime.connectEndpoint(InternalExecRuntime.java:174)
    at org.apache.hc.client5.http.impl.classic.ConnectExec.execute(ConnectExec.java:135)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
    at org.apache.hc.client5.http.impl.classic.ProtocolExec.execute(ProtocolExec.java:165)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
    at org.apache.hc.client5.http.impl.classic.HttpRequestRetryExec.execute(HttpRequestRetryExec.java:93)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
    at org.apache.hc.client5.http.impl.classic.RedirectExec.execute(RedirectExec.java:116)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement$1.proceed(ExecChainElement.java:57)
    at org.apache.hc.client5.http.impl.classic.ContentCompressionExec.execute(ContentCompressionExec.java:128)
    at org.apache.hc.client5.http.impl.classic.ExecChainElement.execute(ExecChainElement.java:51)
    at org.apache.hc.client5.http.impl.classic.InternalHttpClient.doExecute(InternalHttpClient.java:178)
    at org.apache.hc.client5.http.impl.classic.CloseableHttpClient.execute(CloseableHttpClient.java:67)
    at com.github.dockerjava.httpclient5.ApacheDockerHttpClientImpl.execute(ApacheDockerHttpClientImpl.java:158)
    at com.github.dockerjava.httpclient5.ApacheDockerHttpClient.execute(ApacheDockerHttpClient.java:8)
    at com.github.dockerjava.core.DefaultInvocationBuilder.execute(DefaultInvocationBuilder.java:228)
    at com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:202)
    at com.github.dockerjava.core.DefaultInvocationBuilder.get(DefaultInvocationBuilder.java:74)
    at com.github.dockerjava.core.exec.ListImagesCmdExec.execute(ListImagesCmdExec.java:41)
    at com.github.dockerjava.core.exec.ListImagesCmdExec.execute(ListImagesCmdExec.java:16)
    at com.github.dockerjava.core.exec.AbstrSyncDockerCmdExec.exec(AbstrSyncDockerCmdExec.java:21)
    at com.github.dockerjava.core.command.AbstrDockerCmd.exec(AbstrDockerCmd.java:35)
    at dev.snowdrop.buildpack.docker.ImageUtils.pullImages(ImageUtils.java:39)
    at dev.snowdrop.buildpack.Buildpack.prep(Buildpack.java:220)
    at dev.snowdrop.buildpack.Buildpack.build(Buildpack.java:104)
    at dev.snowdrop.buildpack.Buildpack.<init>(Buildpack.java:98)
    at dev.snowdrop.buildpack.EditableBuildpack.<init>(EditableBuildpack.java:16)
    at dev.snowdrop.buildpack.BuildpackBuilder.build(BuildpackBuilder.java:72)
    at dev.snowdrop.App.main(App.java:17)

using this example

package dev.snowdrop;

import java.io.File;
import dev.snowdrop.buildpack.*;

/**
 * Hello world !
 *
 */
public class App {
    public static void main(String... args) {
        Buildpack.builder()
                .addNewFileContent(new File("."))
                .withBuilderImage("dpaketobuildpacks/builder-jammy-tiny")
                .withFinalImage("snowdrop/hello-quarkus:latest")
                .build();
    }
}

Remark: I got the same error using JDK Temurin 17 or 20

@BarDweller @iocanel

iocanel commented 9 months ago

Not much we can do from our end we need to raise this to the docket client

cmoulliard commented 9 months ago

o the docket client

Done. See: https://github.com/docker-java/docker-java/issues/2206 @iocanel

BarDweller commented 3 weeks ago

@cmoulliard we moved from 3.2.14 to 3.3.4 as part of the platform-12 update, can you verify if this is still an issue? (and if so, can you try moving to 3.3.6 (their latest), and see if it still occurs?

cmoulliard commented 3 weeks ago

I did a new test on MacOS ARM using ./pack.java executed part of the quarkus hello sample and the error is gone now