[ocaml-ctypes] libffi compatibility

Phil Hagelberg phil at hagelb.org
Thu Oct 3 18:22:24 BST 2013


I'm preparing to distribute my ctypes-using project to folks who don't
have OCaml installed, so I'm compiling a .native executable.

Most of what I read about distributing OCaml is that for native binaries
you can compile it on any 64-bit Linux system, and it should work on any
other 64-bit Linux. But I get the feeling libffi complicates things a
bit; my Debian-compiled binary refuses to run on newer Ubuntus ("error
while loading shared libraries: libffi.so.5: cannot open shared object
file") and straight up segfaults on Fedora 19.

So I'm guessing I'll need to compile separately for each
distribution/version I want to support? Are there any tools to make this
process more streamlined? I briefly looked at the OpenSuSE Build
Service[1], but it looks pretty complicated. What about different
versions of Mac OS X?

Also on a somewhat-related note, I have this to find the readline library:

  let libreadline = Dl.(dlopen ~filename:"libreadline.so" ~flags:[RTLD_NOW])

However, the ".so" needs to be replaced with ".dylib" for Mac OS X
compatibility. Is there a recommended way to specify dlopen filenames
portably, or should I just catch the exception and try to fall back to
.dylib if it can't find the .so?

thanks,
Phil

[1] - http://build.opensuse.org
-------------- 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/20131003/753d3909/attachment.sig>


More information about the Ctypes mailing list