On Sat, 2007-05-19 at 17:36 +0100, Richard W.M. Jones wrote:
Toshio Kuratomi wrote:
> I think, if the ocaml compiler doesn't support dynamic libraries, static
> linking would be acceptable. This doesn't mean that we shouldn't press
> upstream to add dynamic linking (and convert all our packages when that
> becomes available) just an acknowledgment that fixing the limitation has
> to be done upstream (it could be done by someone within Fedora but the
> fix needs to go upstream).
>
> This is similar to allowing C libraries in even if they only build
> statically.
>
> If I'm not understanding precisely what the limitation is, feel free to
> clarify.
There are two issues here: (a) Having OCaml binaries link dynamically
instead of statically to OCaml libraries. (b) Writing a dynamic library
in OCaml, and having it used by programs written in other languages,
particularly C.
I suspect it's unlikely that upstream will do (a), ever. There's a
technical issue. OCaml really doesn't have a concept of an ABI. It
does a kind of whole-program optimisation where even changes to the
internal implementation of a library can affect the resulting binary.
Moreover even if you "fixed" that, any change whatsoever to the
library's signature or the version of compiler it was built with (even
bugfix releases which have the same version number) will make the
library incompatible.
You might also find this entertaining:
http://caml.inria.fr/pub/ml-archives/caml-list/2004/05/775714fbf05c17e0cb...
Another issue which Xavier doesn't mention is the ability to fix a
security bug in a shared library, and not require all dependent
applications be recompiled. Well, there aren't many (any?) widely used
OCaml libraries, and there aren't a lot of binaries which would need to
be recompiled either. But it could be a problem for OCaml world
domination plans.
As for (b), the ability to write libraries in a sane language and have
them called through a C API: This almost works. Well, it works well on
i386, but there are some problems on x86-64. I'm looking forward to
having this. It needs some tools to make it work well - it would be
nice to have the C header files and the complex Makefile fragments to
get it to work generated automatically.
Could you add something to
http://fedoraproject.org/wiki/PackagingDrafts/OCaml
about this? I'd imagine we'd need to say something like "OCaml packages
must have a strict Requires: on the version and release of ocaml" with
some examples. And something should be said about rebuilding OCaml
packages when libraries they depend on are updated as well so that
security problems and bugfixes are incorporated into the new package.
Thanks,
-Toshio