From: "David Allsopp" <dra-news@metastack.com>
To: <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Compiling a library with findlib
Date: Mon, 14 May 2007 11:52:07 +0100 [thread overview]
Message-ID: <002d01c79615$ea3d3d30$6a7ba8c0@treble> (raw)
In-Reply-To: <20070514100005.459F6BC70@yquem.inria.fr>
> 1. Is it necessary to compile/install the lib;a and lib.so files ?
Yes they are both needed:
lib.so is the bytecode stub library --- so needed for any .cmo file that
uses the C module
lib.a is the native stub library --- linked in when you compile with
ocamlopt for the same purpose
> 2. How can these files be produced (in addition to the .cma and .cmxa
> files) on a system where ocamlfindlib is installed ?
I'm a Windows native port user so detest Makefiles that use ocamlmklib
because the Windows port doesn't include it!
The automation provided by ocamlmklib is IMHO pretty simplistic (see #18.10
in the manual). ocamlmklib -verbose will tell you the commands it uses for
your project - all the ocamlc/ocamlopt commands can then be prefixed with
ocamlfind to import any packages you may need.
When doing ocamlfind install, you just need to include lib.so and lib.a with
the files (r17.html#OCAMLFIND.INSTALL of the findlib docs explains how stub
libraries are dealt with).
HTH,
David
----------
Here's a snippet from the Makefile I use for doing this under Windows for a
library with a lot of stubs (with some omitted variables for clarity).
NB I prefer to call gcc directly - but ocamlc can of course call gcc for
you.
libMSLStdLib.a: $(O_FILES)
ar rsc $@ $(O_FILES)
dllMSLStdLib.dll: $(O_FILES)
gcc -mno-cygwin -mms-bitfields -shared -I $(OCAMLLIB) -L $(OCAMLLIB)
-o $@ $(O_FILES) -locamlrun
MSLStdLib.cma: $(CMI_FILES) $(CMO_FILES) dllMSLStdLib.dll
ocamlfind ocamlc $(PACKAGES) -a -o $@ $(CMO_FILES) -dllib
-lMSLStdLib
MSLStdLib.cmxa: $(CMI_FILES) $(CMX_FILES) libMSLStdLib.a
ocamlfind ocamlopt $(PACKAGES) -a -o $@ $(CMX_FILES) -cclib
-lMSLStdLib
install: MSLStdLib.cma MSLStdLib.cmxa $(CMI_FILES) $(CMX_FILES) META
dllMSLStdLib.dll libMSLStdLib.a
ocamlfind install MSLStdLib META MSLStdLib.cma MSLStdLib.cmxa
MSLStdLib.a libMSLStdLib.a $(CMI_FILES) $(CMX_FILES) dllMSLStdLib.dll
%.o: %.c
gcc -O -Wall -Wno-unused -mms-bitfields -mno-cygwin -I $(OCAMLLIB)
-c $*.c
next prev parent reply other threads:[~2007-05-14 10:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20070514100005.459F6BC70@yquem.inria.fr>
2007-05-14 10:52 ` [Caml-list] Polymorphic variant difference David Allsopp
2007-05-15 4:40 ` Jacques Garrigue
2007-05-15 9:45 ` David Allsopp
2007-05-15 10:21 ` Frédéric van der Plancke
2007-05-14 10:52 ` David Allsopp [this message]
2007-05-14 13:46 ` Compiling a library with findlib Sébastien Hinderer
2007-05-14 7:06 Sébastien Hinderer
2007-05-14 17:37 ` [Caml-list] " Eric Cooper
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='002d01c79615$ea3d3d30$6a7ba8c0@treble' \
--to=dra-news@metastack.com \
--cc=caml-list@yquem.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