caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: BOBOT Francois <Francois.BOBOT@cea.fr>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] Dynamic link of C library
Date: Fri, 11 Feb 2022 18:18:20 +0000	[thread overview]
Message-ID: <3496160576413589fd508d9af3902f195cf2f1ee.camel@cea.fr> (raw)

Hi everyone,

	I'm a little lost with some binding. Usually I bind statically
C library in OCaml libraries (except for C libraries already present on
the system). It works well for all the targets (bytecode, native static
.cmxa, native dynamic .cmxs) by keeping the C library in the OCaml
library. Usually one just need to be sure that libfoo.a is compiled
with -fPic (which is not usual). However static linking lose the
advantage of a C library with the *L*GPL licence (no?). So I'm lost
between everything we have:

   - .cmxs needs ld to be able to find the dynamic C library, libfoo.so
   - there is the stublibs directory, but it is only for bytecode and
files are prefixed by dll instead of lib so ld can't find them.
   - There is no directory to install dynamic C library in opam, no
LD_LIBRARY_PATH set
   - -dllpath requires to know the install directory during compilation


-dllpath is usually the chosen solution but hardcoding path makes build
cache less useful, and dune knows the install directory only at the
end. Is there an elegant solution I haven't seen or some of our tools
need to be modified?

Best,

-- 
François

             reply	other threads:[~2022-02-11 18:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 18:18 BOBOT Francois [this message]
2022-02-13 16:55 ` Xavier Leroy
2022-02-16  7:32   ` BOBOT Francois
2022-03-11 14:48 ` BOBOT Francois

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=3496160576413589fd508d9af3902f195cf2f1ee.camel@cea.fr \
    --to=francois.bobot@cea.fr \
    --cc=caml-list@inria.fr \
    /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).