From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.8 required=5.0 tests=DNS_FROM_RFC_POST,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 9E748BBAF for ; Tue, 21 Jul 2009 15:26:46 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap0CAFteZUpKfVwbimdsb2JhbACPBIocPwEBAQoJDAcRBacTM4ZgiEoBAwIEgjSBVAWBQGKFaA X-IronPort-AV: E=Sophos;i="4.43,240,1246831200"; d="scan'208";a="33361403" Received: from qw-out-2122.google.com ([74.125.92.27]) by mail1-smtp-roc.national.inria.fr with ESMTP; 21 Jul 2009 15:26:45 +0200 Received: by qw-out-2122.google.com with SMTP id 5so1040055qwd.15 for ; Tue, 21 Jul 2009 06:26:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=s6qzfel2Cvo+hm+b82ymDT7ZdzAKcceCy5Nq08jzeKQ=; b=nhxHkysnj3Xi5D3PmLroUomuvxaXyVK7706oIGszA1ZPVcrRVahGaPB3G8ahDkHstH OCn8wvIoOQc6WDlHdAxdRKnqfnb6IT5DwvbDGDSmqqWuuY30mijfT3BF8c5srh5dflQv lx+xLz28Uxdx/lggVga4ZwF5eu1d4Q4BbZh38= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=i26O45/gfJLgGRdoPiVd2dUditvx0gSI40i85azuVO2O10MOq/iVxkozPOchYGADtG logLwXezj5/yGw3ffvp19Sfi+b/oyW3YLJb4wCz+2ijTxRZixhn9HuvlWjLku/fyfihp VVFnfD5v9V0nqpFR9iMm+BiFMp7UM874j2V3U= MIME-Version: 1.0 Sender: aaron678@gmail.com Received: by 10.220.90.10 with SMTP id g10mr6405379vcm.65.1248182804812; Tue, 21 Jul 2009 06:26:44 -0700 (PDT) In-Reply-To: <1BB928AA56A7E74DB134B7F5CDDA390C05607521@frcor-exmb04.europe.am.socgen> References: <1BB928AA56A7E74DB134B7F5CDDA390C056072F1@frcor-exmb04.europe.am.socgen> <1BB928AA56A7E74DB134B7F5CDDA390C05607521@frcor-exmb04.europe.am.socgen> Date: Tue, 21 Jul 2009 09:26:44 -0400 X-Google-Sender-Auth: 035238195679e1d6 Message-ID: Subject: Re: [Caml-list] how to use c wrapper files in libraries From: Aaron Bohannon To: RABIH.ELCHAAR@sgam.com Cc: caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; ocamlc:01 gcc:01 gcc:01 ocamlc:01 -verbose:01 ocaml:01 ocaml:01 -cclib:01 -verbose:01 contrib:01 compile-time:01 -custom:01 stub:01 cmo:01 usr:01 I thought so too, but it doesn't work. ocamlc does pass the option "-I install" to gcc, but gcc only uses "-I" directories to search for header files, not object files. gcc uses "-L" directories to search for library (".a") files, but this also has no effect on where gcc looks for ".o" files. - Aaron On Tue, Jul 21, 2009 at 4:48 AM, wrote: > I think that if you install your library along with the obj file, let's s= ay to directory install, and if you pass to ocamlc -I install sndfile.cma .= .. maybe he will find the obj file and pass it to the linker. > > I didn't do the experimentation though, maybe it won't work. > > Rabih > > > -----Message d'origine----- > De=A0: caml-list-bounces@yquem.inria.fr [mailto:caml-list-bounces@yquem.i= nria.fr] De la part de Aaron Bohannon > Envoy=E9=A0: lundi 20 juillet 2009 18:22 > =C0=A0: EL CHAAR Rabih SGAM/AI/SAM > Cc=A0: caml-list@yquem.inria.fr > Objet=A0: Re: [Caml-list] how to use c wrapper files in libraries > > Thank you. =A0This does clarify some things. =A0Everything works like > clockwork after reworking things this way. > > Based on the output of "ocamlc -verbose", it seems that if you pass > "file.o" file to "ocamlc -a", it does nothing except remember the name > "file.o" and pass it to gcc when the OCaml library is later used, > which is a pretty useless and confusing behavior---in general, you > will not be in the same directory that contains "file.o" when you use > the OCaml library and I don't know of any gcc options that will make > gcc look in other directories for object files. =A0It would seem better > for "ocamlc -a" to ignore ".o" files and display an appropriate > warning. > > =A0- Aaron > > On Mon, Jul 20, 2009 at 10:58 AM, wrote: >> I am not familiar with this specific library. >> In the general approach, you compile your c code, and package it into a = library, let's say libA.a >> >> Then while building your sndfile.cma, you should pass the option >> ocamlc -a -o sndfile.cma -cclib -lA ... >> >> A caml executable linked with your library will have also libA.a passed = in the linking phase. >> >> Using ocamlc -verbose could give you a hint to which files are missing. >> >> Hope this helps, >> >> Rabih >> >> -----Message d'origine----- >> De=A0: caml-list-bounces@yquem.inria.fr [mailto:caml-list-bounces@yquem.= inria.fr] De la part de Aaron Bohannon >> Envoy=E9=A0: lundi 20 juillet 2009 16:28 >> =C0=A0: caml-list@yquem.inria.fr >> Objet=A0: [Caml-list] how to use c wrapper files in libraries >> >> Hello, >> >> I am trying to use the wrapper for libsndfile contributed by Erik de >> Castro Lopo (http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=3D556). >> The wrapper code compiles just fine. =A0And the tests that use the OCaml >> library it builds work just fine. =A0However, I am having a frustrating >> compile-time error when I try to compile my program in a different >> directory. >> >> The wrapper code is being packaged into an OCaml library using the >> following command: >> >> ocamlc -a -o sndfile.cma -custom sndfile_stub.o sndfile.cmo \ >> =A0-ccopt -L/usr/local/lib -cclib -lsndfile >> >> Within the same directory, the test program can be successfully compiled= with: >> >> ocamlc -o test_sndfile sndfile.cma test_sndfile.ml >> >> Within a different directory, I used: >> >> ocamlc -o mytest -I /path/to/libsndfile-ocaml/files/ =A0 sndfile.cma =A0= mytest.ml >> >> And I get: >> >> powerpc-apple-darwin8-gcc-4.0.1: sndfile_stub.o: No such file or directo= ry >> Error while building custom runtime system >> >> I have tried setting every path-related option I could find, and >> nothing helped. =A0I tried reading everything I could find about >> compiling and using c wrappers for OCaml, but there is a severe lack >> of documentation on the topic. =A0In particular, I could find no example >> of a c object file being given as an argument to an "ocamlc -a" >> command, so I am not sure what that is supposed to do, which makes it >> impossible for me to understand this error message. >> >> I am using OCaml 3.10.1 on OS X 10.4. =A0Any help would be appreciated. >> >> =A0- Aaron >> >> _______________________________________________ >> Caml-list mailing list. Subscription management: >> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list >> Archives: http://caml.inria.fr >> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >> Bug reports: http://caml.inria.fr/bin/caml-bugs >> This message and any attachments (the "message") are confidential, inten= ded solely for the addressee(s), and may contain legally privileged informa= tion. >> Any unauthorised use or dissemination is prohibited. >> E-mails are susceptible to alteration. >> Neither Societe Generale Asset Management nor any of its subsidiaries or= affiliates shall be liable for the message if altered, changed or falsifie= d. >> >> Find out more about Societe Generale Asset Management's proposal on www.= sgam.com >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0******** >> >> Ce message et toutes les pieces jointes (ci-apres le "message") sont con= fidentiels et susceptibles de contenir des informations couvertes par le se= cret professionnel. >> Ce message est etabli a l'intention exclusive de ses destinataires. >> Toute utilisation ou diffusion non autorisee est interdite. >> Tout message electronique est susceptible d'alteration. Societe Generale= Asset Management et ses filiales declinent toute responsabilite au titre d= e ce message s'il a ete altere, deforme ou falsifie. >> >> Decouvrez l'offre et les services de Societe Generale Asset Management s= ur le site www.sgam.fr >> >> > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >