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 6973F7EEE0 for ; Fri, 6 Mar 2015 12:08:49 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of san.vu-ngoc@laposte.net) identity=pra; client-ip=194.117.213.98; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="san.vu-ngoc@laposte.net"; x-sender="san.vu-ngoc@laposte.net"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of san.vu-ngoc@laposte.net designates 194.117.213.98 as permitted sender) identity=mailfrom; client-ip=194.117.213.98; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="san.vu-ngoc@laposte.net"; x-sender="san.vu-ngoc@laposte.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp.laposte.net) identity=helo; client-ip=194.117.213.98; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="san.vu-ngoc@laposte.net"; x-sender="postmaster@smtp.laposte.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CnAABmivlUm2LVdcJcg1hasXWPbQEJhXACggoBAQEBAQEQAQEBAQEGCwsJFC6EEAEFQAEBKQMKAQEPCyEEEg8JAwIBAgEzEgYNAQUCAQEOiAgBAxEECbQUhVIBBY9gEDoDEIU0AQEBAQEFAQEBAQEBFgaLF4RuBwmCJAxBgTGEdAqOcYcEOYUgiTqDQoIlHBSBPW6CQwEBAQ X-IPAS-Result: A0CnAABmivlUm2LVdcJcg1hasXWPbQEJhXACggoBAQEBAQEQAQEBAQEGCwsJFC6EEAEFQAEBKQMKAQEPCyEEEg8JAwIBAgEzEgYNAQUCAQEOiAgBAxEECbQUhVIBBY9gEDoDEIU0AQEBAQEFAQEBAQEBFgaLF4RuBwmCJAxBgTGEdAqOcYcEOYUgiTqDQoIlHBSBPW6CQwEBAQ X-IronPort-AV: E=Sophos;i="5.11,352,1422918000"; d="scan'208,217";a="124707104" Received: from smtpoutz23.laposte.net (HELO smtp.laposte.net) ([194.117.213.98]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 06 Mar 2015 12:08:42 +0100 Received: from smtp.laposte.net (localhost [127.0.0.1]) by lpn-prd-vrout011 (Postfix) with ESMTP id 8569352008E for ; Fri, 6 Mar 2015 12:08:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=laposte.net; s=mail1; t=1425640121; bh=r5Evz4+CltnHZRT7tEnYVtHOj/n780L6ZiSZsfBQ5KM=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=ACUbaOT6AlWFkKYDpVnF0eCD7o21wdb6pIsP4ubUygJgEl5IDhh+e9WjvIRAJCWUO VUveulgjakjN4v5S/3fPQSy/7a9B0dEWr+Q4PPkIGy60LtKfz8H6Sy6+8yJrxofyBV iWmITikdm+x4L5h+KCd3ucVJ5NZA1l0ejR2EqsbT6jFOoS1AK0wUhncEt1rBkpaK6B YfVsaLMuGAgDCtLl3bEdsjfV/JnQ6/v5Q90c1cdLZJU3jFu2y1F2jVX58g1xS2ULec x7jU7Nm5WjmyXoM0Vv/lml0eOWPGqG1Vbjj5Wow9EllwV/W9Wh/93jP3EceHpRXiTs BGFFpt1TbZKRg== Received: from lpn-prd-vrin001 (unknown [10.128.63.2]) by lpn-prd-vrout011 (Postfix) with ESMTP id 81176520043 for ; Fri, 6 Mar 2015 12:08:41 +0100 (CET) Received: from lpn-prd-vrin001 (localhost [127.0.0.1]) by lpn-prd-vrin001 (Postfix) with ESMTP id 6E87C3528A2 for ; Fri, 6 Mar 2015 12:08:41 +0100 (CET) Received: from [129.20.36.37] (pr036037.math.univ-rennes1.fr [129.20.36.37]) by lpn-prd-vrin001 (Postfix) with ESMTPA id 522323528AF; Fri, 6 Mar 2015 12:08:41 +0100 (CET) Message-ID: <54F98AB9.1000906@laposte.net> Date: Fri, 06 Mar 2015 12:08:41 +0100 From: Vu Ngoc San User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Pierrick Couderc CC: Ocaml Mailing List References: <54F97E68.3010100@laposte.net> In-Reply-To: Content-Type: multipart/alternative; boundary="------------070905060109040101010307" X-VR-SrcIP: 129.20.36.37 X-VR-FullState: 0 X-VR-Score: -51 X-VR-Cause-1: gggruggvucftvghtrhhoucdtuddrfeejledrhedugddvfecutefuodetggdotefrucfrrhhofhhilhgv X-VR-Cause-2: mecunfetrffquffvgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddq X-VR-Cause-3: uddttddmnegoufhushhpvggtthffohhmrghinhculdegledmnecujfgurhepkfffhfgfggfvufhfjggt X-VR-Cause-4: segrtdgrrgdtfeelnecuhfhrohhmpegguhcupfhgohgtucfurghnuceoshgrnhdrvhhuqdhnghhotges X-VR-Cause-5: lhgrphhoshhtvgdrnhgvtheqnecuffhomhgrihhnpehinhhrihgrrdhfrhdphigrhhhoohdrtghomhen X-VR-Cause-6: ucfrrghrrghmpehmohguvgepshhmthhpohhuthdphhgvlhhopegluddvledrvddtrdefiedrfeejngdp X-VR-Cause-7: ihhnvghtpeduvdelrddvtddrfeeirdefjedpmhgrihhlfhhrohhmpehsrghnrdhvuhdqnhhgohgtsehl X-VR-Cause-8: rghpohhsthgvrdhnvghtpdhrtghpthhtohepphhivghrrhhitghktghouhguvghrtgesghhmrghilhdr X-VR-Cause-9: tghomh X-VR-AvState: No X-VR-State: 0 Subject: Re: [Caml-list] Warning 31: files b.cma(Str) and a.cma(Str) both define a module named Str This is a multi-part message in MIME format. --------------070905060109040101010307 Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 8bit Thanks a lot Pierrick, now I have a set of working makefiles: # this is Makefile.a SOURCES = a.ml RESULT = a all: byte-code-library -include OCamlMakefile # this is Makefile.b SOURCES = b.ml RESULT = b all: byte-code-library -include OCamlMakefile # this is Makefile.test SOURCES = test.ml LIBS = str a b RESULT = test all: byte-code -include OCamlMakefile Le 06/03/2015 11:44, Pierrick Couderc a écrit : > Hi, > > I'm not an expert at all with OCamlMakefile, but I guess that comes from the fact the compiler embeds Str in both libraries "a.cma" and "b.cma". Doing it by hand: > > $ ocamlc -a -o a.cma a.ml > $ ocamlc -a -o b.cma b.ml > $ ocamlc -o a.out str.cma a.cma b.cma test.ml > > You don't need to give "str" as Lib when generating your libraries, only when producing your executable :-) If you give str.cma when generating your libraries: > > $ ocamlc -a -o a.cma str.cma a.ml > $ ocamlc -a -o b.cma str.cma b.ml > $ ocamlc -o a.out a.cma b.cma test.ml > File "b.cma(Str)", line 1: > Warning 31: files b.cma(Str) and a.cma(Str) both define a module named Str > > > Pierrick > > 2015-03-06 11:16 GMT+01:00 Vu Ngoc San : > > Hello list > > I have a basic compilation question: > I want to write two independent libraries, say A an B, and both use a third library, eg. Str > > When I write a program which uses A and B, I get > File "b.cma(Str)", line 1: > Warning 31: files b.cma(Str) and a.cma(Str) both define a module named Str > > How to get rid of this warning ? Am I doing something wrong ? > > Thanks > San > > ---- > > Here is a minimal example: > > (* This is a.ml *) > > let version = "A";; > let _ = print_endline (Str.string_before "Loading the A library -- foo" 22);; > > (* This is b.ml *) > > let version = "B";; > let _ = print_endline (Str.string_before ("Loading the " ^ version ^" library -- bar") 23);; > > # this is Makefile.a > > SOURCES = a.ml > LIBS = str > RESULT = a > all: byte-code-library > -include OCamlMakefile > > # this is Makefile.b > > SOURCES = b.ml > LIBS = str > RESULT = b > all: byte-code-library > -include OCamlMakefile > > (* this is test.ml *) > > let _ = print_endline (Str.string_before ("Hello " ^ A.version ^ " and " ^ B.version ^"---") 13);; > > # this is Makefile.test > > SOURCES = test.ml > LIBS = a b > RESULT = test > all: byte-code > -include OCamlMakefile > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > > > > > -- > Pierrick COUDERC > > PhD Student at OCamlPro / ENSTA Paristech Université Paris Saclay --------------070905060109040101010307 Content-Type: text/html; charset=iso-8859-15 Content-Transfer-Encoding: 8bit Thanks a lot Pierrick, now I have a set of working makefiles:

# this is Makefile.a

SOURCES = a.ml
RESULT = a
all: byte-code-library
-include OCamlMakefile

# this is Makefile.b

SOURCES = b.ml
RESULT = b
all: byte-code-library
-include OCamlMakefile

# this is Makefile.test

SOURCES = test.ml
LIBS = str a b
RESULT = test
all: byte-code
-include OCamlMakefile


Le 06/03/2015 11:44, Pierrick Couderc a écrit :
> Hi,
>
> I'm not an expert at all with OCamlMakefile, but I guess that comes from the fact the compiler embeds Str in both libraries "a.cma" and "b.cma". Doing it by hand:
>
> $ ocamlc -a -o a.cma a.ml 
> $ ocamlc -a -o b.cma b.ml
> $ ocamlc -o a.out str.cma a.cma b.cma test.ml
>
> You don't need to give "str" as Lib when generating your libraries, only when producing your executable :-) If you give str.cma when generating your libraries:
>
> $ ocamlc -a -o a.cma str.cma a.ml
> $ ocamlc -a -o b.cma str.cma b.ml
> $ ocamlc -o a.out a.cma b.cma test.ml
>   File "b.cma(Str)", line 1:
>   Warning 31: files b.cma(Str) and a.cma(Str) both define a module named Str
>
>
> Pierrick
>
> 2015-03-06 11:16 GMT+01:00 Vu Ngoc San <san.vu-ngoc@laposte.net>:
>
>     Hello list
>
>     I have a basic compilation question:
>     I want to write two independent libraries, say A an B, and both use a third library, eg. Str
>
>     When I write a program which uses A and B, I get
>     File "b.cma(Str)", line 1:
>     Warning 31: files b.cma(Str) and a.cma(Str) both define a module named Str
>
>     How to get rid of this warning ? Am I doing something wrong ?
>
>     Thanks
>     San
>
>     ----
>
>     Here is a minimal example:
>
>     (* This is a.ml *)
>
>     let version = "A";;
>     let _ = print_endline (Str.string_before "Loading the A library -- foo" 22);;
>
>     (* This is b.ml *)
>
>     let version = "B";;
>     let _ =  print_endline (Str.string_before ("Loading the " ^ version ^" library -- bar") 23);;
>
>     # this is Makefile.a
>
>     SOURCES = a.ml
>     LIBS = str
>     RESULT = a
>     all: byte-code-library
>     -include OCamlMakefile
>
>     # this is Makefile.b
>
>     SOURCES = b.ml
>     LIBS = str
>     RESULT = b
>     all: byte-code-library
>     -include OCamlMakefile
>
>     (* this is test.ml *)
>
>     let _ = print_endline (Str.string_before ("Hello " ^ A.version ^ " and " ^ B.version ^"---")  13);;
>
>     # this is Makefile.test
>
>     SOURCES = test.ml
>     LIBS = a b
>     RESULT = test
>     all: byte-code
>     -include OCamlMakefile
>
>
>
>     --
>     Caml-list mailing list.  Subscription management and archives:
>     https://sympa.inria.fr/sympa/arc/caml-list
>     Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>     Bug reports: http://caml.inria.fr/bin/caml-bugs
>
>
>
>
> --
> Pierrick COUDERC
>
> PhD Student at OCamlPro / ENSTA Paristech Université Paris Saclay



--------------070905060109040101010307--