Skip to content

Add arm 64 linux runner #13258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open

Add arm 64 linux runner #13258

wants to merge 38 commits into from

Conversation

Siedlerchr
Copy link
Member

@Siedlerchr Siedlerchr commented Jun 4, 2025

Fixes #10842

https://github.com/actions/partner-runner-images/blob/main/images/arm-ubuntu-22-image.md

In about one to three sentences, describe the changes you have made: what, where, why, ...

Steps to test

Describe how reviewers can test this fix/feature. Ideally, think of how you would guide a beginner user of Jabef to try out your change.
You can add screenshots or videos (using Loom or by just adding .mp4 files).

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [/] Tests created for changes (if applicable)
  • [/] Manually tested changed features in running JabRef (always required)
  • [/] Screenshots added in PR description (if change is visible to the user)
  • [/] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [/] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@Siedlerchr
Copy link
Member Author

Siedlerchr commented Jun 4, 2025

Still some issues with the module exporting:

The correct architecture should be picked because the architecture check print gives the right infomration

Using aarch66

The input changes require a full rebuild for incremental task ':jabgui:compileJava'.
Compilation mode: default, forking compiler
Full recompilation is required because no incremental change information is available. This is usually caused by clean builds or changing compiler arguments.
Compiling with toolchain '/home/runner/.gradle/jdks/azul_systems__inc_-24-aarch64-linux.2'.
Compiling with JDK Java compiler API.

/home/runner/work/jabref/jabref/jabgui/src/main/java/org/jabref/gui/actions/ActionFactory.java:20: error: package com.sun.javafx.scene.control is not visible
import com.sun.javafx.scene.control.ContextMenuContent;
                           ^
  (package com.sun.javafx.scene.control is declared in module javafx.controls, which does not export it to module org.jabref)
/home/runner/work/jabref/jabref/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/EditorContextAction.java:19: error: package com.sun.javafx.scene.control is not visible
import com.sun.javafx.scene.control.Properties;
> Task :jabgui:compileJava FAILED
                           ^
gradle/actions: Writing build results to /home/runner/work/_temp/.gradle-actions/build-results/__run_3-1749064857597.json
  (package com.sun.javafx.scene.control is declared in module javafx.controls, which does not export it to module org.jabref)
2 errors


* What went wrong:
Execution failed for task ':jabgui:compileJava'.
> Compilation failed; see the compiler output below.
  /home/runner/work/jabref/jabref/jabgui/src/main/java/org/jabref/gui/actions/ActionFactory.java:20: error: package com.sun.javafx.scene.control is not visible
  import com.sun.javafx.scene.control.ContextMenuContent;
                             ^
    (package com.sun.javafx.scene.control is declared in module javafx.controls, which does not export it to module org.jabref)
  2 errors

@Siedlerchr
Copy link
Member Author

@jjohannes Sorry to bother you again, but do you have any idea why the arm build is failing. Am I missing something? I just added a new target for arm in the conventions gradle. Locally on my computer I see that the task is registered.

grafik

@jjohannes
Copy link
Contributor

@Siedlerchr your change is correct. It should not lead to compile failing. If I test this locally – by manually switching to the new target – the compilation works with the linux-aarch64 Jar.

The error indicates that it uses the original Jar and not the transformed one (of javafx.controls). But it should use the transformed one ans it does in my local test.

One idea: There are sometimes timing problems with the transformation mechanisms if other plugins access things too eagerly. Maybe something like this is happening. Maybe it does not work 100% well together with org.beryx.jlink. But we would have to analyze this more closely. (When I find the time soonish, I will have a look).
For reference: gradlex-org/extra-java-module-info#106 (and other issues linked from there).

For now, maybe it helps just rerunning the build. The only thing that is different in the target is that it is completely new and the Jars have never been downloaded/cached before. Although I don't understand why the other things work well in the GH context where things may always be rebuilt...

A temporary remedy could also be to first run a ./gradlew assemble before running the :jabgui:prepareModulesDir in a second step afterwards (in which mosts tasks will be UP-TO-DATE).

os.isWindows -> "windows-2022"
else -> error("Unsupported OS")
}

// Source: https://github.com/jjohannes/java-module-system/blob/main/gradle/plugins/src/main/kotlin/targets.gradle.kts
// Configure variants for OS
// Configure variants for OS. target name can be any just must
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added sentence seems to be incomplete?

@koppor koppor added dev: binaries Binary builds should be uploaded to builds.jabref.org dev: build-system dev: ci-cd labels Jun 5, 2025
@koppor
Copy link
Member

