Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
mostly static ocaml binaries
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Olivier Andrieu <oandrieu@n...>
Subject: Re: [Caml-list] mostly static ocaml binaries

On 5/18/07, Basile STARYNKEVITCH <> wrote:
> Dear All
> I would like to know how to make ocaml with mostly static binaries.
> My motivation is the following: I want to code some dynamic web site but
> my small hosting company provide only a very basic linux system. In
> particular even the /usr/lib/ is not available.
> So I would like to develop an application which only has as dynamic
> library the very common ones like and no much more.
> I know that the request is not very common, I am not familiar enough
> with Ocaml linking of C libraries ...

it's possible: when you're building the library, instead of specifying
the C library to link as -lpcre, specify the static lib directly, eg:
    ocamlopt -a -o pcre.cmxa ... -cclib /usr/lib/libpcre.a
and then link your application as usual (and add the -verbose flag to
ocamlopt to check what's going on exactly).

If you don't want to re-build the caml pcre library, you could also
use the -noautolink flag I think:
    ocamlopt -o my_app pcre.cmxa -noautolink -cclib /usr/lib/libpcre.a
my_app.cmx ...