caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Dynamic link of C library
@ 2022-02-11 18:18 BOBOT Francois
  2022-02-13 16:55 ` Xavier Leroy
  2022-03-11 14:48 ` BOBOT Francois
  0 siblings, 2 replies; 4+ messages in thread
From: BOBOT Francois @ 2022-02-11 18:18 UTC (permalink / raw)
  To: caml-list

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

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

end of thread, other threads:[~2022-03-11 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11 18:18 [Caml-list] Dynamic link of C library BOBOT Francois
2022-02-13 16:55 ` Xavier Leroy
2022-02-16  7:32   ` BOBOT Francois
2022-03-11 14:48 ` BOBOT Francois

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