Version française
Home     About     Download     Resources     Contact us    
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
Hi,

On 5/18/07, Basile STARYNKEVITCH <basile@starynkevitch.net> 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/libpcre.so is not available.
>
> So I would like to develop an application which only has as dynamic
> library the very common ones like libc.so libm.so libdl.so 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 ...

HTH,
-- 
  Olivier