caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: ygrek <ygrekheretix@gmail.com>
To: Paul Steckler <steck@stecksoft.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Mixed static/dynamic linking of libraries
Date: Sun, 15 May 2011 15:46:30 +0300	[thread overview]
Message-ID: <20110515154630.07910bb1.ygrekheretix@gmail.com> (raw)
In-Reply-To: <BANLkTi=-0P_hCZ2cch06nMvkPUbPqP0oHA@mail.gmail.com>

On Mon, 2 May 2011 16:49:03 +1000
Paul Steckler <steck@stecksoft.com> wrote:

> I want to statically link a library (libsqlite3.a) with my OCaml
> application, but allow other
> libraries to link dynamically. I'm building using ocamlfind on Linux.

The ultimate goal is to get `-Wl,-Bstatic -lsqlite3 -Wl,-Bdynamic` in the
final invocation of gcc when linking your binary (without any other references to
sqlite3 on command-line).

Possible approaches :
1) patch the build system of ocaml-sqlite3 so that it embeds the above flags into cmxa
2) insert linker instructions with -ccopt's around the reference to sqlite3.cmxa when linking your application - IIRC this
didn't work for me because ocamlopt reorders command-line arguments when passing them to gcc in some incomprehensible way.
3) use -noautolink and specify the above flags as single -ccopt (and do this for all cma's with embedded options).

(1) looks most simple to me and ideally ocamlopt could allow embedding several sets of options into cma and choosing
them at final link with some option/tags, then all libraries could easily embed two command-lines - for static and dynamic linking.

-- 
 ygrek
 http://ygrek.org.ua

      parent reply	other threads:[~2011-05-15 12:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02  6:49 Paul Steckler
2011-05-02 12:00 ` Richard W.M. Jones
2011-05-02 12:40   ` Gerd Stolpmann
2011-05-15 12:46 ` ygrek [this message]

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=20110515154630.07910bb1.ygrekheretix@gmail.com \
    --to=ygrekheretix@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=steck@stecksoft.com \
    /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).