[ocaml-ctypes] libffi compatibility

Phil Hagelberg phil at hagelb.org
Tue Oct 8 23:39:43 BST 2013

Anil Madhavapeddy writes:

> It's probably best to embed a -cclib -lreadline that will cause the
> system linker to do the right thing, rather than dlopen it manually.

I tried this[1], and it works great on my primary Debian system, but when I
try compiling it on Ubuntu (with libffi6 instead of libffi5; not sure if
that's relevant), the compilation succeeds, but I get this when I try to
run the program:

    Fatal error: exception Dl.DL_error("grench: undefined symbol: readline")
    Raised at file "src/dl.ml", line 42, characters 26-44
    Called from file "src/foreign.ml", line 18, characters 25-53

The native binary I compiled on my Debian libffi5 system doesn't work on
newer Ubuntu systems with libffi6. Do I need a different binary for each
version of libffi I want to target on Linux, or is it one for each
distro release?

I'm very new to C libraries, so I'm probably missing something obvious,
but it's not working how I expected.


[1] - $ ocamlbuild -use-ocamlfind -lflags -cclib,-lreadline grench.native
    on https://github.com/technomancy/grenchman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.ocaml.org/pipermail/ctypes/attachments/20131008/9209dcd9/attachment.sig>

More information about the Ctypes mailing list