Install old Cairo with Opam

I would like to compile caboodle-0.5 that requires lablgtk2 and an old cairo.
Seems like a 4.05.0 switch could be a good option.
opam install lablgtk did work fine, but I get an error with opam install cairo:

$ tail -15 /mnt/sda5/_opam/log/cairo-26266-6cc03f.out
ocamlc.opt -ccopt "-g -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/libxml2 -I/usr/include/libdrm -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libmount -I/usr/include/blkid -pthread  -I/mnt/sda5/_opam/4.05.0/lib/lablgtk2" ml_cairo_lablgtk.c
In file included from /mnt/sda5/_opam/4.05.0/lib/lablgtk2/wrappers.h:36,
                 from ml_cairo_lablgtk.c:14:
/mnt/sda5/_opam/4.05.0/lib/ocaml/caml/minor_gc.h: Dans la fonction « add_to_ephe_ref_table »:
/mnt/sda5/_opam/4.05.0/lib/ocaml/caml/minor_gc.h:102:3: warning: déclaration implicite de la fonction « Assert »; vouliez-vous utiliser « assert » ? [-Wimplicit-function-declaration]
   Assert(ephe_ref->offset < Wosize_val(ephe_ref->ephe));
ocamlmklib -o cairo_lablgtk -oc mlcairo_lablgtk ml_cairo_lablgtk.o
ocamlc.opt -c -I /mnt/sda5/_opam/4.05.0/lib/lablgtk2 /mnt/sda5/_opam/4.05.0/lib/lablgtk2/
File "/mnt/sda5/_opam/4.05.0/lib/lablgtk2/", line 1:
Error: I/O error: /mnt/sda5/_opam/4.05.0/lib/lablgtk2/pango.cmi: Read-only file system
make[1]: *** [../Makefile.rules:2: /mnt/sda5/_opam/4.05.0/lib/lablgtk2/pango.cmo] Error 2
make[1] : on quitte le répertoire « /mnt/sda5/_opam/4.05.0/.opam-switch/build/cairo.1.2.0/src »
make: *** [Makefile:3: all] Error 2

The file system is not read-only:

$ ll ~/.opam/4.05.0/lib/lablgtk2/
-rw-r--r-- 1 bp bp 9,9K juin  19 17:37 /mnt/sda5/_opam/4.05.0/lib/lablgtk2/
$ ll ~/.opam/4.05.0/lib/lablgtk2/pango.cmi
-rw-r--r-- 1 bp bp 13K nov.  12 22:14 /mnt/sda5/_opam/4.05.0/lib/lablgtk2/pango.cmi

That’s probably a consequence of opam’s sandbox, which prevents the build system of cairo from writing outside of its installation directory (here, it looks like cairo is trying to write in lablgtk’s directory, which does look suspicious).

1 Like

The package’s webpage reports that the package cairo.1.2.0 was installed 28 times last month. I was wondering how was reported install failures to it seems that there is not difference between an install success and an install failure.

I would like to fix the issue, but now I’m unable to download the sources from the url provided in the opam file:

Found another tarball from, but checksum are not the same:

75bf7eb95045c1dba2733d7107b7b218  cairo-ocaml-1.2.0.tar.gz
1e64796e6aece2c709c97ed3896a0cd1  cairo-ocaml_1.2.0.orig.tar.gz

I was able to compile and install cairo-ocaml from this source (debian .orig) and the diagnosis from @Armael was right, indeed cairo-ocaml is trying to access lablgtk2’s install directory. While installing cairo-ocaml from sources it’s able to do so since opam installs in user space.

I was finally able to compile caboodle-0.5 with a 4.05.0 switch, thanks!