Add variant lib dir to lib runpaths on FreeBSD - #72
Conversation
The Elf DT_RUNPATH tag added to libraries only contained $ORIGIN, but since libjvm was located in the $ORIGIN/$JVM_VARIANT_MAIN directory, it was not found by the elf loader on FreeBSD. It would instead pick up the libjvm from OpenJDK 11, if present, and fail to load if not. The actual libjvm is loaded on demand, though, and would pick up the right JVM for the java version running. This work is sponsored by The FreeBSD Foundation
|
This seems like a departure from the other operating systems supported. I'm not quite following the reason for the change so I will defer to @battleblow to review this. |
|
I found the bug report for this here.
Example from Linux: In order for the user to be finding libjvm.so from another jvm like jdk11 the path ( On my FreeBSD 14.4/aarch64 test system I see this and is the expected behavior: What problem is the user trying to solve other then lld? |
|
Not sure why this is here but it explains how It came in with this commit that does not explain why this change is needed: With multiple versions of the jdk on FreeBSD, having one in I'm not familiar with FreeBSD ports/packaging enough to advise further. @battleblow? |
|
Thanks! Nice find. I was looking for something like this, but somehow overlooked it... I'm wondering if this was added to fix an issue with the LibreOffice port installing OpenJDK 8 because it depends on libjawt.so or something... I need to investigate a bit further, but I agree, this seems like it needs a fix in the ports not in the upstream code. Dropping this PR. |
The Elf DT_RUNPATH tag added to libraries only contained $ORIGIN, but since libjvm was located in the $ORIGIN/$JVM_VARIANT_MAIN directory, it was not found by the elf loader on FreeBSD.
It would instead pick up the libjvm from OpenJDK 11, if present, and fail to load if not.
The actual libjvm is loaded on demand, though, and would pick up the right JVM for the java version running.
This work is sponsored by The FreeBSD Foundation