1
\$\begingroup\$

I'm trying to start LWJGL 3 development and I am having an issue with getting things working. I have created a new Gradle project and successfully built the HelloWorld example from https://www.lwjgl.org/guide but when I run I get an error. However the error seems to be different each time. Here is one example:

Hello LWJGL 3.2.3 build 13!
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff6d4fe829, pid=4595, tid=5891
#
# JRE version: Java(TM) SE Runtime Environment (14.0.1+7) (build 14.0.1+7)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0.1+7, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [libobjc.A.dylib+0x6829]  objc_msgSend+0x29
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/rob/Projects/Personal/cc/hs_err_pid4595.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Another:

Hello LWJGL 3.2.3 build 13!
[thread 9731 also had an error]
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff34cc1027, pid=4579, tid=775
#
# JRE version: Java(TM) SE Runtime Environment (14.0.1+7) (build 14.0.1+7)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14.0.1+7, mixed mode, sharing, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  [CoreGraphics+0x73027]  CGClipRelease+0xe
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/rob/Projects/Personal/cc/hs_err_pid4579.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#

What should I start looking at to resolve this?

\$\endgroup\$
  • 1
    \$\begingroup\$ Is there any more information in Users/rob/Projects/Personal/cc/hs_err_pid[number].log? \$\endgroup\$ – Tyyppi_77 Jun 27 at 15:27
  • \$\begingroup\$ And just to confirm, you have passed "-XstartOnFirstThread" as a VM option?` \$\endgroup\$ – Tyyppi_77 Jun 27 at 15:28
  • \$\begingroup\$ @Tyyppi_77 Yes, I am running with GRADLE_OPTS=-XstartOnFirstThread ./gradlew run \$\endgroup\$ – Robin Elvin Jun 27 at 18:51
  • \$\begingroup\$ @Tyyppi_77 However checking the log it doesn't seem the arg is being passed to the JVM \$\endgroup\$ – Robin Elvin Jun 27 at 18:59
  • 1
    \$\begingroup\$ Done, would you mind editing my answer a bit to elaborate the final step of what to do with the Gradle build file, as I have no experience with Gradle itself? \$\endgroup\$ – Tyyppi_77 Jun 27 at 20:39
0
\$\begingroup\$

Given that the crash is inconsistent, it's probably a threading issue. The link you shared says

MacOS users should start their application passing "-XstartOnFirstThread" as a VM option.

so I'm guess that you're not properly setting the VM option. Setup a run configuration in build.gradle.

Example run config for Gradle:

Add to build.gradle

run {
  if(project.hasProperty('arg')){
    args(arg.split(','))
  }
  main = "MyPackage.MyEntry"
  classpath = sourceSets.main.runtimeClasspath
  jvmArgs = [
    "-XstartOnFirstThread"
  ]
  systemProperties System.getProperties()
}
| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.