On Thu, 28 Jul 2011 14:43:58 +0200
ben mailist <[email protected]> wrote:

> I try to staticall link all necessary libraries to create a standalone
> labltk application. So that it is no longer necessary to install the tcl/tk
> runtime on the target machine.
> [...]
>     $ ocamlopt -o lb -linkall  -I +labltk labltk.cmxa listbox01.ml

-linkall links in all ocaml modules, it has nothing to do with linking of 
external libraries.
In order to link everything statically you need to ask C linker to do so - the 
simplest way is
to use `-ccopt -static` but that means linking in libc which is not good 
usually. More involved and 
correct way is to wrap all external libraries with `-Wl,-Bstatic -lxxx 
-Wl,-Bdynamic` on command-line.
Note that using `ocamlopt -ccopt -Wl,-Bstatic <all arguments> -ccopt 
-Wl,-Bdynamic` (to wrap all libs
at once) will not usually work as ocamlopt reorders `-ccopt` at will :( Use 
`-verbose` to check what is
being passed to gcc.

-- 
 ygrek
 http://ygrek.org.ua

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to