Fix page size for Linux AArch64 native executables (#875)

Graal Native Image is assuming 4k page size here, which is a naughty assumption to make in the modern Linux-on-ARM landscape.
Two very common hardware configurations require 16k minumum page size: the Raspberry Pi 5 and Asahi Linux (running on Apple Silicon hardware).

This change forces 64k pages for Linux/AArch64 native executables to guarantee compatibility with these platforms.
DEVELOPMENT.adoc is also updated to cover the additional dependencies required for building native executables on Linux.
This commit is contained in:
Josh B
2025-01-07 07:55:27 -08:00
committed by GitHub
parent f6c74e90a8
commit 267de3c789
2 changed files with 14 additions and 4 deletions
+7 -2
View File
@@ -2,7 +2,8 @@
:uri-gng: https://gng.dsun.org :uri-gng: https://gng.dsun.org
:uri-jenv: https://www.jenv.be :uri-jenv: https://www.jenv.be
:uri-intellij: https://www.jetbrains.com/idea/download/ :uri-intellij: https://www.jetbrains.com/idea/download/
:uri-native-prerequisites: https://www.graalvm.org/latest/getting-started/windows/#prerequisites-for-native-image-on-windows :uri-native-prerequisites-linux: https://www.graalvm.org/latest/getting-started/linux/#prerequisites-for-native-image-on-linux
:uri-native-prerequisites-windows: https://www.graalvm.org/latest/getting-started/windows/#prerequisites-for-native-image-on-windows
== Setup == Setup
@@ -29,11 +30,15 @@ jenv enable-plugin export
This will allow spotless to pick the correct starting branch when formatting source code files. This will allow spotless to pick the correct starting branch when formatting source code files.
Otherwise, you might see that _every_ file has its copyright year updated. Otherwise, you might see that _every_ file has its copyright year updated.
=== Additional Linux Setup
. (optional) To build the native executable (`./gradlew buildNative`),
install {uri-native-prerequisites-linux}[Prerequisites For Native Image on Linux].
=== Additional Windows Setup === Additional Windows Setup
. (optional) Go to `System->For developers` and enable `Developer Mode`. . (optional) Go to `System->For developers` and enable `Developer Mode`.
Otherwise, some tests may fail due to insufficient file system privileges. Otherwise, some tests may fail due to insufficient file system privileges.
. (optional) To build the native executable (`./gradlew buildNative`), . (optional) To build the native executable (`./gradlew buildNative`),
install {uri-native-prerequisites}[Prerequisites For Native Image on Windows]. install {uri-native-prerequisites-windows}[Prerequisites For Native Image on Windows].
== Common Build Commands == Common Build Commands
+7 -2
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved. * Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -276,7 +276,12 @@ val linuxExecutableAarch64: TaskProvider<Exec> by
dependsOn(":installGraalVmAarch64") dependsOn(":installGraalVmAarch64")
configureExecutable( configureExecutable(
buildInfo.graalVmAarch64, buildInfo.graalVmAarch64,
layout.buildDirectory.file("executable/pkl-linux-aarch64") layout.buildDirectory.file("executable/pkl-linux-aarch64"),
listOf(
// Ensure compatibility for kernels with page size set to 4k, 16k and 64k
// (e.g. Raspberry Pi 5, Asahi Linux)
"-H:PageSize=65536"
)
) )
} }