caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* mostly static ocaml binaries
@ 2007-05-18 16:02 Basile STARYNKEVITCH
  2007-05-18 16:47 ` [Caml-list] " Richard Jones
  2007-05-25  7:32 ` Olivier Andrieu
  0 siblings, 2 replies; 3+ messages in thread
From: Basile STARYNKEVITCH @ 2007-05-18 16:02 UTC (permalink / raw)
  To: caml-list

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 ...

BTW, those developing tools in Ocaml for Web might also consider this 
small issue: some small web hosting companies (those costing a few euros 
or dollars each month) offer only very few shared libraries, and most of 
the libraries used by such Ocaml web applications should be statically 
linked. It may sound strange, but it is true.

Oh, did I forgot to tell that I hate PHP?

Regards.


-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faïencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] mostly static ocaml binaries
  2007-05-18 16:02 mostly static ocaml binaries Basile STARYNKEVITCH
@ 2007-05-18 16:47 ` Richard Jones
  2007-05-25  7:32 ` Olivier Andrieu
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Jones @ 2007-05-18 16:47 UTC (permalink / raw)
  To: Basile STARYNKEVITCH; +Cc: caml-list

On Fri, May 18, 2007 at 06:02:47PM +0200, Basile STARYNKEVITCH wrote:
> 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.

Just a thought, but how about keeping the shared libraries in (eg)
your home directory or another writable place, and using
$LD_LIBRARY_PATH to cause them to be loaded into the process.  If this
works then at least you won't need to change how OCaml binaries get
built.

  LD_LIBRARY_PATH=$HOME/mylibs ./mywebapp

(or if using CGI, try a wrapper script or Apache SetEnv).

> Oh, did I forgot to tell that I hate PHP?

It's horrible.

Rich.

-- 
Richard Jones
Red Hat


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] mostly static ocaml binaries
  2007-05-18 16:02 mostly static ocaml binaries Basile STARYNKEVITCH
  2007-05-18 16:47 ` [Caml-list] " Richard Jones
@ 2007-05-25  7:32 ` Olivier Andrieu
  1 sibling, 0 replies; 3+ messages in thread
From: Olivier Andrieu @ 2007-05-25  7:32 UTC (permalink / raw)
  To: Basile STARYNKEVITCH; +Cc: caml-list

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-25  7:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-05-18 16:02 mostly static ocaml binaries Basile STARYNKEVITCH
2007-05-18 16:47 ` [Caml-list] " Richard Jones
2007-05-25  7:32 ` Olivier Andrieu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).