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

"Could not find agent library native-image-agent on the library path" #1057

Closed
simonDeHero opened this issue Mar 11, 2019 · 13 comments
Closed

Comments

@simonDeHero
Copy link

Hi,
i would like to use the native-image-agent like described here. but i get the following error

$ /opt/graalvm-ce-1.0.0-rc13/bin/./java -jar -agentlib:native-image-agent=output=./trace-file.json app.jar
Error occurred during initialization of VM
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

i get basically the same error, when i use the JAVA_TOOL_OPTIONS:

$ export JAVA_TOOL_OPTIONS="-agentlib:native-image-agent=output=/tmp/trace-file.json"
$ /opt/graalvm-ce-1.0.0-rc13/bin/./java -jar app.jar
Picked up JAVA_TOOL_OPTIONS: -agentlib:native-image-agent=output=/tmp/trace-file.json
Error occurred during initialization of VM
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

i use graalvm rc13.

thx for having a look!

@PatrykGala
Copy link

PatrykGala commented Mar 11, 2019

Library doesn't exist in dir:
/path/to/graalvm/jre/lib/amd64/libnative-image-agent.so

@cstancu
Copy link
Member

cstancu commented Mar 11, 2019

This feature was merged after the RC13 release. You can build GraalVM from source or wait for the RC14 release to use this feature.

@simonDeHero
Copy link
Author

@cstancu thx, i'll wait for rc14 :-)

@jesty
Copy link

jesty commented Mar 18, 2019

Hi, I'm getting the same error with rc14 on Mac OS.

$ java -version
openjdk version "1.8.0_202"
OpenJDK Runtime Environment (build 1.8.0_202-20190206132754.buildslave.jdk8u-src-tar--b08)
OpenJDK GraalVM CE 1.0.0-rc14 (build 25.202-b08-jvmci-0.56, mixed mode)

The error is:
Error occurred during initialization of VM
Could not find agent library native-image-agent on the library path, with error: dlopen(libnative-image-agent.dylib, 1): image not found

The file libnative-image-agent.dylib is in graalvm-ce-1.0.0-rc14/Contents/Home/jre/lib/amd64.
What I'm doing wrong?

@cstancu
Copy link
Member

cstancu commented Mar 18, 2019

@jesty
Copy link

jesty commented Mar 22, 2019

You are right, I was tricked by some other link I read.
Do you know if I can do that using a Docker image? Tonight I'm trying to do something like that:

