Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoqIDE (>= 8.13) crashes when opening preferences (platform-specific) #15486

Closed
Blaisorblade opened this issue Jan 15, 2022 · 28 comments
Closed
Labels
part: CoqIDE Issues and PRs related to CoqIDE or other IDE features of coq. platform: macOS This is a macOS specific issue.
Projects

Comments

@Blaisorblade
Copy link
Contributor

Blaisorblade commented Jan 15, 2022

Noticed in ocaml/opam-repository#20456.
To reproduce, install coqide, go to Edit -> Preferences. Clearing ~/.config/coq doesn't seem to make a difference.

Version:
CoqIDE 8.15, but also 8.13 and 8.14 from the respective platforms (__coq-platform.2021.11.0~8.13~2021.11 and __coq-platform.2021.11.0~8.14~2021.11).

Platform:

  • The bug is present on MacOS 12.1 Monterey on Mac M1 Max, and presumably absent on older MacOS releases (I think 10.15): I had confirmed CoqIDE 8.13 and 8.14 worked fine on that older OS.
  • EDIT: I also confirmed the bug on Mac OS 11 Big Sur on an Intel processor — so this seems to start on MacOS 11.
@Blaisorblade
Copy link
Contributor Author

Blaisorblade commented Jan 15, 2022

Stacktrace:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libgtk-3.0.dylib              	       0x103a40c54 _gtk_css_value_ref + 0
1   libgtk-3.0.dylib              	       0x103cc19f8 _gtk_style_properties_set_property_by_property + 276
2   libgtk-3.0.dylib              	       0x103a3b92c _gtk_css_style_property_assign + 64
3   libgtk-3.0.dylib              	       0x103a370d8 unpack_font_description + 436
4   libgtk-3.0.dylib              	       0x103cc1d94 gtk_style_properties_set_valist + 448
5   libgtk-3.0.dylib              	       0x103cc1f9c gtk_style_properties_set + 144
6   libgtk-3.0.dylib              	       0x103b0ffe8 _gtk_modifier_style_set_font + 156
7   libgtk-3.0.dylib              	       0x103ca32bc gtk_font_selection_load_font + 80
8   libgtk-3.0.dylib              	       0x103ca31b8 gtk_font_selection_select_style + 132
9   libgobject-2.0.0.dylib        	       0x1033a25b8 _g_closure_invoke_va + 320
10  libgobject-2.0.0.dylib        	       0x1033b8380 g_signal_emit_valist + 1220
11  libgobject-2.0.0.dylib        	       0x1033b8b24 g_signal_emit + 28
12  libgtk-3.0.dylib              	       0x103c27390 gtk_tree_view_real_set_cursor + 340
13  libgtk-3.0.dylib              	       0x103c2bff0 gtk_tree_view_set_cursor_on_cell + 312
14  libgtk-3.0.dylib              	       0x103ca3094 gtk_font_selection_select_font + 196
15  libgobject-2.0.0.dylib        	       0x1033a25b8 _g_closure_invoke_va + 320
16  libgobject-2.0.0.dylib        	       0x1033b8380 g_signal_emit_valist + 1220
17  libgobject-2.0.0.dylib        	       0x1033b8b24 g_signal_emit + 28
18  libgtk-3.0.dylib              	       0x103c27390 gtk_tree_view_real_set_cursor + 340
19  libgtk-3.0.dylib              	       0x103c26e24 gtk_tree_view_row_deleted + 1364
20  libgobject-2.0.0.dylib        	       0x1033a22e8 g_closure_invoke + 308
21  libgobject-2.0.0.dylib        	       0x1033b78f0 signal_emit_unlocked_R + 1836
22  libgobject-2.0.0.dylib        	       0x1033b87b8 g_signal_emit_valist + 2300
23  libgobject-2.0.0.dylib        	       0x1033b8b24 g_signal_emit + 28
24  libgtk-3.0.dylib              	       0x103c0f59c gtk_tree_model_row_deleted + 192
25  libgtk-3.0.dylib              	       0x103aeb6b0 gtk_list_store_remove + 396
26  libgtk-3.0.dylib              	       0x103aebde8 gtk_list_store_clear + 168
27  libgtk-3.0.dylib              	       0x103ca2490 gtk_font_selection_reload_fonts + 160
28  libgobject-2.0.0.dylib        	       0x1033a25b8 _g_closure_invoke_va + 320
29  libgobject-2.0.0.dylib        	       0x1033b8380 g_signal_emit_valist + 1220
30  libgobject-2.0.0.dylib        	       0x1033b8b24 g_signal_emit + 28
31  libgobject-2.0.0.dylib        	       0x1033a25b8 _g_closure_invoke_va + 320
32  libgobject-2.0.0.dylib        	       0x1033b8380 g_signal_emit_valist + 1220
33  libgobject-2.0.0.dylib        	       0x1033b8b24 g_signal_emit + 28
34  libgtk-3.0.dylib              	       0x103ba7cd8 gtk_style_context_validate + 228
35  libgtk-3.0.dylib              	       0x103a4117c gtk_css_widget_node_validate + 88
36  libgtk-3.0.dylib              	       0x103a24d8c gtk_css_node_validate_internal + 88
37  libgtk-3.0.dylib              	       0x103a24dbc gtk_css_node_validate_internal + 136
38  libgtk-3.0.dylib              	       0x103a24dbc gtk_css_node_validate_internal + 136
39  libgtk-3.0.dylib              	       0x103a24dbc gtk_css_node_validate_internal + 136
40  libgtk-3.0.dylib              	       0x103a24dbc gtk_css_node_validate_internal + 136
41  libgtk-3.0.dylib              	       0x103a24dbc gtk_css_node_validate_internal + 136
42  libgtk-3.0.dylib              	       0x103a24dbc gtk_css_node_validate_internal + 136
43  libgtk-3.0.dylib              	       0x103a24dbc gtk_css_node_validate_internal + 136
44  libgtk-3.0.dylib              	       0x103a24dbc gtk_css_node_validate_internal + 136
45  libgtk-3.0.dylib              	       0x103c7060c gtk_window_show + 84
46  libgobject-2.0.0.dylib        	       0x1033a22e8 g_closure_invoke + 308
47  libgobject-2.0.0.dylib        	       0x1033b75dc signal_emit_unlocked_R + 1048
48  libgobject-2.0.0.dylib        	       0x1033b87b8 g_signal_emit_valist + 2300
49  libgobject-2.0.0.dylib        	       0x1033b8b24 g_signal_emit + 28
50  libgtk-3.0.dylib              	       0x103c4bb70 gtk_widget_show + 228
51  libgtk-3.0.dylib              	       0x103a429a8 gtk_dialog_run + 184
52  coqide                        	       0x1025ab0a0 ml_gtk_dialog_run + 48 (ml_gtk.c:711)
53  coqide                        	       0x1025fb450 caml_c_call + 28
54  ???                           	       0x1309de154 ???
55  coqide                        	       0x102346bac camlConfigwin_ihm__iter_38035 + 292
56  coqide                        	       0x102420134 camlCoqide__anon_fn$5bcoqide$2eml$3a1473$2c16$2d$2d254$5d_35829 + 44
57  coqide                        	       0x102449bc8 camlGtkSignal__safe_call_inner_164 + 48
58  coqide                        	       0x1025fb50c caml_start_program + 180
59  coqide                        	       0x102336488 camlDune__exe__Coqide_main__entry + 13616
60  coqide                        	       0x1025fb50c caml_start_program + 180

