Thank you all for the answers. Finally i managed to make my whole project portable. I didn't manage to successfully create it since the beginning  because the my makefile was still using ocamlc for certain files, and I didn't notice this before.

Regards,
Andreea

On Tue, Nov 1, 2011 at 11:42 PM, David MENTRE <dmentre@linux-france.org> wrote:
Hello,

2011/10/31 David Allsopp <dra-news@metastack.com>:
> Compile it with ocamlopt instead of ocamlc - Chapter 11 of the manual (which it's a little surprising you hadn't got to, if you've been looking for a few days)... http://caml.inria.fr/pub/docs/manual-ocaml/manual025.html
>
> "This chapter describes the OCaml high-performance native-code compiler ocamlopt, which compiles Caml source files to native code object files and link these object files to produce standalone executables."

Depending on the level of independence one might want on the
underlying system, ocamlopt alone might not me enough, as C libraries
are still dynamically linked. Option "-ccopt -static" is needed to
produce real statically linked binaries. Some parts of the OCaml
runtime may not work when statically linked, YMMV.

Example:

$ cat hello.ml
open Format

let _ = printf "Hello@\n"


$ ocamlopt hello.ml

$ ./a.out
Hello

$ ldd ./a.out
       linux-vdso.so.1 =>  (0x00007fff127e7000)
       libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007faf7ca80000)
       libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007faf7c87c000)
       libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007faf7c4e7000)
       /lib64/ld-linux-x86-64.so.2 (0x00007faf7cd2a000)

$ ocamlopt -ccopt -static hello.ml

$ ./a.out
Hello

$ ldd ./a.out
       not a dynamic executable

$ file ./a.out
./a.out: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux),
statically linked, for GNU/Linux 2.6.15, not stripped


Best regards,
david