Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws-sdk-kotlin does not work on apple silicon #473

Closed
michaelbrewer opened this issue Dec 14, 2021 · 9 comments
Closed

aws-sdk-kotlin does not work on apple silicon #473

michaelbrewer opened this issue Dec 14, 2021 · 9 comments
Assignees
Labels
bug This issue is a bug.

Comments

@michaelbrewer
Copy link

Describe the bug

Currently using the aws-sdk-kotlin on Apple Silicon does not work

Unable to unpack AWS CRT lib: java.io.IOException: Unable to open library in jar for AWS CRT: /osx/armv8/libaws-crt-jni.dylib
java.io.IOException: Unable to open library in jar for AWS CRT: /osx/armv8/libaws-crt-jni.dylib
	at software.amazon.awssdk.crt.CRT.extractAndLoadLibrary(CRT.java:158)
	at software.amazon.awssdk.crt.CRT.loadLibraryFromJar(CRT.java:223)
	at software.amazon.awssdk.crt.CRT.<clinit>(CRT.java:33)
	at software.amazon.awssdk.crt.CrtResource.<clinit>(CrtResource.java:100)
	at aws.sdk.kotlin.crt.io.EventLoopGroup.<init>(EventLoopGroupJVM.kt:22)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO$EventLoop$2.invoke(SdkDefaultIO.kt:24)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO$EventLoop$2.invoke(SdkDefaultIO.kt:22)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO.getEventLoop(SdkDefaultIO.kt:22)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO$ClientBootstrap$2.invoke(SdkDefaultIO.kt:38)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO$ClientBootstrap$2.invoke(SdkDefaultIO.kt:37)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO.getClientBootstrap(SdkDefaultIO.kt:37)
	at aws.sdk.kotlin.runtime.http.engine.crt.CrtHttpEngine.<init>(CrtHttpEngine.kt:60)
	at aws.sdk.kotlin.runtime.http.engine.crt.CrtHttpEngine.<init>(CrtHttpEngine.kt:32)
	at aws.sdk.kotlin.services.dynamodb.DefaultDynamoDbClient.<init>(DefaultDynamoDbClient.kt:36)
	at aws.sdk.kotlin.services.dynamodb.DynamoDbClient$Companion.invoke(DynamoDbClient.kt:64)
	at aws.sdk.kotlin.services.dynamodb.DynamoDbClient$Companion.invoke$default(DynamoDbClient.kt:58)

Expected behavior

To not fail

Current behavior

Raises

Caused by: software.amazon.awssdk.crt.CrtRuntimeException: software.amazon.awssdk.crt.CrtRuntimeException: Unable to unpack AWS CRT library UNKNOWN(-1) UNKNOWN(-1)
	at software.amazon.awssdk.crt.CRT.loadLibraryFromJar(CRT.java:233)
	at software.amazon.awssdk.crt.CRT.<clinit>(CRT.java:33)
	... 23 more

Steps to Reproduce

Run the following code:

import aws.sdk.kotlin.services.dynamodb.DynamoDbClient

suspend fun main() {
    val client = DynamoDbClient { region = "us-west-2" }
    client.listTables { limit = 10 }
}

Possible Solution

Fix related issue : awslabs/aws-crt-java#371

Context

No response

AWS Kotlin SDK version used

0.9.5-beta

Platform (JVM/JS/Native)

openjdk 17.0.1 2021-10-19 LTS

Operating System and version

Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:01 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T6000 arm64

@michaelbrewer michaelbrewer added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 14, 2021
@aajtodd aajtodd removed the needs-triage This issue or PR still needs to be triaged. label Jan 18, 2022
@tajchert
Copy link

tajchert commented Jan 30, 2022

