From d340ff916ef669df36fb361b6603a43b45728e9f Mon Sep 17 00:00:00 2001 From: friendseeker <66892505+Friendseeker@users.noreply.github.com> Date: Wed, 23 Oct 2024 00:14:22 -0700 Subject: [PATCH 1/2] Static Link musl for Linux Native Image build --- .github/workflows/ci.yml | 6 ++++++ build.sbt | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 298dc7567..ce146193e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,6 +82,12 @@ jobs: repository: sbt/zinc ref: 1.10.x path: zinc + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '23' + native-image-musl: 'true' + set-java-home: 'false' + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Setup JDK uses: actions/setup-java@v4 with: diff --git a/build.sbt b/build.sbt index 084206406..66253aea5 100644 --- a/build.sbt +++ b/build.sbt @@ -1176,8 +1176,7 @@ lazy val sbtClientProj = (project in file("client")) nativeImageReady := { () => () }, - nativeImageVersion := "23.0", - nativeImageJvm := "graalvm-java23", + nativeImageInstalled := true, nativeImageOutput := { val outputDir = (target.value / "bin").toPath if (!Files.exists(outputDir)) { @@ -1199,7 +1198,7 @@ lazy val sbtClientProj = (project in file("client")) s"-H:Name=${target.value / "bin" / "sbtn"}", ) ++ (if (isLinux && isArmArchitecture) Seq("-H:PageSize=65536") // Make sure binary runs on kernels with page size set to 4k, 16 and 64k - else Nil), + else Nil) ++ (if (isLinux) Seq("--static", "--libc=musl") else Nil), buildThinClient := { val isFish = Def.spaceDelimited("").parsed.headOption.fold(false)(_ == "--fish") val ext = if (isWin) ".bat" else if (isFish) ".fish" else ".sh" From 60b451c3d1743d2c604a8a7ac00a759a73988d9c Mon Sep 17 00:00:00 2001 From: friendseeker <66892505+Friendseeker@users.noreply.github.com> Date: Thu, 24 Oct 2024 00:04:29 -0700 Subject: [PATCH 2/2] Address PR feedback & fix CI --- .github/workflows/ci.yml | 1 + build.sbt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce146193e..35a1c8b19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,7 @@ jobs: ref: 1.10.x path: zinc - uses: graalvm/setup-graalvm@v1 + if: ${{ matrix.jobtype >= 7 && matrix.jobtype <= 9 }} with: java-version: '23' native-image-musl: 'true' diff --git a/build.sbt b/build.sbt index 66253aea5..22e6d7296 100644 --- a/build.sbt +++ b/build.sbt @@ -1198,7 +1198,7 @@ lazy val sbtClientProj = (project in file("client")) s"-H:Name=${target.value / "bin" / "sbtn"}", ) ++ (if (isLinux && isArmArchitecture) Seq("-H:PageSize=65536") // Make sure binary runs on kernels with page size set to 4k, 16 and 64k - else Nil) ++ (if (isLinux) Seq("--static", "--libc=musl") else Nil), + else Nil) ++ (if (isLinux && !isArmArchitecture) Seq("--static", "--libc=musl") else Nil), buildThinClient := { val isFish = Def.spaceDelimited("").parsed.headOption.fold(false)(_ == "--fish") val ext = if (isWin) ".bat" else if (isFish) ".fish" else ".sh"