4

I am very new to this, so please bear with me if it is too basic. I am trying to run java based AWS lambda functions in GraalVM by using micronaut framework and following their guide from here.

I installed below in my Windows 10 PC.

  • GraalVM & native image
  • Docker desktop
  • Visual C++ 2019 build tools with "x64 Native Tools Command Prompt for VS 2019"
  • micronaut CLI

and trying to build a docker-graalvm-native-image by running below command in "x64 Native Tools Command Prompt for VS 2019",

mvnw package -Dpackaging=docker-native -Dmicronaut.runtime=lambda -Pgraalvm -X

but getting docker-java-stream-1594339478" java.lang.UnsatisfiedLinkError: Error looking up function 'write': The specified procedure could not be found error as shown in screenshot.

error screenshot full stack trace

I understood that some c/c++ library is missing, but I don't know that library's name, how to install it etc.

Please help.

Sundararaj Govindasamy
  • 8,180
  • 5
  • 44
  • 77
  • Seeing more of that stack trace would be helpful. According to [https://stackoverflow.com/questions/62792151/java-call-c-library-using-native-image-from-graalvm/62815377#62815377](this answer) GraalVM doesn't play nice with JNA, so I'm curious how you are getting JNA code from their tutorial. – Daniel Widdis Jun 28 '21 at 05:31
  • @DanielWiddis, I added full stack trace of the error. Fyi I am NOT running any JNA code directly. I just downloaded an JAVA+micronaut project and trying to build graalvm-native-image by running maven commands. Role of JNA in this example is not at all clear to me, hence asked here. If possible, kindly look at the link in question please. – Sundararaj Govindasamy Jun 28 '21 at 05:57
  • I have looked at the link but I have no experience with graalvm and only userspace experience with docker, so it's no help. Does that link specify using dockerjava? The stack trace confirms the problem is in dockerjava, but I couldn't tell you whether it's a compatibility issue in that project or a bug elsewhere. – Daniel Widdis Jun 28 '21 at 07:16
  • Thanks for looking Daniel. I checked the code, there is no explicit usage of dockerjava found. dockerjava may be used by micronaut framework internally. any thought about the error `Error looking up function 'write': The specified procedure could not be found`. – Sundararaj Govindasamy Jun 28 '21 at 09:22
  • The stack trace tells you everything. [Micronaut invokes the ZeroDepApacheHttpClient](https://micronaut-projects.github.io/micronaut-maven-plugin/1.1.0/xref/io/micronaut/build/services/DockerService.html#L48). This in turn eventually depends on JNA in DockerJava's DomainSocket, where it [tries to load the C library](https://github.com/docker-java/docker-java/blob/master/docker-java-transport/src/main/java/com/github/dockerjava/transport/DomainSocket.java#L54). That's "c", so it's looking for `libc` on your system and failing. – Daniel Widdis Jun 29 '21 at 07:05
  • From [this page](https://www.graalvm.org/reference-manual/native-image/Options/) it looks like you have a choice of `libc` options to use. I'd suggest `glibc` for JNA compatibility, but at this point I'm mostly speculating. – Daniel Widdis Jun 29 '21 at 07:07
  • Thanks @DanielWiddis, I am trying this in windows 10, I will install `glibc` and post the update here. – Sundararaj Govindasamy Jun 29 '21 at 07:43
  • @SundararajGovindasamy Did you manage to make it works ? I'm getting the same error trying to build a native image with Micronaut on Windows. – Mike Nov 25 '21 at 16:18
  • @Mike, nope, we hold this due to other priorities. – Sundararaj Govindasamy Nov 27 '21 at 01:46

0 Answers0