OCaml Forge
SCM

Detail: [#1071] `caml_cairo_set_line_width' is still not available

Bugs: Browse | Download .csv | Monitor

[#1071] `caml_cairo_set_line_width' is still not available

Date:
2011-12-15 14:46
Priority:
3
State:
Closed
Submitted by:
Dan Bensen (drakken)
Assigned to:
Christophe Troestler (chris)
Hardware:
PC
Resolution:
Works For Me
Severity:
normal
Version:
None
Component:
None
Operating System:
Linux
Product:
None
 
URL:
Summary:
`caml_cairo_set_line_width' is still not available

Detailed description
Still getting the error message described in my previous Support post (#1065).
When I compile to native code, the error message mentions "caml_cairo_set_line_cap".
Here are the command lines:

dan[benchplot]$ make byte
ocamlfind ocamlc -o benchplot.b -package archimedes -linkpkg -dllpath-all benchplot.ml

dan[benchplot]$ benchplot.b
Fatal error: exception Backend.Error(_, "The backend "cairo" is not loadable because:
error while linking /home/dan/.odb/lib/archimedes/archimedes_cairo.cma.
The external function `caml_cairo_set_line_width' is not available")

dan[benchplot]$ make native
ocamlfind ocamlopt -verbose -o benchplot.x -package archimedes,cairo2 -linkpkg benchplot.ml
Effective set of compiler predicates: pkg_dynlink,pkg_unix,pkg_bigarray,pkg_archimedes,pkg_cairo2,autolink,native
+ ocamlopt.opt -verbose -o benchplot.x -I /home/dan/.odb/lib/archimedes -I /home/dan/.odb/lib/cairo2 /usr/local/lib/ocaml/dynlink.cmxa /usr/local/lib/ocaml/unix.cmxa /usr/local/lib/ocaml/bigarray.cmxa /home/dan/.odb/lib/archimedes/archimedes.cmxa /home/dan/.odb/lib/cairo2/cairo2.cmxa benchplot.ml
+ as -o 'benchplot.o' '/tmp/camlasm5fe320.s'
+ as -o '/tmp/camlstartupc19398.o' '/tmp/camlstartupf4d6a9.s'
+ gcc -o 'benchplot.x' '-L/home/dan/.odb/lib/archimedes' '-L/home/dan/.odb/lib/cairo2' '-L/usr/local/lib/ocaml' -Wl,-E '/tmp/camlstartupc19398.o' '/usr/local/lib/ocaml/std_exit.o' 'benchplot.o' '/home/dan/.odb/lib/cairo2/cairo2.a' '/home/dan/.odb/lib/archimedes/archimedes.a' '/usr/local/lib/ocaml/bigarray.a' '/usr/local/lib/ocaml/unix.a' '/usr/local/lib/ocaml/dynlink.a' '/usr/local/lib/ocaml/stdlib.a' '-lcairo2' '-lcairo' '-lbigarray' '-lunix' '/usr/local/lib/ocaml/libasmrun.a' -lm -ldl

dan[benchplot]$ benchplot.x
Fatal error: exception Backend.Error(_, "The backend "cairo" is not loadable because:
error loading shared library: /home/dan/.odb/lib/archimedes/archimedes_cairo.cmxs: undefined symbol: caml_cairo_set_line_cap")

Followup

Message
Date: 2012-10-01 18:39
Sender: Christophe Troestler

Cannot reproduce. Please reopen giving more details if it does not work for you.
Date: 2012-01-06 19:39
Sender: Christophe Troestler

I do not have such problem (I tested the installation with odb).

dllcairo2.so is in ~/.odb/lib/stublibs/ (if you installed with odb, not sure with GODI). You must make sure the path is in /usr/lib/ocaml/ld.conf. (The [~dirs] argument is completely irrelevant for compilation, it is only an indication where to look for libraries at runtime — to enable portable programs if desired — and should normally not be used.)
Date: 2012-01-06 19:09
Sender: Dan Bensen

> Did you set OCAMLPATH=~/.odb/lib ?
Yes.
dan[benchplot]$ echo $OCAMLPATH
/home/dan/.odb/lib

Incidentally, I recently switched to a new GODI installation. I couldn't find any uninstall instructions in the INRIA download, so I just deleted /usr/lib/ocaml and anything else I could think of that was related to the original install.

Well, I commented out the ~dirs arg to init and the native code is working now.
(* ~dirs:["/home/dan/.odb/lib/archimedes";"/home/dan/.odb/lib/cairo2"] *)

But now I can't compile to bytecode, even after I added cairo2 to the package list in the makefile:

dan[benchplot]$ which ocamlfind
/home/dan/ocaml/godi/bin/ocamlfind
dan[benchplot]$ make byte
ocamlfind ocamlc -o benchplot.b -package archimedes,cairo2 -linkpkg -dllpath-all benchplot.ml
File "benchplot.ml", line 1, characters 0-1:
Error: Error on dynamically loaded library: dllcairo2.so: dllcairo2.so: cannot open shared object file: No such file or directory
make: *** [byte] Error 2
dan[benchplot]$ cat benchplot.ml
(*
#use "topfind";;
#require "str";;
#require "unix";;
#require "findlib";;
#require "archimedes";;
--OR--
ocamlfind ocamlc -package archimedes -linkpkg benchplot.ml
*)

module A = Archimedes;;

let plot () =
let vp = A.init ~w:300. ~h:400.
(* ~dirs:["/home/dan/.odb/lib/archimedes";"/home/dan/.odb/lib/cairo2"] *)
["Cairo"; "PNG"; "output.png"] in
A.Axes.box vp;
A.Array.y vp ~style:(`Bars 1.) [|20.; 23.; 18.; 21.|];
A.close vp

;;plot();;
dan[benchplot]$
Date: 2012-01-06 18:17
Sender: Christophe Troestler

I cannot reproduce your bug. Did you set OCAMLPATH=~/.odb/lib ?

Attached Files:

Changes:

Field Old Value Date By
status_idOpen2012-10-01 18:39chris
close_dateNone2012-10-01 18:39chris
ResolutionAwaiting Response2012-10-01 18:39chris
ResolutionNone2012-01-06 18:17chris
assigned_tonone2012-01-06 18:17chris