Skip to main content

Could not find agent library native-image-agent on the library path

Problem Description

When executing GraalVM's tracing agent:

/usr/local/graalvm/graalvm-ee-java17-22.2.0/bin/java -agentlib:native-image-agent=config-output-dir=META-INF/native-image -jar ./app.jar

Exception thrown:

Could not find agent library native-image-agent on the library path, with error: libnative-image-agent.so: cannot open shared object file: No such file or directory

Solution

Install Native Image under your installed GraalVM JDK:

./gu install native-image

Go back to the GraalVM lib directory, e.g., /usr/local/graalvm/graalvm-ce-java17-22.2.0/lib You can see the file libnative-image-agent.so is now present.