Skip to content

Incorrect Platform.RESOURCE_PREFIX leads to UnsatisfiedLinkError in one of my gradle projects #2742

@cbtum

Description

@cbtum

Thank you very much for making ortools-java available as maven project, it is much easier to use now! While experimenting with it, I ran into the following problem:

What version of OR-Tools and what language are you using?
'com.google.ortools:ortools-java:9.0.9048'

What operating system (Linux, Windows, ...) and version?
MacOS, Java Gradle Project

What did you do?
I am experimenting with ortools-java in two different gradle projects.

What did you expect to see
Since both projects have the same dependency as specified above, both projects should behave the same way.

What did you see instead?
While ortools-java works fine in one project, I get an UnsatisfiedLinkError in the other.

Anything else we should know about your project / environment

  • Debugging into the Loader.loadNativeLibraries(), I noticed that the Platform.RESOURCE_PREFIX differs between both projects.
  • In the implementation that is working fine, the class loader uses darwin-x86-64/ as resource to be loaded.
  • In contrast, the project with the UnsatisfiedLinkError uses darwin/ as resource. While a resource is found for darwin/, it seems to clash with some other library.
  • When I copy your class loader and replace Platform.RESOURCE_PREFIX with darwin-x86-64/, both projects are working without any problem.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions