Skip to content

Add ARM64 architecture support #275

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

Merged
merged 1 commit into from
Sep 29, 2021
Merged

Add ARM64 architecture support #275

merged 1 commit into from
Sep 29, 2021

Conversation

keshayad
Copy link
Contributor

Description of changes:

Add support for ARM64 architecture.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link

@edhzsz edhzsz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@keshayad keshayad merged commit d1b016a into aws:master Sep 29, 2021
@richarddd
Copy link
Contributor

This does not work since the jar does not contain prebuilt libraries for both x64 and arm.
Currently:

private static final String[] libsToTry = {
"/aws-lambda-runtime-interface-client.glibc.so",
"/aws-lambda-runtime-interface-client.musl.so",
};
looks for only two libraries to load when https://github.com/aws/aws-lambda-java-libs/blob/master/aws-lambda-java-runtime-interface-client/src/main/jni/build-jni-lib.sh only builds for musl and gclib but not for arm

Futhermore, it would be better to build different flavours of aws-lambda-java-runtime-interface-client to accomodate the diffrent architectures and standard libraries since this code makes assumptions and relies on exception handling to load the correct library:

for (int i = 0; !loaded && i < libsToTry.length; ++i) {
try (InputStream lib = NativeClient.class.getResourceAsStream(libsToTry[i])) {
Files.copy(lib, Paths.get(nativeLibPath), StandardCopyOption.REPLACE_EXISTING);
System.load(nativeLibPath);
loaded = true;
} catch (UnsatisfiedLinkError e) {
exceptions[i] = e;
} catch (Exception e) {
exceptions[i] = e;
}
}
if (!loaded) {
for (int i = 0; i < libsToTry.length; ++i) {
System.err.printf("Failed to load the native runtime interface client library %s. Exception: %s\n", libsToTry[i], exceptions[i].getMessage());
}
System.exit(-1);
}

It would be good to have:

  • aws-lambda-java-runtime-interface-client-musl-x64
  • aws-lambda-java-runtime-interface-client-gclib-x64
  • aws-lambda-java-runtime-interface-client-musl-arm
  • aws-lambda-java-runtime-interface-client-gclib-arm

Rather than one jar containing all libraries

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

Successfully merging this pull request may close these issues.

4 participants