EDIT: I can currently reproduce this easily and I have saved a full Apple crash log, but that has too much info.

@silene
Copy link
Contributor

silene commented Jan 15, 2022

This does not look like a Coq bug. Is it specific to Coqide 8.15 or can you reproduce it with 8.14 too?

@Blaisorblade Blaisorblade changed the title CoqIDE 8.15.0 crashes when opening preferences CoqIDE (>= 8.13) crashes on when opening preferences Jan 15, 2022
@Blaisorblade Blaisorblade changed the title CoqIDE (>= 8.13) crashes on when opening preferences CoqIDE (>= 8.13) crashes on recent MacOS when opening preferences Jan 15, 2022
@Blaisorblade Blaisorblade changed the title CoqIDE (>= 8.13) crashes on recent MacOS when opening preferences CoqIDE (>= 8.13) crashes when opening preferences (platform-specific) Jan 15, 2022
@Alizter Alizter added part: CoqIDE Issues and PRs related to CoqIDE or other IDE features of coq. platform: macOS This is a macOS specific issue. labels Jan 15, 2022
@davidnowak
Copy link

Same bug here with macOS Big Sur 11.6.3 (Intel), OCaml 4.11.2 or 4.12.1, CoqIDE 8.15.0.
I tried the same workaround as in #14352 (i.e. downgrading OCaml to version 4.11.2) but it did not make any difference here.

