From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 1CD3F820A1 for ; Fri, 23 Aug 2013 00:24:33 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.17.8; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.17.8; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of postmaster@moutng.kundenserver.de designates 212.227.17.8 as permitted sender) identity=helo; client-ip=212.227.17.8; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@moutng.kundenserver.de"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvIAAKWOFlLU4xEIlGdsb2JhbABagzzAXIEeFg4BAQEBBw0SFAMlgiQBAQQBVSQQCwc/VwYTCYgBCgi2e4oYhigmB4QWA45riiiEfY5R X-IPAS-Result: AvIAAKWOFlLU4xEIlGdsb2JhbABagzzAXIEeFg4BAQEBBw0SFAMlgiQBAQQBVSQQCwc/VwYTCYgBCgi2e4oYhigmB4QWA45riiiEfY5R X-IronPort-AV: E=Sophos;i="4.89,937,1367964000"; d="asc'?scan'208";a="30109547" Received: from moutng.kundenserver.de ([212.227.17.8]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 23 Aug 2013 00:24:32 +0200 Received: from office1.lan.sumadev.de (dslb-178-004-016-020.pools.arcor-ip.net [178.4.16.20]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LhThA-1Vq8zP3Tou-00mZn3; Fri, 23 Aug 2013 00:24:32 +0200 Received: from [192.168.178.21] (546BF816.cm-12-4d.dynamic.ziggo.nl [84.107.248.22]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 754B2C00CF; Fri, 23 Aug 2013 00:24:31 +0200 (CEST) Message-ID: <1377210265.18270.4.camel@e130> From: Gerd Stolpmann To: John Whitington Cc: caml users Date: Fri, 23 Aug 2013 00:24:25 +0200 In-Reply-To: <52164BAE.3080509@coherentgraphics.co.uk> References: <52164BAE.3080509@coherentgraphics.co.uk> Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-gaqPS7sV2I6Tn4AwmRtR" X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 X-Provags-ID: V02:K0:watgcfdNprwTBvQR8TQM61ZWV6TZyhiTClhzpNhPHtA iTryNJ5O65U30M6HqG+owcPkUuCPzzKnKBGJe5+M1Yo1WuEJzK blWwQqFZGw0tXHeRMfYZlfOk47X8RiDkeLsrqnFuaJVUpLqMTD ux2Gl0PNiWoB72BtqH4j5cw+1X/jnrcxOb+ZBr6kBRonqYGlQi htaW/7BIKoIvWVV4R4QSOW8WL9H+1NFpxVlBVFCovNkHciZatl A64n3KBgZxrAdUkTaAh7VAtJpsOVbakbWUMOfLjVOSfTP5aKNm 7C7C5pDGB5jcRlXN8Ube/pR30KUNeXvmPaFylSXq0H6ofVNuwp zezYlLJ0Stbfd2HnO32e5omRxbjlZU9kUnPZjITfT Subject: Re: [Caml-list] Building a mixed C / OCaml static library to be used from C --=-gaqPS7sV2I6Tn4AwmRtR Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable Am Donnerstag, den 22.08.2013, 18:34 +0100 schrieb John Whitington: > Hi, >=20 > I have the following recipe to build a static library of C functions=20 > from a mixed ocaml / c codebase. The idea is that the final linking step= =20 > to build target 'test' won't require any special flags: >=20 >=20 > CAMLBASE =3D /Users/john/.opam/4.00.1/lib/ >=20 > mklib: cpdflib.mli cpdflib.ml cpdflibwrapper.c > ocamlfind ocamlc -package cpdf cpdflib.mli; > ocamlfind ocamlopt -package cpdf -c cpdflib.ml; > ocamlfind ocamlc cpdflibwrapper.c; > ocamlfind ocamlopt -I $(CAMLBASE)cpdf -I $(CAMLBASE)camlpdf \ > -output-obj -o cpdflib.o \ > unix.cmxa bigarray.cmxa camlpdf.cmxa cpdf.cmxa cpdflib.cmx; > ar -x $(CAMLBASE)camlpdf/libcamlpdf_stubs.a; > ar -x $(CAMLBASE)ocaml/libasmrun.a; > ar cr cpdflib.a *.o >=20 > test: cpdflib.a cpdflibtest.c > cc cpdflibtest.c cpdflib.a -o test\ > -L $(CAMLBASE)ocaml -lbigarray -lunix >=20 > clean: > rm __.SYMDEF\ SORTED *.o *.cmx *.cmi *.a test >=20 >=20 > (Here, cpdflib.ml, cpdflib.mli and cpdflibwrapper.c form the C interface= =20 > to the OCaml functions. cpdflibtest.c calls caml_startup and then any=20 > caml functions it likes). >=20 > This works. However, I'm having trouble getting rid of "-L=20 > $(CAMLBASE)ocaml -lbigarray -lunix" -- i'd like the person linking with= =20 > my cpdflib.a not to need any dependencies at all. >=20 > When I add two more lines >=20 > ar -x $(CAMLBASE)ocaml/bigarray.a; > ar -x $(CAMLBASE)ocaml/unix.a; These are the wrong two libs. bigarray.a and unix.a are already contained in cpdflib.a. What you need are libbigarray.a and libunix.a. Gerd >=20 > in the obvious place and remove "-L $(CAMLBASE)ocaml -lbigarray -lunix"= =20 > when building the example, the linking fails, not being able to find the= =20 > symbols for unix and bigarray. ar -t confirms that bigarray.o, unix.o=20 > and unixlabels.o are in the created cpdflib.a >=20 > Any ideas, or another recipe altogether? >=20 > Thanks, >=20 > --=20 > John Whitington > Director, Coherent Graphics Ltd > http://www.coherentpdf.com/ >=20 >=20 --=20 ------------------------------------------------------------ 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 ------------------------------------------------------------ --=-gaqPS7sV2I6Tn4AwmRtR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQEcBAABAgAGBQJSFo+aAAoJEAaM4b9ZLB5TIMUIAI91BQoxPzy+ln+mfVzYudBg R0FmTn+xIOe2IRk66u5BWAFANsrFiiKhM1TQ1iXawdDbxx+27CXSm5XqcS88ozc6 v/r8t+0v56XAGQHWx3fQlp4CJBLd+aoQSiC7QJWP+RbKxKlZaPY3Nc+HUpv/XU6Y rSKBYP/WiWsywvICdEXoEstYYF8zbC2+AVYefCUKpFOp6oJz66f4XAwl5LA4r6AI i8o2exZD4XNfatUbFwOGUn79hRm2rhrLxRseC7EnZAvgXBb3OUcEquZ15J3qF86v m9zO3LWbrb2ZndWk0eb1AJsoDYGNHHIKAJVxEqwVkMVvWW+jp45CAcEuWGCGTaU= =DFAP -----END PGP SIGNATURE----- --=-gaqPS7sV2I6Tn4AwmRtR--