koppor commented Jun 7, 2025

   (package com.sun.javafx.scene.control is declared in module javafx.controls, which does not export it to module org.jabref)
/home/runner/work/jabref/jabref/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/EditorContextAction.java:19: error: package com.sun.javafx.scene.control is not visible
import com.sun.javafx.scene.control.Properties;

But we patch it in build-logic\bin\main\buildlogic.java-common-conventions.gradle.kts

Thus, it seems an issue with https://github.com/gradlex-org/extra-java-module-info, isn't it @jjohannes ?

@jjohannes
Copy link
Contributor

@koppor it looks like the compiler is not using the transformed Jar. But I cannot reproduce the issue. If I manually set the target to ubuntu-22.04-arm on my machine here, ./gradlew assemble works.

@@ -28,7 +28,7 @@
@AllowedToUseClassGetResource("Required for loading internal CSL styles")
public class CitationStyleCatalogGenerator {
private static final String STYLES_ROOT = "/csl-styles";
private static final String CATALOG_PATH = "build/resources/main/citation-style-catalog.json";
private static final String CATALOG_PATH = "build/generated/resources/citation-style-catalog.json";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is correct? This will break at runtime I think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because this is part of the source sets - see the whole diff for build.gradle.kts

This was referenced Jun 9, 2025
@Siedlerchr Siedlerchr removed the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jun 11, 2025
@Siedlerchr
Copy link
Member Author

Siedlerchr commented Jun 11, 2025

Cross compilation did not work because it used an x64 java. When I specify the architecture to aarch64 then it does not work either with gradle. thus I close this for th emoment as it's blocked by the java module issues

@Siedlerchr Siedlerchr closed this Jun 11, 2025
Copy link

trag-bot bot commented Jun 11, 2025

@trag-bot didn't find any issues in the code! ✅✨

@koppor
Copy link
Member

koppor commented Jun 12, 2025

Cross compilation did not work because it used an x64 java. When I specify the architecture to aarch64 then it does not work either with gradle. thus I close this for th emoment as it's blocked by the java module issues

That means, also on your macOS machine following gradle task did not produce a valid arm64 image?

Background: I am trying to understand if we maybe can cross-compile from a non-linux.

./gradlew assembleUbuntu-22.04-arm 

@Siedlerchr
Copy link
Member Author

@koppor I downloaded the linux arm image build from the buids.jabref.org and tested it on an ubuntu arm vm

@koppor
Copy link
Member

koppor commented Jun 12, 2025

@koppor I downloaded the linux arm image build from the buids.jabref.org and tested it on an ubuntu arm vm

Could you mabe a) bulid the image on your machine and b) try it in the arm vm? 😅

@Siedlerchr
Copy link
Member Author

Siedlerchr commented Jun 12, 2025

  • What went wrong:
    Execution failed for task ':jabgui:jpackageUbuntu-22.04-arm'.
    Running on macosx; cannot build for linux

TL;DR you need the target runtime for the system. Jpackage cannot cross compile

@koppor
Copy link
Member

koppor commented Jun 12, 2025

Maybe, it boils down to Adoptium not shipping all jmods: adoptium/adoptium-support#1271 (comment)

@Siedlerchr
Copy link
Member Author

But we use zulu

@koppor
Copy link
Member

koppor commented Jun 12, 2025

I bet that Zulu ships JMODs only for the JDK of the current platform - and not all.

Intermediate result:

Still

> Running on amd64; cannot build for aarch64

@koppor
Copy link
Member

koppor commented Jun 12, 2025

@Siedlerchr Siedlerchr reopened this Jun 12, 2025
Copy link
Contributor

The build of this PR is available at https://builds.jabref.org/pull/13258/merge.

@@ -157,13 +157,16 @@ jobs:
- os: macos-14
displayName: macOS (ARM64)
suffix: '_arm64'
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os == 'ubuntu-22.04-arm' && 'ubuntu-22.04' || matrix.os }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the wrong approach, it loads the wrong jdk
grafik

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the wrong approach, it loads the wrong jdk

If we stay on cross compiling:

  1. JDK does has to match runner OS (currently happening)
  2. JMODs of target OS have to be downloaded
  3. jpackage (jlink?) has to be taught to use the downloaded JMODs instead of the ones shipped with the JDK.

Reason: .class files are portable, JMODs are platform-specific. Exceptional behavior for javafx jars is handled by some gradlex plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev: binaries Binary builds should be uploaded to builds.jabref.org dev: build-system dev: ci-cd
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package for Linux aarch64
3 participants