@Zimmi48
Copy link
Member

Zimmi48 commented Feb 10, 2022

This seems to be the same bug that was reported yesterday in the platform repo (cc @MSoegtropIMC): coq/platform#217

@orilahav
Copy link

Same bug here on a fresh installation macOS 12.2.1 (ARM), CoqIDE 8.15.0.
Any workaround for the time being?

@silene
Copy link
Contributor

silene commented Feb 17, 2022

Depending on whether the bug is in GTK or in Quartz/MacOS, the following might succeed:

broadwayd &
sleep 1
firefox http://localhost:8080/ # or chrome or ...
export GDK_BACKEND=broadway
coqide &

This will open Coqide inside your browser, thus side-stepping a lot of code in GTK, Quartz, and MacOS. (But be aware that this is hardly tested.)

@Blaisorblade
Copy link
Contributor Author

No easy broadwayd on mac AFAICT... at least brew install gtk+3 doesn't give me that and neither homebrew nor google seem to know about a way... (Other than maybe compiling from source.)

@MSoegtropIMC
Copy link
Contributor

@Blaisorblade : in case you can reproduce the issue, how about looking at it with ocamldebug?

Btw.: it might also be useful to check if this is a Homebrew vs. Macports issue. I am using Macports and I don't see the issue (at least not for compiled from sources CoqIDE - I see it with (otherwise identical) installed CoqIDE).

@Blaisorblade
Copy link
Contributor Author

Blaisorblade commented Feb 17, 2022

I just tried, but I'm stuck here:

$ rlwrap dune exec -- dev/dune-dbg coqide /tmp/foo.v
        OCaml Debugger version 4.14.0~alpha2

(ocd) run
Loading program... Fatal error: cannot load shared library dllcoqide_gui_stubs
Reason: dlopen(dllcoqide_gui_stubs.so, 0x000A): tried: 'dllcoqide_gui_stubs.so' (no such file), '/usr/local/lib/dllcoqide_gui_stubs.so' (no such file), '/usr/lib/dllcoqide_gui_stubs.so' (no such file), '/Users/pgiarrusso1/git-bedrock/coq/dllcoqide_gui_stubs.so' (no such file), '/usr/local/lib/dllcoqide_gui_stubs.so' (no such file), '/usr/lib/dllcoqide_gui_stubs.so' (no such file)
(ocd)

I'll try asking in the CoqWG.

EDIT: I tried extending (DY)LD_LIBRARY_PATH or patching dev/dune-dbg to pass extra args to ocamlfind, but had success with neither :-|

@MSoegtropIMC
Copy link
Contributor

I am afraid I can't help here - I did pretty deep debugging of CoqIDE a few years back - including mixed C and OCaml debugging and debugging of coqidetop, but that was before dune ...

@davidnowak
Copy link

Same bug here on a fresh installation macOS 12.2.1 (ARM), CoqIDE 8.15.0.
Any workaround for the time being?

cd
vi .config/coq/coqiderc

@MSoegtropIMC
Copy link
Contributor

