Java 1.6分段故障11(OSX 10.7.4)

uer*_*ceg 5 java macos segmentation-fault llvm-gcc osx-lion

我有.jar文件,它在运行时读取一个.dylib库,我在OSX中用GCC编译器编译.

应用程序在OSX 10.6.8上运行没有任何问题.

Java版本:

java版"1.6.0_33"Java(TM)SE运行时环境(版本1.6.0_33-b10-424-10M3720)Java HotSpot(TM)64位服务器VM(版本20.8-b01-424,混合模式)

GCC版本:

i686-apple-darwin11-llvm-gcc-4.2(GCC)4.2.1(基于Apple Inc. build 5658)(LLVM build 2336.1.00)

我使用64位Java和libs,其中.jar需要为x86_64编译.所以,在Snow Leopard上,一切都运行良好.

我现在将我的应用程序切换到OSX 10.7.4.在那里我尝试了两个不同的Java版本:

第一个Java版本(与Snow Leopard相同):

java版"1.6.0_33"Java(TM)SE运行时环境(版本1.6.0_33-b10-424-10M3720)Java HotSpot(TM)64位服务器VM(版本20.8-b01-424,混合模式)

第二个Java版本(今天更新):

java版"1.6.0_35"Java(TM)SE运行时环境(版本1.6.0_35-b10-428-11M3811)Java HotSpot(TM)64位服务器VM(版本20.10-b01-428,混合模式)

GCC版本:

i686-apple-darwin11-llvm-gcc-4.2(GCC)4.2.1(基于Apple Inc. build 5658)(LLVM build 2336.9.00)

我首先尝试使用在Snow Leopard上编译的.dylib来运行应用程序,但是我收到了这个错误:

位置0x0的内存访问无效rip = 0x7fff894aa697分段错误:11

还有新的线路没有导致应用程序崩溃,但它们没有在Snow Leopard上显示:

java[1366] <Error>: CGContextGetCTM: invalid context 0x0
java[1366] <Error>: CGContextSetBaseCTM: invalid context 0x0
java[1366] <Error>: CGContextGetCTM: invalid context 0x0
java[1366] <Error>: CGContextSetBaseCTM: invalid context 0x0
Run Code Online (Sandbox Code Playgroud)

在这次崩溃之后,我尝试在Lion上重新编译依赖.dylib与GCC,但是没有改变.我仍然得到Segmentation fault:11错误.

我在网上读到了这个错误,据我所知,它经常出现在Lion上,因为Java更新可能搞砸了,但是因为我对Java不太熟悉 - 有没有人遇到过这些问题,如果有的话,有没有办法解决这个问题?

非常感谢.


[编辑#1:在OSX 10.7.4上尝试使用Java 7]

使用Java 7运行.jar时,会再次发生崩溃,这是错误报告:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff894aa697, pid=1471, tid=31503
#
# JRE version: 7.0_07-b10
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.3-b01 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [CoreFoundation+0x2a697]  CFSetGetValue+0x17
#
# 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:
# /Users/username/Desktop/executable/hs_err_pid1471.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Abort trap: 6
Run Code Online (Sandbox Code Playgroud)

uer*_*ceg 2

使用 Mac OS X 10.8.2 和 Java 6 安装后,问题就消失了。我正在阅读有关此问题的文章,并了解到 Java 6 和 Mac OS X 10.7.4 存在一些问题。就我而言,我只是在等待在 10.8.2 上测试应用程序,以检查它是否仅在 10.7.4 上产生这些错误,而且看起来这些错误仅发生在 10.7.4 上。

通过操作系统升级,问题就得到了解决,在这种情况下,这对我来说已经足够好了。

此致。