emacsMacport crashes instantly and won't start with the new Darwin stdenv.
My emacsMacport is bundled with quite a few Emacs packages, so this may be a bit hard to isolate, but hopefully it's reproducible anyway.
emacsMacport with recent nixpkgs.open ~/Applications/Emacs.app
This is with nixpkgs d9df60fb71a61ee62786a6205ef5efbae5b726f0.
Partial Problem Report included below. I've elided most of it for privacy reasons; let me know if you need more info:
Process: Emacs [74464]
Path: /nix/*/Emacs.app/Contents/MacOS/Emacs
Identifier: org.gnu.Emacs
Version: 26.2 (1.1)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Emacs [74464]
User ID: 501
Date/Time: 2019-05-16 16:45:50.929 +0100
OS Version: Mac OS X 10.14.5 (18F132)
Report Version: 12
Bridge OS Version: 3.5 (16P5125)
Anonymous UUID: [redacted]
Time Awake Since Boot: 180000 seconds
System Integrity Protection: enabled
Crashed Thread: 3 org.gnu.Emacs.lisp-main
Exception Type: EXC_CRASH (SIGSEGV)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff5fbc87de __sigsuspend + 10
1 org.gnu.Emacs 0x00000001000ed8e8 deliver_thread_signal + 120
2 org.gnu.Emacs 0x00000001000ec429 deliver_fatal_thread_signal + 9
3 org.gnu.Emacs 0x00000001000ed9ab handle_sigsegv + 171
4 libsystem_platform.dylib 0x00007fff5fc60b5d _sigtramp + 29
5 ??? 000000000000000000 0 + 0
6 libobjc.A.dylib 0x00007fff5e29c47c (anonymous namespace)::AutoreleasePoolPage::pop(void*) + 710
7 org.gnu.Emacs 0x000000010023a2ba mac_gui_loop + 106
8 org.gnu.Emacs 0x000000010023a1d3 main + 1171
9 libdyld.dylib 0x00007fff5fa753d5 start + 1
Thread 1:
0 libsystem_pthread.dylib 0x00007fff5fc683f0 start_wqthread + 0
Thread 2:
0 libsystem_pthread.dylib 0x00007fff5fc683f0 start_wqthread + 0
Thread 3 Crashed:: org.gnu.Emacs.lisp-main
0 libsystem_kernel.dylib 0x00007fff5fbb02c6 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff5fc6bbf1 pthread_kill + 284
2 libsystem_c.dylib 0x00007fff5facdd8a raise + 26
3 org.gnu.Emacs 0x00000001000cb749 terminate_due_to_signal + 153
4 org.gnu.Emacs 0x00000001000ec413 deliver_fatal_signal + 163
5 libsystem_platform.dylib 0x00007fff5fc60b5d _sigtramp + 29
6 ??? 000000000000000000 0 + 0
7 libdispatch.dylib 0x00007fff5fa293a0 _dispatch_semaphore_wait_slow + 98
8 org.gnu.Emacs 0x0000000100238f73 mac_within_gui_and_here + 99
9 org.gnu.Emacs 0x0000000100215b0f mac_set_frame_window_title + 111
10 org.gnu.Emacs 0x00000001001e90cf x_set_name + 271
11 org.gnu.Emacs 0x00000001001e9fc7 Fx_create_frame + 3063
12 org.gnu.Emacs 0x000000010015c7f3 __funcall_subr_block_invoke + 291
13 org.gnu.Emacs 0x0000000100209bbf mac_autorelease_loop + 47
14 org.gnu.Emacs 0x000000010015b567 Ffuncall + 1191
15 org.gnu.Emacs 0x00000001001a86cf exec_byte_code + 1823
16 org.gnu.Emacs 0x000000010015b47d Ffuncall + 957
17 org.gnu.Emacs 0x00000001001a86cf exec_byte_code + 1823
18 org.gnu.Emacs 0x000000010015b47d Ffuncall + 957
19 org.gnu.Emacs 0x000000010015c79f __funcall_subr_block_invoke + 207
20 org.gnu.Emacs 0x0000000100209bbf mac_autorelease_loop + 47
21 org.gnu.Emacs 0x000000010015b567 Ffuncall + 1191
22 org.gnu.Emacs 0x00000001001a86cf exec_byte_code + 1823
23 org.gnu.Emacs 0x000000010015b47d Ffuncall + 957
24 org.gnu.Emacs 0x00000001001a86cf exec_byte_code + 1823
25 org.gnu.Emacs 0x000000010015b47d Ffuncall + 957
26 org.gnu.Emacs 0x00000001001a86cf exec_byte_code + 1823
27 org.gnu.Emacs 0x000000010015b47d Ffuncall + 957
28 org.gnu.Emacs 0x00000001001a86cf exec_byte_code + 1823
29 org.gnu.Emacs 0x000000010015b47d Ffuncall + 957
30 org.gnu.Emacs 0x00000001001a86cf exec_byte_code + 1823
31 org.gnu.Emacs 0x000000010015ab24 apply_lambda + 356
32 org.gnu.Emacs 0x0000000100156853 eval_sub + 1155
33 org.gnu.Emacs 0x000000010015a859 Feval + 121
34 org.gnu.Emacs 0x00000001001598fc internal_condition_case + 268
35 org.gnu.Emacs 0x00000001000df7cd top_level_1 + 45
36 org.gnu.Emacs 0x0000000100158ea0 internal_catch + 272
37 org.gnu.Emacs 0x00000001000ceb6f command_loop + 143
38 org.gnu.Emacs 0x00000001000cea8f recursive_edit_1 + 111
39 org.gnu.Emacs 0x00000001000ced76 Frecursive_edit + 406
40 org.gnu.Emacs 0x00000001000cd68b emacs_main + 7371
41 org.gnu.Emacs 0x000000010023a244 mac_start_lisp_main + 52
42 libsystem_pthread.dylib 0x00007fff5fc692eb _pthread_body + 126
43 libsystem_pthread.dylib 0x00007fff5fc6c249 _pthread_start + 66
44 libsystem_pthread.dylib 0x00007fff5fc6840d thread_start + 13
<remainder elided>
Can reproduce on current "master". "open result/Applications/Emacs.app" won't start anything, but I don't get a crash report, nothing appears in ~/Library/Logs/DiagnosticReports/.
edit: got my crash report a bit later, it's the same stacktrace as reported
The regular emacs works.
Looks like libdispatch is too old. Working on it now
I've opened up a draft that I think might fix it: https://github.com/NixOS/nixpkgs/pull/61613
I'm building it now, but if you have a beefy machine it might help to try to build it as well
I'm afraid that #61613 doesn't fix the issue. Here's a gist with the new crash, which looks more or less identical to the one I posted above:
https://gist.github.com/dhess/ddb05ea10421743ce757a35336f4929f
I built this with my nixpkgs fork here:
https://github.com/dhess/nixpkgs/commit/416ac345a0c3afdad510ae4a6fa87cdc685bbfd1
I'm trying to confirm that this emacsMacport has been built with the updated libdispatch. I'm having trouble tracking it down. Can you tell me how to figure it out?
Here's a simpler repro case. This happens when I try to build emacsWithPackages using emacsMacport and the melpa lsp-haskell Emacs pacakge:
https://gist.github.com/dhess/6437ae2a7976e877b7d2ab28ed70ffb8
So the short term fix is just to use llvm6. At some point, I'll try to dig into what is actually happening, but I suspect something has changed in how llvm handles threads.
Thank you! I鈥檓 happy to use a work-around and didn鈥檛 expect you to address this complex issue so quickly! I was resigned to using the vanilla emacs for the foreseeable future, so this is a very welcome development.
I can confirm that this appears to be fixed in my Hydra builds, as well.
Most helpful comment
So the short term fix is just to use llvm6. At some point, I'll try to dig into what is actually happening, but I suspect something has changed in how llvm handles threads.