robovm / robovm

For more info see
http://robovm.com
1.64k stars 395 forks source link

[RoboVM 1.9.0] Segmentation fault during the compilation of a Linux x86 console application #1177

Open thgard opened 9 years ago

thgard commented 9 years ago

Hi,

I tried to compile a HelloWorld example using RoboVM 1.9.0 and the corresponding Maven plugin for Linux x86.

Every time I get the following segmentation fault:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x9e908fcd, pid=20362, tid=3065121600
#
# JRE version: Java(TM) SE Runtime Environment (7.0_80-b15) (build 1.7.0_80-b15)
# Java VM: Java HotSpot(TM) Client VM (24.80-b11 mixed mode linux-x86 )
# Problematic frame:
# C  [librobovm-llvm2326863979146643313.so+0x19a8fcd]  Java_org_robovm_llvm_binding_LLVMJNI_ClangCompileFile+0x18581cd
#
# 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/gard/workspace/robo86/hs_err_pid20362.log
#
# If you would like to submit a bug report, please visit:
#   http://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.
#

I tried it on Ubuntu 12.04 LTS x86 with g++ 4.7, Oracle JDK 1.7.0_80, build-essential, gcc-multilib, g++-multilib and zlibc installed.

The x86_64 build on another machine (14.04LTS, x64) finishes successful, but the x86 build fails too.

Google groups link with log files attached: https://groups.google.com/forum/#!topic/robovm/M8_Pmt6ARHQ

ntherning commented 8 years ago

I had a look at the log files in the Google Groups post and they seem to be for the attempt on Linux (Ubuntu 12.04?) i386. Do you get the exact same crash on Ubuntu 14.04 x86_64? Can you please provide the logs for that? And make sure you are using a 64-bit JVM otherwise the 32-bit LLVM binaries will be used. We are aware of issues with the 32-bit LLVM binaries (#681).

Also, please provide the code you are trying to compile as well as the project (Maven) files. I will try to compile a simple "Hello world" program on Ubuntu 14.04 64-bit to see if that works here.

ntherning commented 8 years ago

Ok, just tried to compile the HelloWorld-console sample in 32-bit mode on Ubuntu 14.04 64-bit with a 64-bit JVM and it fails with a SIGSEGV. Here are the steps I took:

git clone git@github.com:robovm/robovm-samples.git
cd robovm-samples/
cd HelloWorld-console/
mvn -Drobovm.arch=x86 compile robovm:console

System info:

niklas@ubuntu:~/Projects/robovm-samples/HelloWorld-console$ uname -a
Linux ubuntu 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
niklas@ubuntu:~/Projects/robovm-samples/HelloWorld-console$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS"
niklas@ubuntu:~/Projects/robovm-samples/HelloWorld-console$ java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
niklas@ubuntu:~/Projects/robovm-samples/HelloWorld-console$ mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_60, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-45-generic", arch: "amd64", family: "unix"

Crash log says:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f2b8e00af2d, pid=33300, tid=139825010812672
#
# JRE version: Java(TM) SE Runtime Environment (8.0_60-b27) (build 1.8.0_60-b27)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.60-b23 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [librobovm-llvm6948531281634001620.so+0x112df2d]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://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.
#

...

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [librobovm-llvm6948531281634001620.so+0x112df2d]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  org.robovm.llvm.binding.LLVMJNI.TargetMachineEmitToOutputStream(JJLjava/io/OutputStream;IJLorg/robovm/llvm/binding/StringOut;)Z+0
j  org.robovm.llvm.binding.LLVM.TargetMachineEmitToOutputStream(Lorg/robovm/llvm/binding/TargetMachineRef;Lorg/robovm/llvm/binding/ModuleRef;Ljava/io/OutputStream;Lorg/robovm/llvm/binding/CodeGenFileType;Lorg/robovm/llvm/binding/StringOut;)Z+20
j  org.robovm.llvm.TargetMachine.emit(Lorg/robovm/llvm/Module;Ljava/io/OutputStream;Lorg/robovm/llvm/binding/CodeGenFileType;)V+29
J 5060 C1 org.robovm.compiler.ClassCompiler.generateMachineCode(Lorg/robovm/compiler/config/Config;Lorg/robovm/compiler/clazz/Clazz;[BLjava/util/List;)V (2346 bytes) @ 0x00007f2bb1bc5fbc [0x00007f2bb1bbe240+0x7d7c]
j  org.robovm.compiler.ClassCompiler.access$000(Lorg/robovm/compiler/config/Config;Lorg/robovm/compiler/clazz/Clazz;[BLjava/util/List;)V+4
j  org.robovm.compiler.ClassCompiler$1.run()V+16
j  java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V+95
j  java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j  java.lang.Thread.run()V+11
v  ~StubRoutines::call_stub

...
thgard commented 8 years ago

I had the same result with nearly the same configuration. Therefore I won't do double posting my results.