Project Panama & dynamic library loading

Ty Young youngty1997 at gmail.com
Sat Sep 7 03:29:26 UTC 2019


On 9/6/19 9:44 PM, Samuel Audet wrote:
> On 9/7/19 10:47 AM, Ty Young wrote:
>> There is no specific "deployment environment". If you were to create 
>> bindings in Arch Linux you'd need to specify the pathing for every 
>> other Linux distro and even Windows, resulting in not working on more 
>> obscure Linux distros and two different builds between Windows and 
>> Linux. If you could just dynamically add the paths that'd make this 
>> so much easier...
>
> It's not just the paths, the libraries themselves are almost never 
> built exactly the same. That's why people don't try to use RPMs for 
> Fedora on Ubuntu or vice versa. What we need is a similar kind of 
> distribution for Java.


If by "almost never built exactly the same" you mean different versions 
and patches then yeah, that's an issue. The only real solution AFAIK is 
to package specifically for that distro/platform or maybe try to target 
older versions and hope noone changes anything in newer versions.


...but there are libraries that are stable either because they aren't 
open source or because they are lower level, such as NVML. The location 
in such cases is the only issue. Again, for this library specifically it 
can either be located in:


Ubuntu: /usr/lib/<whatever-gnu-folder-from-jextract-examples>


Arch Linux: /usr/lib


Fedora: /usr/lib64


Windows: \%ProgramW6432\%\\"NVIDIA Corporation"\\NVSMI\\


Also, according to NVML documentation C support library loading:


"To dynamically load NVML, call LoadLibrary with this path."


So why won't/can't Java support it?


If the default library search paths were fixed this would be less of an 
issue but because of the fragmented nature of Linux would there ever be 
a complete and accurate default library search paths that works on all 
platforms anyway?


There is a possible solution in my case I think: specify "./libraries" 
or some current directory folder as part of the application as the path 
and then have a launcher find and copy the library to that folder... but 
I don't know how well that'd work if at all. How literal does jextract 
take the specified library path?


>
> Samuel


More information about the panama-dev mailing list