caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Is there a way to statically link an ocaml app compiled to native code against glibc?
@ 2007-11-29  0:06 Eric Merritt
  2007-11-29  0:18 ` [Caml-list] " Gerd Stolpmann
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Merritt @ 2007-11-29  0:06 UTC (permalink / raw)
  To: caml-list

Everyone,

 I have spent quite a bit of time digging around for this on the net
with now luck. We have a pretty simple ocaml app for which we would
like to distribute an executable binary. For the most part this works.
However, we would like to minimize the number of binaries that we are
forced to distribute. We would also like to avoid any confusion on the
part of our users around figuring out which version of glibc they are
using. For example, we would like to avoid distributing a binary for
each version of glibc available. Its more work for us and has a chance
of confusing some of the folks using our work. Considering the
simplicity of our binary it seems like a good solution would be to be
to just statically link against glibc (our only non-ocaml dependency).
So it would be great if someone could give me pointers to docs that
describe how to do this. Extra points if I can easily do this with
OCamlMakefile.  If there is another way to accomplish our goals I am
more then willing to entertain them, as there are a lot of potential
problems involved with static linking against glibc.

Thanks,
 Eric


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

* Re: [Caml-list] Is there a way to statically link an ocaml app compiled to native code against glibc?
  2007-11-29  0:06 Is there a way to statically link an ocaml app compiled to native code against glibc? Eric Merritt
@ 2007-11-29  0:18 ` Gerd Stolpmann
  2007-11-29  5:14 ` Garrett Jones
  2007-11-29  9:36 ` Sylvain Le Gall
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Stolpmann @ 2007-11-29  0:18 UTC (permalink / raw)
  To: Eric Merritt; +Cc: caml-list

Am Mittwoch, den 28.11.2007, 16:06 -0800 schrieb Eric Merritt:
> Everyone,
> 
>  I have spent quite a bit of time digging around for this on the net
> with now luck. We have a pretty simple ocaml app for which we would
> like to distribute an executable binary. For the most part this works.
> However, we would like to minimize the number of binaries that we are
> forced to distribute. We would also like to avoid any confusion on the
> part of our users around figuring out which version of glibc they are
> using. For example, we would like to avoid distributing a binary for
> each version of glibc available. Its more work for us and has a chance
> of confusing some of the folks using our work. Considering the
> simplicity of our binary it seems like a good solution would be to be
> to just statically link against glibc (our only non-ocaml dependency).
> So it would be great if someone could give me pointers to docs that
> describe how to do this. Extra points if I can easily do this with
> OCamlMakefile.  If there is another way to accomplish our goals I am
> more then willing to entertain them, as there are a lot of potential
> problems involved with static linking against glibc.

Install some oldish distro somewhere, and link against glibc-2.1. This
should run everywhere. At least, this is what the glibc people say about
the compatibility of their library.

Gerd
-- 
------------------------------------------------------------
Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714
------------------------------------------------------------


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

* Re: [Caml-list] Is there a way to statically link an ocaml app compiled to native code against glibc?
  2007-11-29  0:06 Is there a way to statically link an ocaml app compiled to native code against glibc? Eric Merritt
  2007-11-29  0:18 ` [Caml-list] " Gerd Stolpmann
@ 2007-11-29  5:14 ` Garrett Jones
  2007-11-29  9:36 ` Sylvain Le Gall
  2 siblings, 0 replies; 4+ messages in thread
From: Garrett Jones @ 2007-11-29  5:14 UTC (permalink / raw)
  To: Eric Merritt; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 1639 bytes --]

(resending to include the list)

This setting works for me with OCamlMakefile:

LDFLAGS = -Wl,-Bstatic

On Nov 28, 2007 4:06 PM, Eric Merritt <cyberlync@gmail.com> wrote:

> Everyone,
>
>  I have spent quite a bit of time digging around for this on the net
> with now luck. We have a pretty simple ocaml app for which we would
> like to distribute an executable binary. For the most part this works.
> However, we would like to minimize the number of binaries that we are
> forced to distribute. We would also like to avoid any confusion on the
> part of our users around figuring out which version of glibc they are
> using. For example, we would like to avoid distributing a binary for
> each version of glibc available. Its more work for us and has a chance
> of confusing some of the folks using our work. Considering the
> simplicity of our binary it seems like a good solution would be to be
> to just statically link against glibc (our only non-ocaml dependency).
> So it would be great if someone could give me pointers to docs that
> describe how to do this. Extra points if I can easily do this with
> OCamlMakefile.  If there is another way to accomplish our goals I am
> more then willing to entertain them, as there are a lot of potential
> problems involved with static linking against glibc.
>
> Thanks,
>  Eric
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

[-- Attachment #2: Type: text/html, Size: 2219 bytes --]

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

* Re: Is there a way to statically link an ocaml app compiled to native code against glibc?
  2007-11-29  0:06 Is there a way to statically link an ocaml app compiled to native code against glibc? Eric Merritt
  2007-11-29  0:18 ` [Caml-list] " Gerd Stolpmann
  2007-11-29  5:14 ` Garrett Jones
@ 2007-11-29  9:36 ` Sylvain Le Gall
  2 siblings, 0 replies; 4+ messages in thread
From: Sylvain Le Gall @ 2007-11-29  9:36 UTC (permalink / raw)
  To: caml-list

On 29-11-2007, Eric Merritt <cyberlync@gmail.com> wrote:
> Everyone,
>
>  I have spent quite a bit of time digging around for this on the net
> with now luck. We have a pretty simple ocaml app for which we would
> like to distribute an executable binary. For the most part this works.
> However, we would like to minimize the number of binaries that we are
> forced to distribute. We would also like to avoid any confusion on the
> part of our users around figuring out which version of glibc they are
> using. For example, we would like to avoid distributing a binary for
> each version of glibc available. Its more work for us and has a chance
> of confusing some of the folks using our work. Considering the
> simplicity of our binary it seems like a good solution would be to be
> to just statically link against glibc (our only non-ocaml dependency).
> So it would be great if someone could give me pointers to docs that
> describe how to do this. Extra points if I can easily do this with
> OCamlMakefile.  If there is another way to accomplish our goals I am
> more then willing to entertain them, as there are a lot of potential
> problems involved with static linking against glibc.
>

Other people had already give you some advices on how to achieve a static
link against glibc.

I would like to WARN you against this. I have some pretty bad
experiences with using static glibc in my binaries. It seems to have
something to do with the fact that:
* top bugs of glibc (in BUGS in the orginal tarball

[ **]  Closing shared objects in statically linked binaries most of the
       times leads to crashes during the dlopen().  Hard to fix.

** is medium severity.

* whatever you will statically linked, you will always have to load
  ld-linux.so -- which makes you fall into the top bug of glibc

* you will have to include NSS into your code (so it won't be
  possible to use system NSS).

All in all, you could get really strange behavior by using a statically
linked glibc into your code. Of course, this also should not happen...

Regards,
Sylvain Le Gall


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

end of thread, other threads:[~2007-11-29  9:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-29  0:06 Is there a way to statically link an ocaml app compiled to native code against glibc? Eric Merritt
2007-11-29  0:18 ` [Caml-list] " Gerd Stolpmann
2007-11-29  5:14 ` Garrett Jones
2007-11-29  9:36 ` Sylvain Le Gall

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