English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Dynlink and ocamlfind for camlp4 3.11?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-10-05 (13:31)
From: Gerd Stolpmann <gerd@g...>
Subject: Re: [Caml-list] Dynlink and ocamlfind for camlp4 3.11?

Am Sonntag, den 04.10.2009, 20:53 +0100 schrieb Conglun Yao:
>         In that case, try listing dynlink explicitly, like:
>          ocamlfind ocamlc dynlink.cma -package json-static [etc]
> $ ocamlfind ocamlc dynlink.cma -package json-static -syntax camlp4o -c
> test.ml
> $ ocamlfind ocamlc -I /home/conglun/godi/lib/ocaml/pkg-lib/camlp4
> dynlink.cma -package json-static -syntax camlp4o -c t.ml
> Error: Error while
> linking /home/conglun/godi/lib/ocaml/std-lib/camlp4/camlp4lib.cma(Camlp4):
> Reference to undefined global `Dynlink'
>         Anyhow, it sounds like a bug in the META files that are
>         supplied with
>         your cygwin OCaml distribution.
> I think you are right, the problem happens on the camlp4o or cygwin,
> which can't load dynlink.  But I can't find problem in the camlp4's
> META  (in the attachment)

While cygwin cannot load shared libraries from bytecode, it still can
load pure bytecode dynamically. It is reasonable that there is a
dynlink.cma for this case, and that camlp4lib.cma depends on it.

findlib has a special mode for platforms that cannot load shared
libraries dynamically. This mode seems to be broken  - it calls a script
safe_camlp4 instead of camlp4, and safe_camlp4 produces ad hoc a new
camlp4-type executable that includes the required C libraries - without
that trick you couldn't use json-static at all on these platforms:


The question is now whether the error is in this script (does it have to
add dynlink.cma anyway?) or whether mkcamlp4 is broken.

Can you try to change safe_camlp4 so the line

mkcamlp4 -o $tmp_camlp4 $cp4_mods || exit


mkcamlp4 -o $tmp_camlp4 dynlink.cma $cp4_mods || exit

? (I don't have a cygwin ocaml at hand.) safe_camlp4 should be in the
bin/ directory.

Gerd Stolpmann, Bad Nauheimer Str.3, 64289 Darmstadt,Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714