Re: Cairo/GTK and cube example
Olivier Andrieu <[email protected]> Tue, 14 Sep 2010 13:47:05 +0200
| Newsgroups | gmane.comp.lang.ocaml.lib.gtk |
|---|---|
| Message-ID | <[email protected]> |
Hi ! On Tue, Sep 14, 2010 at 11:50, Johan Mazel <[email protected]> wrote: > Hi > I'm trying to use Cairo and GTK. > As a first step, I tried to compile and understand the cube example given at > this address: http://webcvs.cairographics.org/cairo-ocaml/test/. btw the current code is in the git repository, not CVS: http://cgit.freedesktop.org/cairo-ocaml/ > I use this line for the native compilation: ocamlopt -I +lablgtk2 -I +cairo > lablgtk.cmxa cairo.cmxa cairo_lablgtk.cmxa cube.ml -o cube. > > The first problem is that the bytecode compilation do not work: > ocamlc -I +lablgtk2 -I +cairo lablgtk.cma cairo.cma cairo_lablgtk.cma > cube.ml -o cube > File "cube.ml", line 1, characters 0-1: > Error: Error on dynamically loaded library: > /usr/lib/ocaml/stublibs/dllmlcairo.so: > /usr/lib/ocaml/stublibs/dllmlcairo.so: undefined symbol: caml_ba_byte_size This looks like some binary incompatibility between ocaml and your cairo-ocaml binary. caml_ba_byte_size is a symbol from the Bigarray library that got renamed at some point. Did you compile cairo-ocaml yourself ? If no, you have to ensure that you're using it with the same OCaml version that compiled it. > I however tried to run the native executable generated but I get the > following error: > (process:6496): GLib-GObject-WARNING **: invalid (NULL) pointer instance > (process:6496): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion > `G_TYPE_CHECK_INSTANCE (instance)' failed > (process:6496): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion > `GDK_IS_SCREEN (screen)' failed > (process:6496): Pango-CRITICAL **: pango_context_set_font_description: > assertion `context != NULL' failed > (process:6496): Pango-CRITICAL **: pango_context_set_base_dir: assertion > `context != NULL' failed > (process:6496): Pango-CRITICAL **: pango_context_set_language: assertion > `context != NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_new: assertion `context != > NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_set_text: assertion `layout > != NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_get_pixel_extents: assertion > `PANGO_IS_LAYOUT (layout)' failed > (process:6496): Pango-CRITICAL **: pango_layout_set_text: assertion `layout > != NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_get_pixel_extents: assertion > `PANGO_IS_LAYOUT (layout)' failed > (process:6496): GLib-GObject-CRITICAL **: g_object_unref: assertion > `G_IS_OBJECT (object)' failed > (process:6496): Gtk-WARNING **: Screen for GtkWindow not set; you must > always set > a screen for a GtkWindow before using the window > (process:6496): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion > `GDK_IS_SCREEN (screen)' failed > (process:6496): Pango-CRITICAL **: pango_context_set_font_description: > assertion `context != NULL' failed > (process:6496): Pango-CRITICAL **: pango_context_set_base_dir: assertion > `context != NULL' failed > (process:6496): Pango-CRITICAL **: pango_context_set_language: assertion > `context != NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_new: assertion `context != > NULL' failed > (process:6496): GLib-GObject-CRITICAL **: g_object_unref: assertion > `G_IS_OBJECT (object)' failed > (process:6496): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: assertion > `GDK_IS_SCREEN (screen)' failed > (process:6496): Pango-CRITICAL **: pango_context_set_font_description: > assertion `context != NULL' failed > (process:6496): Pango-CRITICAL **: pango_context_set_base_dir: assertion > `context != NULL' failed > (process:6496): Pango-CRITICAL **: pango_context_set_language: assertion > `context != NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_new: assertion `context != > NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_set_text: assertion `layout > != NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_set_alignment: assertion > `layout != NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_set_ellipsize: assertion > `PANGO_IS_LAYOUT (layout)' failed > (process:6496): Pango-CRITICAL **: pango_layout_set_single_paragraph_mode: > assertion `PANGO_IS_LAYOUT (layout)' failed > (process:6496): Pango-CRITICAL **: pango_layout_set_width: assertion `layout > != NULL' failed > (process:6496): Pango-CRITICAL **: pango_layout_get_extents: assertion > `layout != NULL' failed > (process:6496): Gdk-CRITICAL **: gdk_screen_get_default_colormap: assertion > `GDK_IS_SCREEN (screen)' failed > (process:6496): Gdk-CRITICAL **: gdk_colormap_get_visual: assertion > `GDK_IS_COLORMAP (colormap)' failed > (process:6496): Gdk-CRITICAL **: gdk_screen_get_default_colormap: assertion > `GDK_IS_SCREEN (screen)' failed > (process:6496): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion > `GDK_IS_SCREEN (screen)' failed > (process:6496): Gdk-CRITICAL **: gdk_screen_get_root_window: assertion > `GDK_IS_SCREEN (screen)' failed > (process:6496): Gdk-CRITICAL **: gdk_window_new: assertion `GDK_IS_WINDOW > (parent)' failed > Erreur de segmentation probably simply the gtk initialization missing. Add gtkInit.cmx before cube.ml while linking. -- Olivier