Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Add a crossCompile build flag to enable libz linking fix on aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
benty-amzn committed Feb 7, 2024
1 parent feaf39b commit 31ab448
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions installers/linux/universal/tar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,22 @@ task executeBuild(type: Exec) {
dependsOn configureBuild
workingDir "$buildRoot"
commandLine 'make', 'images'
/* When cross-compiling for aarch64, gcc incorrectly links against
* libz.so, provided by the -devel packages, instead of libz.so.1
* This can lead to runtime errors of the form
* javac: error while loading shared libraries: libz.so: cannot open shared object file: No such file or directory
* As a workaround, use patchelf to update all references to libz.so to the expected libz.so.1
*
* See also:
* - https://github.com/AppImage/AppImageKit/issues/964
* - https://github.com/AppImage/AppImageKit/issues/1092
* - https://github.com/electron-userland/electron-builder/issues/7835
* - https://github.com/CollaboraOnline/richdocumentscode/issues/68
* - https://github.com/Sienci-Labs/gsender/issues/420
*/
if (project.hasProperty("corretto.crossCompile")) {
commandLine 'bash', '-c', "find ${imageDir} -type f -exec patchelf --replace-needed libz.so libz.so.1 {} \\; 2>/dev/null"
}
outputs.dir jdkResultingImage
}

Expand Down

0 comments on commit 31ab448

Please sign in to comment.