FROM ubuntu
RUN apt-get update && \
    apt-get -y install gcc libc6-dev zlib1g-dev curl bash && \
    rm -rf /var/lib/apt/lists/*
ENV GRAAL_VERSION 1.0.0-rc14
ENV GRAAL_FILENAME graalvm-ce-${GRAAL_VERSION}-linux-amd64.tar.gz
ENV JAVA_TOOL_OPTIONS -agentlib:native-image-agent=trace-output=trace.json
RUN curl -4 -L https://github.com/oracle/graal/releases/download/vm-${GRAAL_VERSION}/${GRAAL_FILENAME} -o /tmp/${GRAAL_FILENAME}
RUN tar -zxvf /tmp/${GRAAL_FILENAME} -C /tmp \
    && mv /tmp/graalvm-ce-${GRAAL_VERSION} /usr/lib/graalvm
RUN rm -rf /tmp/*
COPY target/my-app-1.0-SNAPSHOT.jar app.jar
CMD ["/usr/lib/graalvm/bin/java", "-jar", "app.jar"]

But I got this exception:
Picked up JAVA_TOOL_OPTIONS: -agentlib:native-image-agent=trace-output=trace.json
/b/b/e/main/substratevm/src/com.oracle.svm.native.agent/src/trace-agent.c:74: Agent_OnLoad: check failed, aborting: strstr(options, output_opt) == options

Obviously, if I comment on the JAVA_TOOL_OPTIONS env var, the application starts.
Otherwise, in the weekend it will be the right time to install Linux :)

@cstancu
Copy link
Member

cstancu commented Mar 22, 2019

@jesty I think that's a failure of the agent itself, not of your setup. See also #1100.

@jesty
Copy link

jesty commented Mar 22, 2019

Sorry, but in #1100 you told that I must use rc14 and in my docker file I'm using rc14. Are you ok with this? Tonight I will try with a more simple jar.
Just to know, I'm trying a simple main that do a set and get on Redis using Lettuce.

@cstancu
Copy link
Member

cstancu commented Mar 22, 2019

No, what I said was to build from latest master since we have fixed some bugs after the RC14 release. But you may not need to. Does #1100 (comment) solve your problem?

@jesty
Copy link

jesty commented Mar 23, 2019

Ok, now it's clear for me. Thank you for your time. As soon as possible I will try it.

@adam-krieg
Copy link

adam-krieg commented Jul 9, 2019

I'm trying to run this on graalvm-ce-19.1.0 as bundled with the graalvm-ce-linux-amd64-19.1.0.tar.gz and running into this same error.

graalvm-ce-19.1.0]$ find . -name *.so ./lib/visualvm/visualvm/lib/deployed/jdk15/linux-amd64/libprofilerinterface.so ./lib/visualvm/visualvm/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so ./lib/amd64/jli/libjli.so ./lib/amd64/libjawt.so ./jre/lib/polyglot/libpolyglot.so ./jre/lib/amd64/liblcms.so ./jre/lib/amd64/libjsdt.so ./jre/lib/amd64/libsplashscreen.so ./jre/lib/amd64/libawt_xawt.so ./jre/lib/amd64/libnet.so ./jre/lib/amd64/libj2pcsc.so ./jre/lib/amd64/libsunec.so ./jre/lib/amd64/libjaas_unix.so ./jre/lib/amd64/libjpeg.so ./jre/lib/amd64/libinstrument.so ./jre/lib/amd64/libhprof.so ./jre/lib/amd64/libjsoundalsa.so ./jre/lib/amd64/libtrufflenfi.so ./jre/lib/amd64/libj2pkcs11.so ./jre/lib/amd64/libjava.so ./jre/lib/amd64/libnpt.so ./jre/lib/amd64/libjsound.so ./jre/lib/amd64/jli/libjli.so ./jre/lib/amd64/libzip.so ./jre/lib/amd64/libsaproc.so ./jre/lib/amd64/libawt.so ./jre/lib/amd64/libj2gss.so ./jre/lib/amd64/libjava_crw_demo.so ./jre/lib/amd64/libjvmcicompiler.so ./jre/lib/amd64/libmanagement.so ./jre/lib/amd64/libattach.so ./jre/lib/amd64/libdt_socket.so ./jre/lib/amd64/libverify.so ./jre/lib/amd64/libfontmanager.so ./jre/lib/amd64/libjawt.so ./jre/lib/amd64/libnio.so ./jre/lib/amd64/libawt_headless.so ./jre/lib/amd64/libmlib_image.so ./jre/lib/amd64/libunpack.so ./jre/lib/amd64/libjdwp.so ./jre/lib/amd64/libsctp.so ./jre/lib/amd64/server/libjvm.so ./jre/lib/amd64/server/libjsig.so ./jre/lib/amd64/libjsig.so ./jre/languages/llvm/native/lib/libsulong.so ./jre/languages/llvm/native/lib/libpolyglot-mock.so

@adam-krieg
Copy link

I now see the native-image stuff has been pulled out into a plugin and I need to install the native-image-installable-svm-linux-amd64-19.1.0.jar to make it go.

@hakdogan
Copy link

Hi,

I'm getting the same error with 20.2.0 on Ubuntu 18.04.1

java -version
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment (build 11.0.9+11-Ubuntu-0ubuntu1.18.04.1)
OpenJDK 64-Bit Server VM (build 11.0.9+11-Ubuntu-0ubuntu1.18.04.1, mixed mode, sharing)

When I execute java -agentlib:native-image-agent=config-output-dir=/home/hakdogan/config -jar sample-1.0.0-SNAPSHOT-runner.jar command I get the following error

Error occurred during initialization of VM
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

bin directory of Graal defined at .bashrc. An interesting point for me, if I give the full path of the java file the agent initialize and the command completed successfully

$GRAAL_HOME/bin/java -agentlib:native-image-agent=config-output-dir=/home/hakdogan/config -jar sample-1.0.0-SNAPSHOT-runner.jar

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

No branches or pull requests

6 participants