korlibs / korge

KorGE Game Engine. Multiplatform Kotlin Game Engine
https://korge.org/
Other
2.57k stars 125 forks source link

which gradle versions is korge up to date with? #41

Closed Sphaerus closed 4 years ago

Sphaerus commented 5 years ago

running either hello world or one of the samples from https://github.com/korlibs/korge-samples i keep getting errors referencing gradle version

> Task :sample-box2d:runJvm FAILED
configureLoggerFromProperties:
Couldn't load Klogger configuration LocalVfs[/home/kuba/Desktop/kotlin/korge-samples/klogger.properties] : /home/kuba/Desktop/kotlin/korge-samples/klogger.properties (No such file or directory)
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.jogamp.common.os.NativeLibrary$3 (file:/home/kuba/.gradle/caches/modules-2/files-2.1/org.jogamp.gluegen/gluegen-rt/2.3.2/edc35ccfc13d4a4ad02c50d580874c18bf48bbef/gluegen-rt-2.3.2.jar) to method java.lang.ClassLoader.findLibrary(java.lang.String)
WARNING: Please consider reporting this to the maintainers of com.jogamp.common.os.NativeLibrary$3
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007ff969fae72f, pid=26373, tid=26376
#
# JRE version: OpenJDK Runtime Environment (11.0.4+11) (build 11.0.4+11)
# Java VM: OpenJDK 64-Bit Server VM (11.0.4+11, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [ld-linux-x86-64.so.2+0xa72f]
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/kuba/Desktop/kotlin/korge-samples/sample-box2d/core.26373)
#
# An error report file with more information is saved as:
# /home/kuba/Desktop/kotlin/korge-samples/sample-box2d/hs_err_pid26373.log
#
# If you would like to submit a bug report, please visit:
#   https://github.com/AdoptOpenJDK/openjdk-build/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sample-box2d:runJvm'.
> Process 'command '/home/kuba/.sdkman/candidates/java/11.0.4.hs-adpt/bin/java'' finished with non-zero exit value 134

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings

i tried opening /home/kuba/Desktop/kotlin/korge-samples/sample-box2d/hs_err_pid26373.log but i dont have any java experience and its all basically chinese to me, how do i debug it?

EDIT gradle -v gives me

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/usr/share/java/groovy-all.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------

Build time:   2012-12-21 00:00:00 UTC
Revision:     none

Groovy:       2.4.16
Ant:          Apache Ant(TM) version 1.10.5 compiled on March 28 2019
JVM:          11.0.4 (AdoptOpenJDK 11.0.4+11)
OS:           Linux 5.0.0-25-generic amd64

so i dont even know where this 6.0 message is coming from

saem commented 5 years ago

I get the same error, but a few things are different. I'm using Gradle 5.2.1 and using the template project as is. I've tried this with both openjdk 1.8.0_212 and 11.0.3.

saem commented 5 years ago

After a bunch of looking around this seems to be an issue with Ubuntu (might occur on some Redhat distros, but those reports are old). In particular, the builds of glibc that are currently shipping + perhaps some misreported information (AVX extension related) is causing the JVM to encounter a fatal error:

# Problematic frame:
# C  [ld-linux-x86-64.so.2+0xa72f]

Others are having similar issues elsewhere, the error messages change across Java 8 and Java 11 for me, but supposedly Java 8 fixes it for others. Example of it happening for other Java apps: https://bugs.launchpad.net/ubuntu/+source/sweethome3d/+bug/1797920

saem commented 5 years ago

I worked with a friend with experience in the area and after using strace on the java call that gradle executes on MainKt that ultimately results in the error, it seems that the native jogamp dependencies don't work on Ubuntu.

Ubuntu ships with pre-built versions via apt, they're also version 2.3.2, so the trick now is to figure out how to include those are a dependency in my local project and I think my approach will be as follows: https://discuss.gradle.org/t/is-it-possible-in-a-root-project-to-override-replace-a-sub-project-dependency/3521/2

This will mean that if there is a system update or if korge updates then Ubuntu I'm going to be in trouble. Not quite sure what to do about this, but it's a bit of a bummer.

soywiz commented 4 years ago

Korge >= 1.4.2 supports an experimental JNA backend that doesn't use jogl, but relies on X11 directly. https://github.com/korlibs/korgw/blob/51bc6d4fcd03ed2730db728d11245a984366128d/korgw/src/jvmMain/kotlin/com/soywiz/korgw/x11/X11GameWindow.kt

This should be fixed.

You can enable it in three ways:

I'm closing the issue, if you try and work/doesn't work, please let me know. It worked for me on Ubuntu and Ubuntu on WSL, but maybe fails in some configurations?

soywiz commented 4 years ago

Korge 1.4.3c includes jna by default without having to do anything. Tested on an old machine with lubuntu and works fine now.