-
Notifications
You must be signed in to change notification settings - Fork 39
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
For GraalVM libaws-crt-jni is not extracted to the same folder in which the native image is built #834
Comments
As a workaround I copied the |
Can you provide more detail of the build steps? Does the GraalVMNativeFeature load correct? Any failure during the native image build? |
Hey @TingDaoK - our setup looks like this (this demo does not use AWS CRT but you could simply add it to the Spring Boot application: https://github.com/klopfdreh/native-cloud-config-test/blob/main/client/Dockerfile There are no issues during the build and the native image is created without any hints that something went wrong. We only received an exception during the runtime like mentioned in the ticket. After that I thought that the lib has to be in the same folder as the native image but it wasn‘t. When we provided the lib and copied it beside the native image everything was working without any issues. My assumption: There might be an issue while copying the file based on the architecture or during the detection of the architecture. |
Can you share |
Sure - I have to trigger a build at work, tomorrow. |
Here is the log of the native-image build
At |
Looks like the |
I am not sure why. Maybe the native-image.properties is not configured correctly? Looks like the feature got picked up is pretty similar, here. But I think we can start with trying to add In the mean time, I'll try to see if I can reproduce it. From the docker file, looks like you build the jar first, then use native-image to build the binary, right? |
Yes we build the jar with spring-boot-maven-plugin and compile native image like explained here: https://docs.spring.io/spring-boot/reference/packaging/native-image/advanced-topics.html#packaging.native-image.advanced.converting-executable-jars.native-image |
I am going to try out this argument during a build on monday. 👍 |
I don’t know if this is important but all documentation are listing the arguments with spaces: Args = … |
I tried to add CRT to the sample you linked above. But I cannot reproduce the issue. Looks like it successfully load the feature and extracted the shared library.
|
Ah maybe it is because I use Spring Cloud AWS and it is not initializing AWS CRT the right way. I am going to add „new CRT()“ to a code which is initialized during build time. I am going to report back if this is working for me. |
I don't think |
I may found the issue. The If so it uses When you just use <dependency>
<groupId>io.awspring.cloud</groupId>
<artifactId>spring-cloud-aws-dependencies</artifactId>
<version>${spring-cloud-aws-dependencies.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency> and <dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
</dependency> the following dependency is not automatically included and because of this the feature is not used. <dependency>
<groupId>software.amazon.awssdk.crt</groupId>
<artifactId>aws-crt</artifactId>
</dependency> For normal java environments this is not causing any issues, because you can just use Maybe it would be good to add a hint to the readme that if you use So: |
software.amazon.awssdk.s3 takes aws-crt as optional dependency. https://github.com/aws/aws-sdk-java-v2/blob/master/services/s3/pom.xml#L113-L119 So, from my understanding, if you need to use aws-crt related functionality and only takes dependencies on So, IMHO, it's kind expected to have |
That’s what I meant with „java: s3 + crtBuilder()“ and it was working for me without the aws-crt |
Anyway the original issue was solved by explicitly adding aws-crt 👍 |
Perhaps you have aws-crt installed to your local maven environment? In theory, it should not work for JVM as well. |
Thanks so much for all the time and the clarification! |
Describe the bug
As of the manual https://github.com/awslabs/aws-crt-java?tab=readme-ov-file#graalvm-support libaws-crt-jni.so should be extracted to the same folder the native image is generated to, but it isn't.
The
native-image
command is executed in/native-image-build/
set viaWORKDIR /native-image-build/
in the dockerfile.The native image is then moved from
native-image-build
tonative-image
Docker build output
Datei oder Verzeichnis nicht gefunden
=File or Directory not found
Expected Behavior
The libaws-crt-jni.so, in case of linux should be present in the same folder of the native image.
Current Behavior
No other files than the native image is present in the native image build folder.
Reproduction Steps
N/A
Possible Solution
N/A
Additional Information/Context
I tried to copy the JNDI lib because of the initial error
aws-crt-java version used
0.31.1
Java version used
Java 17
Operating System and version
ubi 9
The text was updated successfully, but these errors were encountered: