garrigue/lablgtk

lablgtk3 fails to compile with OCaml 4.10 [pre-release]

Closed this issue · 3 comments

Changes in the runtime produce this error:

      ocamlc src/ml_gpointer.o (exit 2)
(cd _build/default/src && /home/egallego/.opam/4.10.0+trunk/bin/ocamlc.opt -g -I /home/egallego/.opam/4.10.0+trunk/lib/cairo2 -I /home/egallego/.opam/4.10.0+trunk/lib/ocaml/threads -ccopt -pthread -ccopt -I/usr/include/gtk-3.0 -ccopt -I/usr/include/at-spi2-atk/2.0 -ccopt -I/usr/include/at-spi-2.0 -ccopt -I/usr/include/dbus-1.0 -ccopt -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -ccopt -I/usr/include/gtk-3.0 -ccopt -I/usr/include/gio-unix-2.0 -ccopt -I/usr/include/cairo -ccopt -I/usr/include/libdrm -ccopt -I/usr/include/pango-1.0 -ccopt -I/usr/include/harfbuzz -ccopt -I/usr/include/pango-1.0 -ccopt -I/usr/include/fribidi -ccopt -I/usr/include/atk-1.0 -ccopt -I/usr/include/cairo -ccopt -I/usr/include/pixman-1 -ccopt -I/usr/include/freetype2 -ccopt -I/usr/include/libpng16 -ccopt -I/usr/include/gdk-pixbuf-2.0 -ccopt -I/usr/include/libmount -ccopt -I/usr/include/blkid -ccopt -I/usr/include/uuid -ccopt -I/usr/include/glib-2.0 -ccopt -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -ccopt -Wno-deprecated-declarations -ccopt -g -o ml_gpointer.o ml_gpointer.c)
In file included from /home/egallego/.opam/4.10.0+trunk/lib/ocaml/caml/mlvalues.h:20,
                 from ml_gpointer.c:25:
/home/egallego/.opam/4.10.0+trunk/lib/ocaml/caml/compatibility.h:245:32: error: expected ‘)’ before ‘->’ token
 #define young_start (Caml_state->_young_start)
                                ^~
wrappers.h:36:18: note: in expansion of macro ‘young_start’
 CAMLextern char *young_start, *young_end; /* from minor_gc.h */
                  ^~~~~~~~~~~
ml_gpointer.c: In function ‘ml_stable_copy’:
ml_gpointer.c:36:35: warning: comparison of distinct pointer types lacks a cast
     if (Is_block(v) && (char*)(v) < young_end && (char*)(v) > young_start)
                                   ^
ml_gpointer.c:36:61: warning: comparison of distinct pointer types lacks a cast
     if (Is_block(v) && (char*)(v) < young_end && (char*)(v) > young_start)

There are two problems:

  • In wrappers.h we redefine young_start and young_end; this was required in the past, but results in an error with 4.10. Removing conditionally the definition seems ok. Actually, I'm not even sure it is required for older versions.
  • In ml_gtktree.c, there is an error on caml_young_start and caml_young_end, which seems to be due to a typo in 4.10. See my PR.

It seems that ocaml exports minor_gc.h since at least 4.05 (it was not exported in 4.03), so there seems to be no need to keep the definitions of young_start and young_end.

Fixed in master and lablgtk3 by #93 and #97