Handle x86_64 os.arch for native libraries#107289
Conversation
On some systems Java appears to return amd64 (even if not an amd processor), but on others it returns x86_64. This commit handles the latter case to correctly associate the arch with the appropriate platform dir.
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
jpountz
left a comment
There was a problem hiding this comment.
This looks good to me. I wonder if we're missing other ones now, not sure how to check this.
I don't think that is true. The vec code relies on NativeAccess to load the vec library. While vec uses multi release jars, it should not need to determine anything about the architecture, the return value from NativeAccess determines whether vec can be supported. As far as actually loading the library within NativeAccess, once x64 is supported, the conditionals on loading based on arch can be removed since both aarch64 and x64 will be supported. |
That's correct; we will need something similar, but in the gradle script(s) that put the generated libraries in the correct places/upload the artifacts, not in the actual Java code. |
| String archname = sysprops.get("os.arch"); | ||
| String arch; | ||
| if (archname.equals("amd64")) { | ||
| if (archname.equals("amd64") || archname.equals("x86_64")) { |
There was a problem hiding this comment.
I think that this should be fine, and cover the archs we run on. No need for archs such as, say, "i386", "x86", "ppc64", "ppc64le", "aarch64", "riscv64". For reference, some JDK archs here https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/jdk/internal/util/Architecture.java
On some systems Java appears to return amd64 (even if not an amd processor), but on others it returns x86_64. This commit handles the latter case to correctly associate the arch with the appropriate platform dir.
On some systems Java appears to return amd64 (even if not an amd processor), but on others it returns x86_64. This commit handles the latter case to correctly associate the arch with the appropriate platform dir.