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

Unsatisfied link when used in conjunction with jnr-posix #300

Open
Melab opened this issue Mar 14, 2022 · 5 comments
Open

Unsatisfied link when used in conjunction with jnr-posix #300

Melab opened this issue Mar 14, 2022 · 5 comments

Comments

@Melab
Copy link

Melab commented Mar 14, 2022

I have been attempting to use jnr-posix's native function calls inside GraalVM JavaScripy, but I have gotten error message that complain about an unsatisified link.

I cloned the following repositories at their linked-to commits:

In the top-level of each repository, I ran mvn -B package --file pom.xml. This produced several JAR files, the following of which I copied to ${JNR_JARS_DIR}:

  • jffi-1.3.10-SNAPSHOT.jar.
  • jffi-1.3.10-SNAPSHOT-native.jar.
  • jnr-constants-0.10.4.jar.
  • jnr-enxio-0.32.14-SNAPSHOT.jar.
  • jnr-ffi-2.2.12-SNAPSHOT.jar.
  • jnr-posix-3.1.16-SNAPSHOT.jar.

graaljs+jnr.sh is the shell scrupt that I used to test two JavaScript files, one of which uses DefaultPOSIXHandler and one which does not. The commands were as follows

graaljs+jnr.sh "Without DefaultPOSIXHandler.js" &> "Without DefaultPOSIXHandler.log"
graaljs+jnr.sh "With DefaultPOSIXHandler.js" &> "With DefaultPOSIXHandler.log"

The script includes the previously mentioned JAR files in the classpath of the executed java command.

Both attempts to retrieve the native POSIX interface fail with java.lang.UnsatisfiedLinkError.

The relevant files:

@headius
Copy link
Member

headius commented Mar 14, 2022

At a glance it appears you did things correctly. Can you provide more information about your system? Specifically I want to know what OS and CPU you are running on, in case the issue is platform-specific.

@headius
Copy link
Member

headius commented Mar 14, 2022

Looking over the code around the error, it is hard to tell why the library was unable to load. Some extra information from you would be helpful:

  • What version of GraalJS are you running?
  • Is it possible for you to enable some native logging in GraalJS? As a JVM flag that would be -verbose:jni but I do not know how GraalJS is set up in your environment.

I believe the problem is perhaps something in your environment, but more likely it is due to GraalJS itself having trouble or preventing our native library from loading. The same basic code you provided loads and works ok from a normal Java application.

@Melab
Copy link
Author

Melab commented Mar 14, 2022

At a glance it appears you did things correctly. Can you provide more information about your system? Specifically I want to know what OS and CPU you are running on, in case the issue is platform-specific.

CPU is AMD G-T56N.
Operating system is Ubuntu 20.04.
Kernel is Ubuntu Linux 5.11.0-27-generic.

@Melab
Copy link
Author

Melab commented Mar 14, 2022

Looking over the code around the error, it is hard to tell why the library was unable to load. Some extra information from you would be helpful:

* What version of GraalJS are you running?

* Is it possible for you to enable some native logging in GraalJS? As a JVM flag that would be `-verbose:jni` but I do not know how GraalJS is set up in your environment.

I believe the problem is perhaps something in your environment, but more likely it is due to GraalJS itself having trouble or preventing our native library from loading. The same basic code you provided loads and works ok from a normal Java application.

It's the GraalVM JavaScript that comes with GraalVM Community Edition 21.3.0 for Java 11. I'm running it in JVM mode.

Relevant files:

Scripts are still the same.

@Melab
Copy link
Author

Melab commented Mar 28, 2022

Is there any news yet?

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

2 participants