Skip to content
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

Native compile [GraalVM] #11298

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Native compile [GraalVM] #11298

wants to merge 5 commits into from

Conversation

calixtus
Copy link
Member

@calixtus calixtus commented May 17, 2024

Howto

  • Run gradle task nativeCompile.

Mandatory checks

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • 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.

@calixtus
Copy link
Member Author

image
image

@Siedlerchr
Copy link
Member

Caused by: java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 66.0

@koppor
Copy link
Member

koppor commented May 18, 2024

Caused by: java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 66.0

Uhoh. I went back to Java 21 in d39fb35 (#11298), because I didn't know why Java 22 should be important at this point in time.

Copy link
Contributor

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

@koppor
Copy link
Member

koppor commented May 18, 2024

With Java 21, the image compiles fine, but cannot be started:

koppor@DESKTOP-KAK953S MINGW64 /c/git-repositories/jabref/build/native/nativeCompile (nativecompile)
$ ./JAbRef.exe
Messages are not initialized before accessing key: Display help on command line options
LOGGER ERROR: Service implementation 'org.tinylog.writers.ConsoleWriter' has no matching constructor
Exception in thread "main" java.lang.NullPointerException
        at org.jabref.logic.l10n.Localization.lookup(Localization.java:146)
        at org.jabref.logic.l10n.Localization.lang(Localization.java:58)
        at org.jabref.cli.JabRefCLI.getOptions(JabRefCLI.java:184)
        at org.jabref.cli.JabRefCLI.<init>(JabRefCLI.java:33)
        at org.jabref.Launcher.main(Launcher.java:59)
        at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

@koppor
Copy link
Member

koppor commented May 18, 2024

Current hint:

// Source: https://github.com/tinylog-org/tinylog/issues/145#issuecomment-603430594
task generateConfiguration(type: Exec) {
    group = "graal"
    description = "Run application to generate the configuration for native image"
    dependsOn build
    commandLine project.gradle.gradleUserHomeDir.toPath().resolve("caches/com.palantir.graal/$graalVmVersion/graalvm-ce-$graalVmVersion/bin/java"), "-agentlib:native-image-agent=config-output-dir=" + project.buildDir.toPath().resolve("resources/main/META-INF/native-image"), "-cp", sourceSets.main.runtimeClasspath.getAsPath(), javaMainClass

    doFirst {
        mkdir project.buildDir.toPath().resolve("resources/main/META-INF/native-image")
    }
}

@calixtus
Copy link
Member Author

Current hint

Requires palantir graal plugin for gradle

@koppor
Copy link
Member

koppor commented May 18, 2024

Current hint

Requires palantir graal plugin for gradle

I don't think so. The path starts with plantir, but the content seems to be the real GraalVM. Thus, the paths "just" need to ne adapted to recent GraalVM.

@koppor
Copy link
Member

koppor commented May 19, 2024

MWE project to try out a fix: https://github.com/shoneslab/graal-logging (referenced from tinylog-org/tinylog#145 (comment))

@koppor koppor changed the title Native compile Native compile [GraalVM] May 20, 2024
@koppor
Copy link
Member

koppor commented May 20, 2024

This needs to be adressed: oracle/graal#7682

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
@calixtus
Copy link
Member Author

@koppor
Copy link
Member

koppor commented May 23, 2024

https://thenewstack.io/how-to-build-with-graalvm-inside-github-actions/

Doesn't use Toolchain. Think, we already managed to compile using GraalVM, but have issues with our file access

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants