Java: add Windows ARM64 (win-arm64) target to rocksdbjni#14699
Open
dunwan wants to merge 1 commit into
Open
Conversation
On Windows ARM64 the JVM reports os.arch=arm64 (vs aarch64 on Linux/macOS). This patch: * Environment.isAarch64() also matches 'arm64'. * getJniLibraryFileName() emits 'librocksdbjni-win-arm64.dll' on 64-bit Windows when isAarch64() is true. * java/CMakeLists.txt emits matching OUTPUT_NAME / ROCKSDB_JAR names under CMAKE_SYSTEM_PROCESSOR MATCHES arm64|aarch64. * New EnvironmentTest.winArm64 unit test. All hunks are guarded so non-ARM64 Windows, Linux, macOS, Solaris, AIX, FreeBSD and 32-bit builds emit byte-for-byte identical artifact names. Verified on Windows 11 ARM64 / VS 2026 MSVC arm64 / JDK 17. Signed-off-by: dunwan <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR draft — rocksdbjni (facebook/rocksdb): Windows ARM64 support
Title
Java: add Windows ARM64 (win-arm64) target to rocksdbjniSummary
Adds support for loading and building
rocksdbjnion Windows ARM64.Environment.isAarch64()now also matchesos.arch=arm64(which iswhat Windows ARM64 JVMs report; Linux/macOS ARM JVMs already report
aarch64).Environment.getJniLibraryFileName()returnslibrocksdbjni-win-arm64.dllon 64-bit Windows ARM64, matching theexisting
-win64/-linux64naming scheme.java/CMakeLists.txtemits the matchingOUTPUT_NAMEandROCKSDB_JARnames under
if(CMAKE_SYSTEM_PROCESSOR MATCHES arm64|aarch64|ARM64|AARCH64)on Windows.
EnvironmentTest.winArm64()unit test pins the expected behaviour.Every hunk is strictly additive on every non-ARM64 platform — existing
Windows x64, Linux, macOS, Solaris, AIX, FreeBSD builds produce byte-for-byte
identical artifact names.
The native ARM64 DLL itself is not committed (matches current practice for
-linux64/-win64); building it is gated by thejava/CMakeLists.txtchange. The release-pipeline change to publish
rocksdbjni-<ver>-win-arm64.jarto Maven Central is intentionally deferred to a follow-up PR.
Motivation
Windows on ARM64 is now a first-class target for Java workloads — Azul,
Adoptium, Microsoft and Corretto all ship ARM64 JDKs. Apache Kafka and
other projects that depend on
org.rocksdb:rocksdbjnicurrently fail atstartup on Windows ARM64 because:
Environment.isAarch64()returnsfalseforos.arch=arm64(thestring Windows ARM64 JVMs actually report).
true,getJniLibraryFileName()would fallthrough to
librocksdbjni-win64.dll— which either doesn't exist inthe ARM64 JAR or is an x64 binary that fails to load.
Changes
1.
java/src/main/java/org/rocksdb/util/Environment.java2.
java/src/test/java/org/rocksdb/util/EnvironmentTest.java3.
java/CMakeLists.txtSafety analysis — why non-ARM64 builds are unaffected
isAarch64()— adding|| ARCH.contains("arm64")is a strictdisjunctive widening; it cannot flip any existing
true→false.The only other way it could change behaviour is if another recognised
arch string happened to contain the substring
"arm64". None of thestrings RocksDB checks for do:
amd64,x86_64,x86,i386,ppc,ppc64,ppc64le,s390x,riscv64,aarch64,sparc.getJniLibraryFileName()— the new branch is nested inside theexisting
isWindows() && is64Bit()clause. It is unreachable onLinux, macOS, Solaris, AIX, FreeBSD and 32-bit Windows. On 64-bit
Windows it only fires for ARM64 JVMs — which previously produced the
wrong
librocksdbjni-win64.dllname and failed to load, so noproduction behaviour is being changed.
java/CMakeLists.txt— guarded byCMAKE_SYSTEM_PROCESSOR MATCHES arm64|aarch64|ARM64|AARCH64. Onx64 Windows
CMAKE_SYSTEM_PROCESSORisAMD64, so theelsebranchis taken and the original
OUTPUT_NAME librocksdbjni-win${bitness}/ROCKSDB_JAR rocksdbjni-<ver>-win${bitness}.jartargets are emittedunchanged. The Linux/macOS/Unix branches
(
elseif(... Linux), etc.) are not touched.Build evidence (reproducible)
Host: Surface Laptop 7 (Snapdragon X1E80100), Windows 11 ARM64,
VS 2026 MSVC
14.50.35717ARM64 cross toolchain, JDK 17 Adoptium.Artifacts produced:
librocksdbjni-win-arm64.dllAA64(ARM64)Java_org_rocksdb_*JNI exportsrocksdbjni-<ver>-win-arm64.jarHISTORY-JAVA.mddumpbin /DEPENDENTSon the DLL reports only stock Windows dependencies:SHLWAPI.dll,RPCRT4.dll,KERNEL32.dll,MSVCP140.dll,VCRUNTIME140.dll,api-ms-win-crt-*.dll.Note about
-DWITH_TESTS=OFFjava/CMakeLists.txtunconditionally downloads junit / hamcrest / mockito /cglib / assertj-core from
rocksdb-deps.s3-us-west-2.amazonaws.comatconfigure time, even with
-DWITH_TESTS=OFF. Theassertj-core-2.9.0.jarS3 URL hangs intermittently during download;pre-seeding
java/test-libs/assertj-core-2.9.0.jarfrom Maven Centralworks around this. Happy to fold a separate, small fix for this into
this PR or a follow-up if the reviewers prefer.
Test results
EnvironmentTest(all cases including newwinArm64) — pass.1,000 keys, flush, compact, get back — pass.
Checklist
https://code.facebook.com/cla) — sign beforeopening the PR.
facebook/rocksdb:main.safety analysis).
EnvironmentTest.winArm64added.rocksdbjni-<ver>-win-arm64.jarto Maven Central.Draft authored 2026-04-24. See
windows-arm64-progress.mdin the KafkaARM64 validation tree for the full session notes and build logs.