icyphy / ptII

Ptolemy II is an open-source software framework supporting experimentation with actor-oriented design.
https://ptolemy.eecs.berkeley.edu/ptolemyII
Other
101 stars 43 forks source link

codegen Ramp demo fails under Mac OS 64 bit JVM #233

Open cxbrooks opened 14 years ago

cxbrooks commented 14 years ago

Note: the issue was created automatically with bugzilla2github tool

Original bug ID: BZ#352 From: @cxbrooks Reported version: 8.1.devel CC: pt-dev@chess.eecs.berkeley.edu

cxbrooks commented 14 years ago

Generating code for the codegen Ramp demo fails under Mac OS X with a 64 bit JVM such as Java 1.6.

To reproduce: 1) Run $PTII/bin/vergil /Users/cxh/ptII/ptolemy/codegen/demo/Ramp/Ramp.xml 2) Double click on the code generator and generate code 3) A binary is created, but it gets a segfault.

gdb says:

bash-3.2$ gdb Ramp GNU gdb 6.3.50-20050815 (Apple version gdb-960) (Sun May 18 18:38:33 UTC 2008) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin"...Reading symbols for shared libraries ..... done

(gdb) r Starting program: /Users/cxh/codegen/Ramp warning: posix_spawn failed, trying execvp, error: 86 Reading symbols for shared libraries +.+++.......................... done Foo about to create JavaVM

Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000 0x000000010020791d in JVM_ResolveClass () (gdb) where BZ#0 0x000000010020791d in JVM_ResolveClass () BZ#1 0x0000000100009e64 in JNI_CreateJavaVM_Impl () BZ#2 0x0000000100009017 in JNI_CreateJavaVM_Impl () BZ#3 0x0000000100008c9e in JNI_CreateJavaVM_Impl () BZ#4 0x0000000100002aa0 in initialize () at Ramp.c:617 BZ#5 0x0000000100002fa8 in main (argc=1, argv=0x7fff5fbfece0) at Ramp.c:702 (gdb)

See http://developer.apple.com/library/mac/#samplecode/simpleJavaLauncher/Introduction/Intro.html for info about invoking Java from C.

See http://www.mailinglistarchive.com/html/java-dev@ lists.apple.com/2010-01/msg00118.html for information about using simpleJavaLauncher with Java 1.6.

See http://chess.eecs.berkeley.edu/ptexternal/wiki/Main/Mac#JNI for notes about simpleJavaLauncher.

I think the fix here is to use more of the simpleJavaLauncher example and probably start the JVM in a separate thread. I've seen mention of threads and Swing and JNI under Mac OS X