From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 67A937F734 for ; Tue, 22 Sep 2015 08:59:03 +0200 (CEST) IronPort-PHdr: 9a23:nWQ4rR3ub2Ebe5wxsmDT+DRfVm0co7zxezQtwd8ZsegfK/ad9pjvdHbS+e9qxAeQG96Lt7Qf2qGP6vuocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC04LshqvrosabSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6LoJvvRNWqTifqk+UacQTHF/azh0t4XXskzmRBGT531Ufmgznx5MBECR6RjgQpb3vib/u+553wGVOMT3SfY/XjH0vIlxTxq9py4NLT809Cnsgcx9lq9B6EaurhZlwoPQJpqeNPdkc7n1ctYTRG4HVcFUAX8SSrigZpcCWrJSdd1TqJPw8h5X9UOz Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-wi0-f169.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.212.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.212.169 as permitted sender) identity=mailfrom; client-ip=209.85.212.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wi0-f169.google.com) identity=helo; client-ip=209.85.212.169; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-wi0-f169.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BaAQDU+gBWlKnUVdFdg3hpBrQ/iw+GAQKBMwc8EAEBAQEBAQEBEAEBAQEHCwsJHzCCHYIHAQEBAwESER0BGx0BAwELBgMCCw0CAiYCAiEBAREBBQEcBhMih3YBAwoImVqPRoEwPjGLRoFsgnmKEwoZJw1WhBABAQEHAQEBARgBBQ6BFIVRhH2CUIFQOjMHgmmBQwWHNIVJiGiFEYYJgW+BTUaHEIo6hXQSI4EXOIIvgX88M4gugT8BAQE X-IPAS-Result: A0BaAQDU+gBWlKnUVdFdg3hpBrQ/iw+GAQKBMwc8EAEBAQEBAQEBEAEBAQEHCwsJHzCCHYIHAQEBAwESER0BGx0BAwELBgMCCw0CAiYCAiEBAREBBQEcBhMih3YBAwoImVqPRoEwPjGLRoFsgnmKEwoZJw1WhBABAQEHAQEBARgBBQ6BFIVRhH2CUIFQOjMHgmmBQwWHNIVJiGiFEYYJgW+BTUaHEIo6hXQSI4EXOIIvgX88M4gugT8BAQE X-IronPort-AV: E=Sophos;i="5.17,571,1437429600"; d="scan'208";a="148159192" Received: from mail-wi0-f169.google.com ([209.85.212.169]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 22 Sep 2015 08:59:02 +0200 Received: by wicgb1 with SMTP id gb1so145276312wic.1 for ; Mon, 21 Sep 2015 23:59:02 -0700 (PDT) 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:content-transfer-encoding; bh=uGT3vyohevSaXZEQ5HAEzc5r4OuW6DbmdynTawF+kvQ=; b=IgWl76jxAOHjgT0g9KxPPQV7JwMx0dUdPqhJH6J+nlKrUxjEqzcj+VOVHfLX2mQZxz jYZEginDBY+l54Xi4L34Je/hONjY04/0BMtNFOkWvU6FEaC0GRQ/DXficDZK5zLgEN+W ANT8BGVRsO+8U/flGXdlx0iqnwng3JAV7wMhogbXEiDbizS6yRzvlF16P8UYfyzC5/te o8lWjMBn/PyOsle4oVPct/UGxnsEDGm5vjJXUJGXL5QWe040upYRnUu0Bm6xzmyzIANh f6+m5InCLtqKlotX96pwIZASjscx9qqmbLE3ymVzorgs0xiNiDIzP9k9nwS5kSggBZyj M9vQ== X-Received: by 10.180.198.180 with SMTP id jd20mr1228723wic.70.1442905142236; Mon, 21 Sep 2015 23:59:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.148.212 with HTTP; Mon, 21 Sep 2015 23:58:22 -0700 (PDT) In-Reply-To: References: From: Gabriel Scherer Date: Tue, 22 Sep 2015 08:58:22 +0200 Message-ID: To: Martin DeMello Cc: OCaml List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] building and using a library in a subdirectory > I don't (yet) need dynamic linking; my current main aim with the .mllib s= etup is to specify the package dependencies for each plugin in its > own se= ction of the _tags file, and not have a long list of every plugin's depende= ncies in the main module. Well, that doesn't quite work: you need to have the ocamlfind packages passed to the command linking the final executable. I suppose changing <**/puz.*>: ... to <**/puz.*> or : ... could work, as this line seems to pass all the libraries flags. On Tue, Sep 22, 2015 at 8:52 AM, Martin DeMello w= rote: > Thanks, I didn't realise that. Replacing Puz_plugin.read with Puz.read > compiled, but didn't link: > > + ocamlfind ocamlopt -linkpkg -g -thread -package core_kernel > plugins/puz/puz_types.cmx plugins/puz/puz_utils.cmx plugins/puz/puz_bin.c= mx > plugins/puz/puz_match.cmx types.cmx xword.cmx plugins/puz/puz.cmx file.cmx > -o file.native > File "_none_", line 1: > Error: No implementations provided for the following modules: > Bitstring referenced from plugins/puz/puz_bin.cmx > Run_mikmatch_pcre referenced from plugins/puz/puz_match.cmx > Str referenced from plugins/puz/puz.cmx > Pcre referenced from plugins/puz/puz_match.cmx > Command exited with code 2. > > I don't (yet) need dynamic linking; my current main aim with the .mllib > setup is to specify the package dependencies for each plugin in its own > section of the _tags file, and not have a long list of every plugin's > dependencies in the main module. > > martin > > On Mon, Sep 21, 2015 at 11:45 PM, Gabriel Scherer > wrote: >> >> A .cma or .cmxa archive does not pack its sub-modules under a common >> module name: the module name Puz_plugin that you use does not refer to >> anything. Accessing any of the constituent modules directly (eg. >> Puz_match.foo) should work -- although it may not go through the .cmxa >> but directly refer to the compilation unit. >> >> Note that if "_plugin" is intended to refer to dynamic linking, you >> may want to use a .mldylib file instead of .mllib, to be used to >> generate a .cmxs file: .cmxa is not suitable for dynamic linking >> (while, at the bytecode level, .cma work for both static and dynamic >> linking). >> >> On Tue, Sep 22, 2015 at 8:23 AM, Martin DeMello >> wrote: >> > If I have my project set up like this: >> > >> > . >> > =E2=94=9C=E2=94=80=E2=94=80 file.ml >> > =E2=94=9C=E2=94=80=E2=94=80 plugins >> > =E2=94=82 =E2=94=94=E2=94=80=E2=94=80 puz >> > =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 puz_bin.ml >> > =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 puz_match.ml >> > =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 puz.ml >> > =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 puz_plugin.mllib >> > =E2=94=82 =E2=94=9C=E2=94=80=E2=94=80 puz_types.ml >> > =E2=94=82 =E2=94=94=E2=94=80=E2=94=80 puz_utils.ml >> > =E2=94=94=E2=94=80=E2=94=80 _tags >> > >> > $ cat plugins/puz/puz_plugin.mllib >> > Puz Puz_bin Puz_match >> > >> > This works: >> > >> > $ ocamlbuild -use-ocamlfind plugins/puz/puz_plugin.cmxa >> > Finished, 22 targets (3 cached) in 00:00:03. >> > >> > My _tags file: >> > ------------------------------------------------ >> > $ cat _tags >> > true: thread,debug >> > true: package(core_kernel) >> > >> > "plugins/puz": include >> > >> > : package(labltk) >> > <**/puz.*>: package(unix), package(str), package(core_kernel), >> > package(bitstring), package(mikmatch_pcre) >> > <**/*_bin.*>: package(bitstring.syntax), syntax(bitstring) >> > <**/*_match.*>: package(mikmatch_pcre), syntax(camlp4o) >> > ------------------------------------------------ >> > >> > But I can't figure out how to use this library in my main program. This >> > is a >> > minimal example of what I'm trying to do, not working of course: >> > >> > $ cat file.ml >> > open Core_kernel.Std >> > >> > let read fname =3D >> > let data =3D In_channel.read_all fname in >> > Puz_plugin.read data >> > >> > $ ocamlbuild -use-ocamlfind file.native >> > + ocamlfind ocamlc -c -g -thread -package core_kernel -I plugins/puz -o >> > file.cmo file.ml >> > File "file.ml", line 5, characters 2-17: >> > Error: Unbound module Puz_plugin >> > >> > martin > >