Delivered-To: garrigue at math.nagoya-u.ac.jp Authentication-Results: mailhost.math.nagoya-u.ac.jp sender=lablgtk-bounces at yquem.inria.fr; domainkey=neutral (no query protocol specified; no policy for yquem.inria.fr) Delivered-To: lablgtk at yquem.inria.fr DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=VTUJxJtwHSJtbm9YgbwvRTG5/c61ZlmyL+ftJKnmnCI=; b=Mdaztw+0WenK6jT2ThFgpnbxxsMQ6vCQQJDWvBiox/7Wmgs33WBcte8CKNcxuriEmr O75eazZfr/GV8SeCup43z9UqhD6ywM+NTKCsiSEn3iMw4pRU98VCJ11N4KoF5l2t2hdB AytTfr+qfa4xwXGlpsscRSCKdnpx/CDR0UOr0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=uCVhU1X0bqFMv1B9JSsEcNe/iLMvT1/ij/dcxffMdn/egWJ3lcgxEXmcXCBLsjT1jK Hm3dYwsnaNXwnZ7NcljuedjNoeYkut1aK9g4DwdSyFR11HPXy+mGUT2VgHB6W/V1ti7m g7wvN1lExuExCTSAp+N/5Gjv0NTxYG1DriWyI= MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 14 Sep 2010 14:18:27 +0200 Message-ID: Subject: Re: [Lablgtk] Cairo/GTK and cube example From: Johan Mazel To: Olivier Andrieu Cc: lablgtk at yquem.inria.fr Content-Type: multipart/mixed; boundary="===============2077295851==" Mime-version: 1.0 Status: U --===============2077295851== Content-Type: multipart/alternative; boundary=0015175ce0c6d76b3504903735af --0015175ce0c6d76b3504903735af Content-Type: text/plain; charset=ISO-8859-1 2010/9/14 Olivier Andrieu > Hi ! > > On Tue, Sep 14, 2010 at 11:50, Johan Mazel 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/cair gito-ocaml/ > I figured from the link http://webcvs.cairographics.org/cairo-ocaml/ that the project might have been moved somewhere else but since your personnal webpage was still linking to FreeDesktop and since I was lazy, I didn't search in the page http://cgit.freedesktop.org/. > > 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 > That was the problem, thanks for the fast answer. Regards. Johan Mazel --0015175ce0c6d76b3504903735af Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

2010/9/14 Olivier Andrieu <oandrieu@gmail.com>
Hi !

On Tue, Sep 14, 2010 at 11:50, Johan Mazel <johan.mazel@gmail.com> wrote:
> Hi
> I'm trying to use Cairo and GTK.
> As a first step, I tried to compile and understand the cube example gi= ven 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/cair gito-ocaml/

I fig= ured from the link http://webcvs.cairographics.org/cairo-ocaml/ that the project might ha= ve been moved somewhere else but since your personnal webpage was still lin= king to FreeDesktop and since I was lazy, I didn't search in the page <= a href=3D"http://cgit.freedesktop.org/">http://cgit.freedesktop.org/.
=A0
> 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<= br> > cube.ml -o cube
> File "cube.ml&qu= ot;, 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 instan= ce
> (process:6496): GLib-GObject-CRITICAL **: g_signal_connect_data: asser= tion
> `G_TYPE_CHECK_INSTANCE (instance)' failed
> (process:6496): Gdk-CRITICAL **: gdk_pango_context_get_for_screen: ass= ertion
> `GDK_IS_SCREEN (screen)' failed
> (process:6496): Pango-CRITICAL **: pango_context_set_font_description:=
> assertion `context !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_context_set_base_dir: asserti= on
> `context !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_context_set_language: asserti= on
> `context !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_new: assertion `contex= t !=3D
> NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_set_text: assertion `l= ayout
> !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_get_pixel_extents: ass= ertion
> `PANGO_IS_LAYOUT (layout)' failed
> (process:6496): Pango-CRITICAL **: pango_layout_set_text: assertion `l= ayout
> !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_get_pixel_extents: ass= ertion
> `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: ass= ertion
> `GDK_IS_SCREEN (screen)' failed
> (process:6496): Pango-CRITICAL **: pango_context_set_font_description:=
> assertion `context !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_context_set_base_dir: asserti= on
> `context !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_context_set_language: asserti= on
> `context !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_new: assertion `contex= t !=3D
> 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: ass= ertion
> `GDK_IS_SCREEN (screen)' failed
> (process:6496): Pango-CRITICAL **: pango_context_set_font_description:=
> assertion `context !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_context_set_base_dir: asserti= on
> `context !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_context_set_language: asserti= on
> `context !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_new: assertion `contex= t !=3D
> NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_set_text: assertion `l= ayout
> !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_set_alignment: asserti= on
> `layout !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_set_ellipsize: asserti= on
> `PANGO_IS_LAYOUT (layout)' failed
> (process:6496): Pango-CRITICAL **: pango_layout_set_single_paragraph_m= ode:
> assertion `PANGO_IS_LAYOUT (layout)' failed
> (process:6496): Pango-CRITICAL **: pango_layout_set_width: assertion `= layout
> !=3D NULL' failed
> (process:6496): Pango-CRITICAL **: pango_layout_get_extents: assertion=
> `layout !=3D NULL' failed
> (process:6496): Gdk-CRITICAL **: gdk_screen_get_default_colormap: asse= rtion
> `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: asse= rtion
> `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_WIN= DOW
> (parent)' failed
> Erreur de segmentation

probably simply the gtk initialization missing. Add gtkInit.cmx= before
cube.ml while linking.

--
=A0Olivier

That wa= s the problem, thanks for the fast answer.

Regards.
Johan Mazel

--0015175ce0c6d76b3504903735af-- --===============2077295851== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Lablgtk mailing list Lablgtk@yquem.inria.fr http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk --===============2077295851==--