@Blaisorblade : I recently had issues with labgtk3.3.1.1 on BigSur (see #15857) - which went away by switching to lablgtk3.3.1.2. Can you verify if this helps you?

@Blaisorblade
Copy link
Contributor Author

I already had lablgtk3.3.1.2 — with this gtk+3:

$ brew info gtk+3
gtk+3: stable 3.24.33 (bottled)
Toolkit for creating graphical user interfaces

since you use MacPorts and I use Homebrew, I wonder whether that's a factor, but installing both to try is probably going to be tricky...

@davidnowak @orilahav do you use Homebrew or MacPorts?

@MSoegtropIMC
Copy link
Contributor

I can test it on a VM.

@davidnowak
Copy link

davidnowak commented Mar 28, 2022

@Blaisorblade I use homebrew.
@MSoegtropIMC lablgtk3 3.1.2 solved the issue #14352 (by the way, someone should close it), but not this one.

@Alizter Alizter added this to Bugs in CoqIDE May 18, 2022
@jfehrle jfehrle moved this from Bugs to Wish in CoqIDE May 24, 2022
@jfehrle jfehrle moved this from Wish to Async and STM in CoqIDE May 24, 2022
@jfehrle jfehrle moved this from Async and STM to macOS in CoqIDE May 24, 2022
@orilahav
Copy link

Hi, any idea how to address this? Estimate on which version?
(I'll introduce Coq using CoqIDE in my course in the coming semester, and this bug doesn't give a good impression :()

@Alizter
Copy link
Contributor

Alizter commented Jun 12, 2022

@orilahav Unfortunately developers willing to spend time on CoqIDE are in short supply, let alone ones who can test on MacOS. I would like to make progress with this, but I don't know how to test on MacOS.

Have you tried VSCoq?

https://github.com/coq-community/vscoq

If your goal is to introduce Coq to students, you can point them to CoqIDE, VSCoq if that doesn't work and also mention Proof General for emacs and I believe there is Vim support also.

@amosunov
Copy link

amosunov commented Jun 15, 2022

The solution that I found was just to download an older release. For me 8.15 was not working on MacOS Monterey and the release 8.13.0 worked just fine:

https://github.com/coq/coq/releases

@Alizter
Copy link
Contributor

Alizter commented Jun 15, 2022

FTR it was discussed today in the working group. We will spend some time in the near future, making sure that we are compatible with M1 and M2 architectures. We would ideally like to be able to reproduce this issue reliably, and for that having M1 workers would be ideal. Unfortunately, this is not something GitHub ships by default, so perhaps an INRIA aided solution will be explored.

cc @MSoegtropIMC @maximedenes

@orilahav
Copy link

Thank you. Happy to assist with testing or anything within my capability.

@orilahav
Copy link

running coqide -debug I can see an error msg before the segmentation fault:
Coqide internal error: file ../gtk/gtkcssenumvalue.c: line 529 (_gtk_css_font_weight_value_new): should not be reached

@Alizter
Copy link
Contributor

Alizter commented Jun 17, 2022

This could be a style error, and not related to M1 then. Since it is happening on Intel Macs. I couldn't find anything about GTK failing on M1 on Google. @jfehrle what do you think?

@jfehrle
Copy link
Member

jfehrle commented Jun 17, 2022

See if you have the $XDG_DATA_DIRS environment variable set, and if so, clear it and try CoqIDE again. See #16211. Or (less likely) maybe the data it points to has gotten corrupted.

@orilahav
Copy link

In my case this variable It is not set.

@MollyDream
Copy link

Just to add a data point: I have the same problem with CoqIDE 8.13.2 on MacOS Monterey 12.0.1 with Intel chips, with the same error message before exiting:
Coqide internal error: file ../gtk/gtkcssenumvalue.c: line 529 ( gtk css_font weight_value new): should not be reached

@herbelin
Copy link
Member

Copying the conclusion of #16136: due to a bug introduced in pango 1.49.4 and fixed in pango development branch.

@Blaisorblade
Copy link
Contributor Author

Closing as duplicate of #16136.

@Blaisorblade Blaisorblade closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
CoqIDE automation moved this from macOS to Done Oct 16, 2022
@Blaisorblade
Copy link
Contributor Author

And I should have clarified this is, indeed, fixed (#16136).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
part: CoqIDE Issues and PRs related to CoqIDE or other IDE features of coq. platform: macOS This is a macOS specific issue.
Projects
CoqIDE
  
Done
Development

No branches or pull requests