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 8F0DB7EEE0 for ; Fri, 6 Mar 2015 11:44:54 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of pierrickcouderc@gmail.com) identity=pra; client-ip=209.85.212.171; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="pierrickcouderc@gmail.com"; x-sender="pierrickcouderc@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of pierrickcouderc@gmail.com designates 209.85.212.171 as permitted sender) identity=mailfrom; client-ip=209.85.212.171; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="pierrickcouderc@gmail.com"; x-sender="pierrickcouderc@gmail.com"; 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@mail-wi0-f171.google.com) identity=helo; client-ip=209.85.212.171; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="pierrickcouderc@gmail.com"; x-sender="postmaster@mail-wi0-f171.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AkAQCMhPlUlavUVdFcg1haBIMGrmuNfYFwAQmFcAKBNAdNAQEBAQEBEAEBAQEHDQkJEjCEEAEBAwESER0BGw8DCwEDAQsGBQsaHQICIgERAQUBChIGExIQh3gBAwkIDah4PjGLLoFrgnePaAoZJwMKBk6EZgEBAQEBAQQBAQEBAQEBARQBBQ6LCYRqBAeCLQwvEoExBYRvCo5xhWqBGjmOWoF4EiOBDAmBficcFIE9PTGCQwEBAQ X-IPAS-Result: A0AkAQCMhPlUlavUVdFcg1haBIMGrmuNfYFwAQmFcAKBNAdNAQEBAQEBEAEBAQEHDQkJEjCEEAEBAwESER0BGw8DCwEDAQsGBQsaHQICIgERAQUBChIGExIQh3gBAwkIDah4PjGLLoFrgnePaAoZJwMKBk6EZgEBAQEBAQQBAQEBAQEBARQBBQ6LCYRqBAeCLQwvEoExBYRvCo5xhWqBGjmOWoF4EiOBDAmBficcFIE9PTGCQwEBAQ X-IronPort-AV: E=Sophos;i="5.11,352,1422918000"; d="scan'208";a="124702215" Received: from mail-wi0-f171.google.com ([209.85.212.171]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Mar 2015 11:44:54 +0100 Received: by widex7 with SMTP id ex7so1815856wid.3 for ; Fri, 06 Mar 2015 02:44:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=+qr+h+dkZvo28AKL/WDnGNFegUcoHdyScpnxXjvukZs=; b=wRnsF6lhDkBY9Jxjt21diAJGaFTVTVM1VqLL3tTDYF+X3c9Vxscehw54v+6+ZLCFiV 9gIMBu2kT0qpjuvI2G7iez/m5BC9VhG4ZgLJ04rQWo8VmdzkRwR1h08wE0TrxDyvbWvT HxafTzib68O0noVm7dcPjA3E+zXSEJ51th80H4iHg7KoZzKwjzTu9DtaIpkbx36QEh/i fsrf1pEthGFHGQUIE82pNZprH9lSFlSNz91Zekqc24Fg/JCLsv0JE/4B79Zc6PzsSWbP iml5Yj1LNAuy1609OoeAl8OsAF4V38+3XCenc64MtRx30FO033LjVhNhPUJzM/uYOOn6 w1zw== X-Received: by 10.194.85.129 with SMTP id h1mr28003946wjz.147.1425638693774; Fri, 06 Mar 2015 02:44:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.194.43.228 with HTTP; Fri, 6 Mar 2015 02:44:33 -0800 (PST) In-Reply-To: <54F97E68.3010100@laposte.net> References: <54F97E68.3010100@laposte.net> From: Pierrick Couderc Date: Fri, 6 Mar 2015 11:44:33 +0100 Message-ID: To: Vu Ngoc San Cc: Ocaml Mailing List Content-Type: multipart/alternative; boundary=089e010d860aebafa305109c5f78 Subject: Re: [Caml-list] Warning 31: files b.cma(Str) and a.cma(Str) both define a module named Str --089e010d860aebafa305109c5f78 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 =3D "A";; > let _ =3D print_endline (Str.string_before "Loading the A library -- foo" > 22);; > > (* This is b.ml *) > > let version =3D "B";; > let _ =3D print_endline (Str.string_before ("Loading the " ^ version ^" > library -- bar") 23);; > > # this is Makefile.a > > SOURCES =3D a.ml > LIBS =3D str > RESULT =3D a > all: byte-code-library > -include OCamlMakefile > > # this is Makefile.b > > SOURCES =3D b.ml > LIBS =3D str > RESULT =3D b > all: byte-code-library > -include OCamlMakefile > > (* this is test.ml *) > > let _ =3D print_endline (Str.string_before ("Hello " ^ A.version ^ " and = " ^ > B.version ^"---") 13);; > > # this is Makefile.test > > SOURCES =3D test.ml > LIBS =3D a b > RESULT =3D 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 > --=20 Pierrick COUDERC *PhD Student at OCamlPro / ENSTA Paristech Universit=C3=A9 Paris Saclay* --089e010d860aebafa305109c5f78 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

I'm not an expert at all with O= CamlMakefile, 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 =C2=A0
$ ocamlc -a -o b.cma b.ml
$ ocamlc -o a.out= str.cma a.cma b.cma test.ml=C2=A0

$ ocamlc -a -o b.cma str.cma b.ml
$ ocamlc -o a.out a.= cma b.cma test.ml
=C2=A0 File "b.cma(Str)", line 1:
=C2=A0 Warning 31: = files b.cma(Str) and a.cma(Str) both define a module named Str
<= div>

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<= br>
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 =3D "A";;
let _ =3D print_endline (Str.string_before "Loading the A library -- f= oo" 22);;

(* This is b.ml *)

let version =3D "B";;
let _ =3D=C2=A0 print_endline (Str.string_before ("Loading the " = ^ version ^" library -- bar") 23);;

# this is Makefile.a

SOURCES =3D a.ml
LIBS =3D str
RESULT =3D a
all: byte-code-library
-include OCamlMakefile

# this is Makefile.b

SOURCES =3D b.ml
LIBS =3D str
RESULT =3D b
all: byte-code-library
-include OCamlMakefile

(* this is test.ml *)

let _ =3D print_endline (Str.string_before ("Hello " ^ A.version = ^ " and " ^ B.version ^"---")=C2=A0 13);;

# this is Makefile.test

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



--
Caml-list mailing list.=C2=A0 Subscription management and archives:
ht= tps://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners<= /a>
Bug reports:
http://caml.inria.fr/bin/caml-bugs



--
Pierrick COUDERC

PhD Student at OCamlPro / ENSTA P= aristech Universit=C3=A9 Paris Saclay
--089e010d860aebafa305109c5f78--