I have a large OCaml project which I am compiling with ocamlbuild. Everything works fine, I have a great executable which does everything as I want. The problem is that when I take that native executable "my_prog.native" and run it somewhere else (different machine with same operating system, etc.), the new machine complaints that it can't find camomile (which is used in a Batteries library I'm using). I thought the executable we got from ocamlbuild was standalone and didn't require OCaml or Camomile to be present in the machine we ran it, but that doesn't seem to be the case.
Any ideas on how to produce really standalone executables?
Most OCaml code is statically linked. There are two things which are linked dynamically:
dllfoo.so
, corresponding to libfoo.a
. If you have a libfoo.a
, I think it will use that rather than dllfoo.so
for native code.libc
, or libgtk
used by lablgtk
, etc.).Further, Camomile dynamically loads some of its Unicode data, which is a special case that does not fall into standard OCaml linking. You'll have to consult the Camomile documentation to find a way to statically embed that data.
To the best of my knowledge, Camomile is dynamically loaded at runtime, so the easiest thing to do would be to provide the DLL/shared object along with your executable.
You could try forcing a static link, but this would contaminate your application with the LGPL license.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With