@@ -28,21 +28,40 @@ public static native boolean verifyCellKZGProof(
28
28
private static final String LIBRARY_NAME = "java_peerdas_kzg" ;
29
29
private static final String PLATFORM_NATIVE_LIBRARY_NAME = System .mapLibraryName (LIBRARY_NAME );
30
30
31
+ private static String getNormalizedArchitecture () {
32
+ String osArch = System .getProperty ("os.arch" ).toLowerCase ();
33
+ if (osArch .equals ("x86_64" ) || osArch .equals ("amd64" )) {
34
+ return "x86_64" ;
35
+ } else if (osArch .equals ("aarch64" ) || osArch .equals ("arm64" )) {
36
+ return "aarch64" ;
37
+ } else {
38
+ return osArch ;
39
+ }
40
+ }
41
+
31
42
/** Loads the appropriate native library based on your platform. */
32
43
// Copied from c-kzg
33
44
public static void loadNativeLibrary () {
34
45
35
46
String osName = System .getProperty ("os.name" ).toLowerCase ();
36
- String osArch = System . getProperty ( "os.arch" ). toLowerCase ();
47
+ String osArch = getNormalizedArchitecture ();
37
48
String libraryResourcePath = null ;
38
49
39
50
if (osName .contains ("win" )) {
40
- if (osArch .contains ("amd64" ) || osArch . contains ( " x86_64" )) {
41
- libraryResourcePath = "/x86_64-windows/" + PLATFORM_NATIVE_LIBRARY_NAME ;
51
+ if (osArch .contains ("x86_64" )) {
52
+ libraryResourcePath = "/x86_64-windows-pc-gnu /" + PLATFORM_NATIVE_LIBRARY_NAME ;
42
53
} else if (osArch .contains ("x86" )) {
43
- libraryResourcePath = "/x86-windows/" + PLATFORM_NATIVE_LIBRARY_NAME ;
44
- } else if (osArch .contains ("arm64" )) {
45
- libraryResourcePath = "/arm64-windows/" + PLATFORM_NATIVE_LIBRARY_NAME ;
54
+ // TODO: Remove this and just don't support 32-bit Windows
55
+ libraryResourcePath = "/i686-pc-windows-gnu/" + PLATFORM_NATIVE_LIBRARY_NAME ;
56
+ } else if (osArch .contains ("aarch64" )) {
57
+ // Current version of c-kzg does not support arm windows either
58
+ // TODO: Rust has support for msvc with arm64, but it also has:
59
+ // aarch64-pc-windows-gnullvm -- we probably want to stick to one
60
+ // toolchain for now.
61
+ // If we do switch to msvc, nethermind had an issue with windows server 2022
62
+ // that we should check works with an msvc build.
63
+ // libraryResourcePath = "/aarch64-pc-windows-gnullvm/" + PLATFORM_NATIVE_LIBRARY_NAME;
64
+
46
65
}
47
66
} else if (osName .contains ("mac" )) {
48
67
if (osArch .contains ("x86_64" )) {
0 commit comments