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

Native libraries failing on Windows with UnsatisfiedLinkError [2 XMR] #82

Closed
woodser opened this issue Mar 26, 2024 · 5 comments
Closed
Labels
💰bounty There is a bounty on this issue

Comments

@woodser
Copy link
Owner

woodser commented Mar 26, 2024

Currently, native libraries are built for Windows, producing these files:

  • libmonero-cpp.dll
  • libmonero-cpp.dll.a
  • libmonero-java.dll
  • libmonero-java.dll.a

However, using the native libraries results in an error when using JNI functions: "UnsatisfiedLinkError".

To reproduce the failure in a test:

  1. On Windows, download Visual Studio Code and install Java extensions.
  2. Import the monero-java project into workspace.
  3. Build or download the Windows native libraries to the ./build folder.
  4. Open TestMoneroUtils.java and click the button to run testGetIntegratedAddresses().
  5. The test should succeed, but instead fails with UnsatisfiedLinkError:

image

@woodser woodser added the 💰bounty There is a bounty on this issue label Mar 26, 2024
@woodser woodser changed the title Native libraries failing on windows with UnsatisfiedLinkError. Native libraries failing on windows with UnsatisfiedLinkError [1.5 XMR] Mar 26, 2024
Copy link

There is a bounty on this issue. The amount is in the title. The reward will be awarded to the first person or group of people who resolve this issue.

If you are starting to work on this bounty, please write a comment so that we can assign the issue to you. We expect contributors to provide a PR in a reasonable timeframe or, in case of an extensive work, updates on their progress. We will unassign the issue if we feel the assignee is not responsive or has abandoned the task.

Read the full conditions and details of the bounty system.

@woodser woodser changed the title Native libraries failing on windows with UnsatisfiedLinkError [1.5 XMR] Native libraries failing on Windows with UnsatisfiedLinkError [1.5 XMR] Mar 26, 2024
@woodser woodser changed the title Native libraries failing on Windows with UnsatisfiedLinkError [1.5 XMR] Native libraries failing on Windows with UnsatisfiedLinkError [2 XMR] Mar 26, 2024
@everoddandeven
Copy link
Contributor

everoddandeven commented Mar 30, 2024

I'm trying to debug, it seems that libmonero-java.dll failed to load other dlls:

image

@everoddandeven
Copy link
Contributor

everoddandeven commented Mar 30, 2024

I just put C:\msys64\mingw64\bin the Path environment variable and now it works:

image

I don't know if it is a good solution, maybe compiling the library with -static param can solve this issue

@woodser
Copy link
Owner Author

woodser commented Mar 30, 2024

Hm, I tried adding C:\msys64\mingw64\bin to the Path environment variable, but I'm still getting the UnsatisfiedLinkError running the test in VS Code.

Dependency walker looks much better after adding to Path, though:

image

@woodser
Copy link
Owner Author

woodser commented Apr 2, 2024

This issue is resolved with 45360d1, and the bounty is paid. Thanks @everoddandeven!

@woodser woodser closed this as completed Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💰bounty There is a bounty on this issue
Projects
None yet
Development

No branches or pull requests

2 participants