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

Generate native binary #860

Merged
merged 1 commit into from
Dec 11, 2020
Merged

Conversation

datho7561
Copy link
Contributor

@datho7561 datho7561 commented Aug 27, 2020

Use GraalVM's native-image feature to generate a executable. To test, install GraalVM and the native-image tool, then set JAVA_HOME to the GraalVM installation. Run ./mvnw package -Dnative -DskipTests in order to generate an executable under org.eclipse.lemminx/target.

Includes a GitHub Action in order to run builds of the binary on PRs for testing purposes.

Adopted from PR 673
A part of #314.

Signed-off-by: David Thompson [email protected]

@datho7561
Copy link
Contributor Author

Recently rebased against master and fixed XML formatting (it had a reflection error)

@fbricon
Copy link
Contributor

fbricon commented Sep 1, 2020

Opening the attached xsd with the binary server, I ran into a stackoverflow
AUTOSAR_00047.xsd.zip

java.lang.StackOverflowError
	at com.oracle.svm.core.graal.snippets.StackOverflowCheckSnippets.newStackOverflowError0(StackOverflowCheckImpl.java:370)
	at com.oracle.svm.core.graal.snippets.StackOverflowCheckSnippets.newStackOverflowError(StackOverflowCheckImpl.java:366)
	at com.oracle.svm.core.graal.snippets.StackOverflowCheckSnippets.throwNewStackOverflowError(StackOverflowCheckImpl.java:346)
	at com.oracle.svm.core.graal.jdk.ArraycopySnippets.doArraycopy(ArraycopySnippets.java:83)
	at java.util.ArrayList.add(ArrayList.java:484)
	at java.util.ArrayList$SubList.add(ArrayList.java:1057)
	at java.util.ArrayList$SubList.add(ArrayList.java:1057)
	at java.util.ArrayList$SubList.add(ArrayList.java:1057)
	at java.util.ArrayList$SubList.add(ArrayList.java:1057)
	at java.util.ArrayList$SubList.add(ArrayList.java:1057)
        ... 10045 more lines
	at java.util.ArrayList$SubList.add(ArrayList.java:1057)
	at java.util.AbstractList.add(AbstractList.java:108)
	at org.eclipse.lemminx.services.XMLFoldings.getFoldingRanges(XMLFoldings.java:81)
	at org.eclipse.lemminx.services.XMLLanguageService.getFoldingRanges(XMLLanguageService.java:222)
	at org.eclipse.lemminx.XMLTextDocumentService.lambda$foldingRange$10(XMLTextDocumentService.java:319)
	at java.util.concurrent.CompletableFuture.biApply(CompletableFuture.java:1119)
	at java.util.concurrent.CompletableFuture$BiApply.tryFire(CompletableFuture.java:1084)
	at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:457)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:163)
	at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:517)
	at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)

to be fair, the JVM server becomes unresponsive when opening the file with the default memory settings

@datho7561
Copy link
Contributor Author

Opening the attached xsd with the binary server, I ran into a stackoverflow

I just tried opening the file, and I couldn't reproduce the stackoverflow. The server remained responsive. Folding was automatically disabled, though.

@datho7561 datho7561 force-pushed the rebased-native-binary branch 4 times, most recently from 604446c to ecdca0c Compare September 10, 2020 17:28
@datho7561 datho7561 force-pushed the rebased-native-binary branch 2 times, most recently from 4caa870 to 6025e2d Compare September 16, 2020 17:18
@datho7561
Copy link
Contributor Author

Moved the native binary pipeline into a separate file for the time being, as it was blocking Jenkins builds on other PRs

@datho7561
Copy link
Contributor Author

datho7561 commented Sep 16, 2020

  • Switched to building under a container in Linux
  • Pipeline setup (not configured properly to work with PRs so no successful builds yet)

@datho7561 datho7561 force-pushed the rebased-native-binary branch 16 times, most recently from 3a09c0b to 11bd713 Compare September 29, 2020 20:29
@datho7561 datho7561 force-pushed the rebased-native-binary branch 9 times, most recently from a50e340 to a9c781b Compare November 30, 2020 18:30
@datho7561 datho7561 force-pushed the rebased-native-binary branch 2 times, most recently from f0848fe to ca8baeb Compare December 3, 2020 17:14
README.md Outdated Show resolved Hide resolved
.editorconfig Outdated Show resolved Hide resolved
@datho7561 datho7561 marked this pull request as ready for review December 3, 2020 17:14
Copy link
Contributor

@rgrunber rgrunber left a comment

Choose a reason for hiding this comment

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

Looks good to me. On Fedora I just needed to install just glibc-static, libstdc++-static, and zlib-static .

I noticed that there is a separate profile to use the static libraries on Linux. The only difference I'm seeing is in the additional --static flags. Is it possible to have one profile that gets activated on linux and sets the normally empty property to --static, and just refer to that property in the profile that makes the plugin call ?

If not possible, this is fine as well.

@datho7561
Copy link
Contributor Author

I'll take a look into doing this.

@datho7561 datho7561 force-pushed the rebased-native-binary branch 3 times, most recently from ea4deed to a8c54a2 Compare December 10, 2020 19:36
@datho7561
Copy link
Contributor Author

I changed it so that you compile with ./mvnw clean package -Dnative -DskipTests -Dgraalvm.static=--static under Linux in order to include the libraries statically, and updated the GitHub Action in order to reflect this. Please let me know if this makes sense.

@rgrunber
Copy link
Contributor

I changed it so that you compile with ./mvnw clean package -Dnative -DskipTests -Dgraalvm.static=--static under Linux in order to include the libraries statically, and updated the GitHub Action in order to reflect this. Please let me know if this makes sense.

Yup, this is fine.

Use GraalVM's `native-image` feature to generate a executable.
To test, install GraalVM and the native-image tool, then set JAVA_HOME
to the GraalVM installation.
Run `./mvnw package -Dnative -DskipTests` in order to generate an
executable under `org.eclipse.lemminx/target`.

Includes a GitHub Action in order to run builds of the binary on PRs for
testing purposes.

Adopted from [PR 673](eclipse#673)
A part of eclipse#314.

Signed-off-by: David Thompson <[email protected]>
@datho7561
Copy link
Contributor Author

Should I go ahead and merge this PR?

@fbricon
Copy link
Contributor

fbricon commented Dec 11, 2020

go ahead

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.

3 participants