Hi,
I'm using 0.11.0-beta and facing the same issue (as well Apple Silicone - M1 ARM), stack trace below just in case it is needed. Just to let you know as #489 was closed but it is not solving this issue (or not completely).
For now, I'll have to go back to Java SDK for AWS DynamoDB.

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.
Unable to unpack AWS CRT lib: java.io.IOException: Unable to open library in jar for AWS CRT: /osx/armv8/libaws-crt-jni.dylib
java.io.IOException: Unable to open library in jar for AWS CRT: /osx/armv8/libaws-crt-jni.dylib
	at software.amazon.awssdk.crt.CRT.extractAndLoadLibrary(CRT.java:158)
	at software.amazon.awssdk.crt.CRT.loadLibraryFromJar(CRT.java:223)
	at software.amazon.awssdk.crt.CRT.<clinit>(CRT.java:33)
	at software.amazon.awssdk.crt.CrtResource.<clinit>(CrtResource.java:100)
	at aws.sdk.kotlin.crt.io.EventLoopGroup.<init>(EventLoopGroupJVM.kt:22)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO$EventLoop$2.invoke(SdkDefaultIO.kt:24)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO$EventLoop$2.invoke(SdkDefaultIO.kt:22)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO.getEventLoop(SdkDefaultIO.kt:22)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO$ClientBootstrap$2.invoke(SdkDefaultIO.kt:38)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO$ClientBootstrap$2.invoke(SdkDefaultIO.kt:37)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at aws.sdk.kotlin.runtime.crt.SdkDefaultIO.getClientBootstrap(SdkDefaultIO.kt:37)
	at aws.sdk.kotlin.runtime.http.engine.crt.CrtHttpEngine.<init>(CrtHttpEngine.kt:60)
	at aws.sdk.kotlin.runtime.http.engine.crt.CrtHttpEngine.<init>(CrtHttpEngine.kt:32)
	at aws.sdk.kotlin.services.dynamodb.DefaultDynamoDbClient.<init>(DefaultDynamoDbClient.kt:36)
	at aws.sdk.kotlin.services.dynamodb.DynamoDbClient$Companion.invoke(DynamoDbClient.kt:64)
	at aws.sdk.kotlin.services.dynamodb.DynamoDbClient$Companion.invoke$default(DynamoDbClient.kt:58)

@etolstoy
Copy link

etolstoy commented Mar 5, 2022

Tried with 0.13.1-beta, still doesn't work with Apple Silicon with the same error as above. Any plans to fix it in the upcoming versions?

@ianbotsf
Copy link
Contributor

We're working on two fronts to make the SDK work on M1:

  • Remove CRT as a required dependency, enabling the SDK to work anywhere that Kotlin/JVM supports (including Apple M1)
  • Add support for M1 to CRT (see related aws-crt-java#371)

@rrva
Copy link

rrva commented May 28, 2022

It seems that aws-crt does support M1 now? I noticed that 0.16.0 pulls in an old version of aws-crt

@vcanuel
Copy link

vcanuel commented May 29, 2022

Indeed M1 is now supported in aws-crt-java-0.16.10. Hope we could bump to this version soon :)

@erwinw
Copy link

erwinw commented May 31, 2022

Can confirm, getting gradle to ...

resolutionStrategy.force("software.amazon.awssdk.crt:aws-crt:0.16.12")

... works like a charm 🪄 !

@aajtodd
Copy link
Collaborator

aajtodd commented May 31, 2022

This will also be OBE sometime soon as we are removing the CRT as a hard dependency for most use cases.

But until then we will get this bumped soon. As @erwinw pointed out you can force it to a later version today as a workaround.

@aajtodd
Copy link
Collaborator

aajtodd commented Jun 6, 2022

This should be fixed in 0.16.1-beta.

The SDK no longer uses the CRT by default (we also upgraded to 0.16.3 of aws-crt-java as well so if you do choose to use the CRT based HTTP engine it should also work on M1).

NOTE: Multi Region Access Points (which the SDK does not yet support, see #625) still may require explicitly configuring a CRT based signer, we are still investigating paths forward.

@aajtodd aajtodd closed this as completed Jun 6, 2022
@github-actions
Copy link

github-actions bot commented Jun 6, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants