I get a SIGSEGV with my Gradle Project on Linux, but Windows is fine

I started recently using Gradle, on my Netbeans I installed the corresponding plugin, I followed a couple of tutorials with sample projects. Now I decided to implement it in a small project of mine.

You can find it here, it is a small project to load dds, dxgi and ktx texture in java. It is a port of the original gli.

I have a Main class that I use as a quick and dirty test. On windows it runs fine, on Linux it crashes.

Executing: gradle :run
Arguments: [-PmainClass=test.Main, -c, /home/elect/NetBeansProjects/jgli/settings.gradle]

:processResources UP-TO-DATE
# A fatal error has been detected by the Java Runtime Environment:
#  SIGSEGV (0xb) at pc=0x0000000000002546, pid=14243, tid=140554612987648
# JRE version: OpenJDK Runtime Environment (8.0_45-b14) (build 1.8.0_45-internal-b14)
# Java VM: OpenJDK 64-Bit Server VM (25.45-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  0x0000000000002546
# Failed to write core dump. 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:
# /home/elect/NetBeansProjects/jgli/hs_err_pid14243.log
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/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.


Total time: 19.144 secs

You can find the log here

This class implements GLEventListener and KeyListener from the jogamp library.

And this is my build.gradle

How can I solve it?

This doesn’t look like a gradle problem. Gradle is invoking your application, and it’s that application that is crashing. From the crash dump it looks like jogamp is crashing in native code when trying to open the X display. I suggest you try asking the jogamp forums.

Looking for samples about jogl & gradle, I found this

As far as I get, he copies the jogl libraries into a folder… but why?

This seems to be a similar problem

I found a very interesting fact

If I use this configuration:

ext.jogampVer = '2.3.2'

repositories {
    flatDir { dirs 'jogamp' }

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'

    compile ":jogl-all:$jogampVer"
    compile ":gluegen-rt:$jogampVer"

It works on linux…

In my /jogamp I have gluegen-rt, jogl-all and the corresponding natives

But if I change the configuration back to

ext.jogampVer = '2.3.2'

repositories {

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.11'

    compile "org.jogamp.jogl:jogl-all:$jogampVer"
    compile "org.jogamp.gluegen:gluegen-rt:$jogampVer"
    compile "org.jogamp.jogl:jogl-all:$jogampVer:natives-linux-amd64"
    compile "org.jogamp.gluegen:gluegen-rt:$jogampVer:natives-linux-amd64"

It doesn’t find the native library anymore…

I tried to substitute compile with runtime but I had no success…

What’s wrong? Why cannot it find the natives?

This is the error

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /home/elect/IdeaProjects/Test/natives/linux-amd64//libnativewindow_awt.so

This path is exactly that one inside the native I am trying to include