ocaml-multicore icon indicating copy to clipboard operation
ocaml-multicore copied to clipboard

lablgtk's example segfaults

Open kit-ty-kate opened this issue 4 years ago • 5 comments

Using the following patch to make lablgtk compile: https://github.com/garrigue/lablgtk/pull/129 Trying to run examples/about.exe results in the following gdb backtrace:

$ dune build --only-packages lablgtk3 examples/about.exe
$ gdb ./_build/default/examples/about.exe
[...]
Program received signal SIGSEGV, Segmentation fault.
caml_darken (v=0, ignored=<optimized out>, state=<optimized out>) at major_gc.c:729
729	major_gc.c: No such file or directory.
(gdb) bt
#0  caml_darken (v=0, ignored=<optimized out>, state=<optimized out>) at major_gc.c:729
#1  0x0000555555728df3 in scan_native_globals (fdata=0x0, f=0x555555711ac0 <caml_darken>) at globroots.c:214
#2  caml_scan_global_roots (f=f@entry=0x555555711ac0 <caml_darken>, fdata=fdata@entry=0x0) at globroots.c:238
#3  0x0000555555712418 in cycle_all_domains_callback (domain=0x7ffff5a00000, unused=unused@entry=0x0, participating_count=participating_count@entry=1, participating=participating@entry=0x55555581e1e0 <stw_request+4160>) at major_gc.c:1055
#4  0x0000555555731112 in caml_try_run_on_all_domains_with_spin_work (handler=handler@entry=
    0x555555712350 <cycle_all_domains_callback>, data=data@entry=0x0, leader_setup=leader_setup@entry=0x0, enter_spin_callback=enter_spin_callback@entry=0x0, enter_spin_data=enter_spin_data@entry=0x0) at domain.c:873
#5  0x0000555555731330 in caml_try_run_on_all_domains_with_spin_work (enter_spin_data=0x0, enter_spin_callback=0x0, leader_setup=0x0, data=0x0, handler=0x555555712350 <cycle_all_domains_callback>) at domain.c:888
#6  0x0000555555713057 in major_collection_slice (howmuch=<optimized out>, participant_count=participant_count@entry=0, barrier_participants=barrier_participants@entry=0x0, mode=mode@entry=Slice_interruptible) at major_gc.c:1330
#7  0x00005555557131c8 in caml_major_collection_slice (howmuch=howmuch@entry=-1) at major_gc.c:1349
#8  0x000055555572f5f5 in caml_poll_gc_work () at domain.c:937
#9  0x0000555555710925 in caml_garbage_collection () at signals_nat.c:110
#10 0x0000555555732543 in caml_call_gc ()

kit-ty-kate avatar Jul 02 '21 17:07 kit-ty-kate

How do you compile this? I get:

In file included from ml_gpointer.c:31:
ml_gpointer.c: In function ‘ml_stable_copy’:
wrappers.h:38:33: error: ‘caml_young_end’ undeclared (first use in this function)
   38 |   (Is_block(v) && (value*)(v) < caml_young_end && (value*)(v) > caml_young_start)
      |                                 ^~~~~~~~~~~~~~

It looks like caml_young_end was removed in merge a141bc62165fe (GitHub's UI doesn't show it, but gitk does).

talex5 avatar Jul 14 '21 16:07 talex5

Merging #600 would fix this.

On Wed 14 Jul 2021 at 18:31, Thomas Leonard @.***> wrote:

How do you compile this? I get:

In file included from ml_gpointer.c:31:

ml_gpointer.c: In function ‘ml_stable_copy’:

wrappers.h:38:33: error: ‘caml_young_end’ undeclared (first use in this function)

38 | (Is_block(v) && (value*)(v) < caml_young_end && (value*)(v) > caml_young_start)

  |                                 ^~~~~~~~~~~~~~

It looks like caml_young_end was removed in merge a141bc6 https://github.com/ocaml-multicore/ocaml-multicore/commit/a141bc62165fef9154832a4c012f74ea3878c365 (GitHub's UI doesn't show it, but gitk does).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ocaml-multicore/ocaml-multicore/issues/609#issuecomment-880038416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDVAKCIHMKTUMST7Q6PM3TXW3WJANCNFSM47XDPN5A .

abbysmal avatar Jul 14 '21 16:07 abbysmal

Sorry indeed i was using +domains + #600, i forgot to mention

kit-ty-kate avatar Jul 14 '21 18:07 kit-ty-kate

I guess this bit won't work too well with multicore, right?

(* naked pointers *)
type optstring

let raw_null = snd (Obj.magic Nativeint.zero)

let optstring : string option -> optstring =
  function
      None -> raw_null
    | Some x -> Obj.magic x

https://github.com/garrigue/lablgtk/blob/lablgtk3/src/gpointer.ml#L35

talex5 avatar Jul 28 '21 11:07 talex5

This is most likely one of culprit, yes ^^"

kit-ty-kate avatar Jul 28 '21 11:07 kit-ty-kate