Skip to content

Commit 56ef3dc

Browse files
committed
fix platform detection logic on MacOS
This was tested on an M1 MacBook; it reports the machine type as ``arm64``, not ``aarch64``. The full ``uname -a`` output is: Darwin <NAME-REDACTED>-MBP14.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64 This diverges from what ``System.getProperty("os.arch")`` reports as the architecture. Signed-off-by: Philipp Gesang <philipp.gesang@vernaio.com>
1 parent c1db53b commit 56ef3dc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

BuildNative

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export DYNCALL_HOME=$BASE_DIR/dyncall
88

99
DYNCALL_DIFF=$BASE_DIR/src/main/cpp/bridj/dyncall.diff
1010

11+
function failed() {
12+
echo "$@"
13+
exit 1
14+
}
15+
1116
if [[ ! -d "$DYNCALL_HOME" ]]
1217
then
1318
$BASE_DIR/admin/checkout_and_patch_dyncall.sh $DYNCALL_DIFF || failed "Failed to checkout and patch dyncall"
@@ -40,7 +45,7 @@ function get_arch() {
4045
x86_64|amd64)
4146
echo x64
4247
;;
43-
aarch64)
48+
aarch64|arm64)
4449
echo arm64
4550
;;
4651
arm*)

src/main/java/org/bridj/Platform.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,9 @@ public static String getMachine() {
525525
return "i386"; // we are running a 32 bits JVM on a 64 bits platform
526526
}
527527
}
528+
if (isMacOSX() && arch.equals("aarch64")) {
529+
return "arm64";
530+
}
528531
return arch;
529532
}
530533

0 commit comments

Comments
 (0)