Compilation works fine but when I run the sample project it crashes with a segfault.
[info] Running /Users/lukaskellenberger/Developer/scala-native/sandbox/target/scala-2.11/sandbox-out
java.lang.RuntimeException: Nonzero exit code: 139
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run last sandbox/*:run for the full output.
[error] (sandbox/*:run) Nonzero exit code: 139
[error] Total time: 63 s, completed Oct 7, 2016 4:23:14 PM
tsf-452-wpa-2-022:scala-native lukaskellenberger$ lldb sandbox/target/scala-2.11/sandbox-out
(lldb) target create "sandbox/target/scala-2.11/sandbox-out"
Current executable set to 'sandbox/target/scala-2.11/sandbox-out' (x86_64).
(lldb) run
Process 17401 launched: '/Users/lukaskellenberger/Developer/scala-native/sandbox/target/scala-2.11/sandbox-out' (x86_64)
Process 17401 stopped
* thread #1: tid = 0x84d9f, 0x0000000100504c12 libgc.1.dylib`GC_malloc_kind + 195, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1000)
frame #0: 0x0000000100504c12 libgc.1.dylib`GC_malloc_kind + 195
libgc.1.dylib`GC_malloc_kind:
-> 0x100504c12 <+195>: movq (%rax), %rcx
0x100504c15 <+198>: movq %rcx, (%r15)
0x100504c18 <+201>: testl %r12d, %r12d
0x100504c1b <+204>: je 0x100504c24 ; <+213>
(lldb) bt
* thread #1: tid = 0x84d9f, 0x0000000100504c12 libgc.1.dylib`GC_malloc_kind + 195, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x1000)
* frame #0: 0x0000000100504c12 libgc.1.dylib`GC_malloc_kind + 195
frame #1: 0x0000000000000008
frame #2: 0x000000010007f449 sandbox-out`scalanative_alloc + 25
frame #3: 0x000000010007f164 sandbox-out`load.scala.scalanative.runtime.package$ + 52
frame #4: 0x000000010007f2a2 sandbox-out`main + 18
frame #5: 0x00007fff8dfda255 libdyld.dylib`start + 1
frame #6: 0x00007fff8dfda255 libdyld.dylib`start + 1
(lldb)
I'm facing the same issue with demoNative on macOS 10.12. Tried both Boehm from git/master and homebrew. I'd really like to see this working, but can't really figure out what's going wrong with the GC. Maybe some security feature that's been added to Sierra? Like the one which crippled previous versions of upx?
After trying a bdwgc build with "--enable-gc-assertions", it turns out GC_init is not called anywhere before mallocs. I see method init in scalanative/runtime/package.scala calls the native GC_init, but it seams it's not being invoked at all!
@kammoh You were right, we indeed were not calling GC_init correctly. The issue's been fixed in #358.
Most helpful comment
I'm facing the same issue with demoNative on macOS 10.12. Tried both Boehm from git/master and homebrew. I'd really like to see this working, but can't really figure out what's going wrong with the GC. Maybe some security feature that's been added to Sierra? Like the one which crippled previous versions of upx?