caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Andreea Costea <andre.costea@gmail.com>
To: Gerd Stolpmann <info@gerd-stolpmann.de>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] static linking
Date: Sat, 7 Jun 2014 17:55:48 +0800	[thread overview]
Message-ID: <CADxQj2fdNvVkHRG9edtCNkduLUL34j4iuUHKqttddjbY=WQdBg@mail.gmail.com> (raw)
In-Reply-To: <1402086284.3141.12.camel@e130>

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

Mark and Gerd, thank you both for your replies and suggestions. Indeed
glibc (/lib64/libc.so.6) was the one causing troubles.
For short time, I shall try the script Gerd provided, and perhaps for long
term we should consider building our system without the core libs
statically linked.

Thanks again,
Andreea



On Sat, Jun 7, 2014 at 4:24 AM, Gerd Stolpmann <info@gerd-stolpmann.de>
wrote:

> I'd strongly recommend against linking statically libc and other core
> system libraries (e.g. libm, libdl, librt, ...). This creates more
> problems than it solves. Instead, only link those libraries statically
> that are causing the trouble. Unfortunately, this isn't directly
> possible by just passing a linker option, but there is a solution by
> rewriting the linker arguments:
>
> See the attached script gcc_wrapper.sh (I'm using this or a derivative,
> depending on the system). Just tell ocaml to use this script as C
> compiler:
>
> ocamlopt ... -cc ./gcc_wrapper.sh ...
>
> Also set the environment variable STATIC_LIBS to the names of the
> libraries you'd like to link statically (e.g. STATIC_LIBS="pcre z" would
> select libpcre and libz).
>
> The script here is only activated when there is an
>
>   -o <name>.opt
>
> argument. You may want to modify this part. (I'm just taking the version
> of the script from the plasma project; some more work is required to
> make it fully generic.)
>
> Gerd
>
>
> Am Freitag, den 06.06.2014, 23:43 +0800 schrieb Andreea Costea:
> > Hi,
> >
> >
> > I'm trying to build a rather big system written in Ocaml, using
> > ocamlbuild. I managed to set all the needed flags nicely, so that the
> > resulted binaries can run on any Unix machine, independent on their
> > Ocaml distribution. However, on certain machines I have problems with
> > the compatibility between the C libraries. Hence, I tried using
> > "-ccopt -static"  for the -lflags and -cflags, respectively, in order
> > to produce the desired statically linked binaries while building the
> > project. Unfortunately, this attempt leads to the following error:
> >
> >
> > "/usr/bin/ld: dynamic STT_GNU_IFUNC symbol `cos' with pointer equality
> > in
> >
> `/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libm.a(s_sin.o)'
> can not be used when making an executable; recompile with -fPIE and relink
> with -pie"
> >
> >
> > Does this mean I need to recompile the gcc libraries using -pie? Or
> > does it mean I am using the wrong method to build the standalone
> > executable? Any recommendation to modify the building process (i would
> > prefer to use ocambuild)?
> >
> >
> > Your answer is much appreciated,
> > Andreea
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
> --
> ------------------------------------------------------------
> Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
> My OCaml site:          http://www.camlcity.org
> Contact details:        http://www.camlcity.org/contact.html
> Company homepage:       http://www.gerd-stolpmann.de
> ------------------------------------------------------------
>
>

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

  reply	other threads:[~2014-06-07  9:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-06 15:43 Andreea Costea
2014-06-06 16:14 ` Török Edwin
2014-06-06 17:33 ` Mark Shinwell
2014-06-06 20:24 ` Gerd Stolpmann
2014-06-07  9:55   ` Andreea Costea [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-11-09 17:14 Static linking Maurizio Colucci
2005-11-09 17:28 ` [Caml-list] " Basile STARYNKEVITCH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADxQj2fdNvVkHRG9edtCNkduLUL34j4iuUHKqttddjbY=WQdBg@mail.gmail.com' \
    --to=andre.costea@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=info@gerd-stolpmann.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).