OCaml and static linking (was old thread: Re: [Fedora-packaging] Issues with Ocaml and Static Linking)
David Woodhouse
dwmw2 at infradead.org
Sun May 20 12:15:06 UTC 2007
On Sat, 2007-05-19 at 17:36 +0100, Richard W.M. Jones wrote:
> >> So my main question is "where to from here?"
> >
> > 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).
Yes, I'm inclined to agree. I do find that the lack of debugging
information is a problem though -- I'm trying to chase a SEGV in
freetennis on ppc64 and I can't even tell which function it's in.
> > 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.
Our current package scheme doesn't handle this at all, does it? Should
our ocaml-*-devel packages have runtime Requires: on the precise n-v-r
of ocaml used to build them?
> 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.
Er, some of the core ocaml runtime is written in C. If you don't have
calls to the C API working, you can't spit out native code at all.
Or do you mean something special for _dynamic_ libraries... which
shouldn't really be anything special.
I was just about to hack the ppc64 output to generate dynamic libraries
just to make debugging treetennis easier...
--
dwmw2
More information about the devel
mailing list