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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id CA0D47F0F9 for ; Tue, 24 Nov 2015 18:48:44 +0100 (CET) IronPort-PHdr: 9a23:np90aBbKE/WycQQ969Fxzi7/LSx+4OfEezUN459isYplN5qZpMy9bnLW6fgltlLVR4KTs6sC0LqL9f++EjZcqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh730pMOYOVkArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIZoGJ/3dKUgTLFeEC9ucyVsvJWq5i/4UBCX63AAfmITmxtOS0iZvVCpFqv25wLgs+P+3GG1IEzwQLkpEWCr9aJiRRuuhzoKMTMw7UnajNc1iLNcplSvvUos7ZTTZdS3OeBze6LQNf8bQGtHWY4FVSBAB4K6aKMNBuwMJvpCooTh4VAJqE3tVkGXGOrzx2oQ1TfN1qog3rFkTFjL Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jdimino@janestreet.com; spf=Pass smtp.mailfrom=jdimino@janestreet.com; spf=None smtp.helo=postmaster@mxout1.mail.janestreet.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.112 as permitted sender) identity=mailfrom; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.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@mxout1.mail.janestreet.com) identity=helo; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@mxout1.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0B9AABnolRWnHDIaSZehA5vBq5XkVIXDIVsAoE8BzwQAQEBAQEBAQEQAQEBAQEGFglPgi2CCAEBBBIRHQEBLAsBDwsLDQICCR0CAiISAQUBChIGExIQh3cDEgMKoC+BMT4xildxhGMBBYZSA4RkAQEBAQEBAQEBAQEBAQEBAQEBAQETBgp3hVOEfoRZgmIMLhOBMYYTDJA2hSSCcoUbgVtJhxyRPhIkgRc4gi8NFgeBVnKFKwEBAQ X-IPAS-Result: A0B9AABnolRWnHDIaSZehA5vBq5XkVIXDIVsAoE8BzwQAQEBAQEBAQEQAQEBAQEGFglPgi2CCAEBBBIRHQEBLAsBDwsLDQICCR0CAiISAQUBChIGExIQh3cDEgMKoC+BMT4xildxhGMBBYZSA4RkAQEBAQEBAQEBAQEBAQEBAQEBAQETBgp3hVOEfoRZgmIMLhOBMYYTDJA2hSSCcoUbgVtJhxyRPhIkgRc4gi8NFgeBVnKFKwEBAQ X-IronPort-AV: E=Sophos;i="5.20,339,1444687200"; d="scan'208";a="154990226" Received: from mxout1.mail.janestreet.com ([38.105.200.112]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Nov 2015 18:48:37 +0100 Received: from tot-qpr-mailcore2.delacy.com ([172.27.56.106] helo=tot-qpr-mailcore2) by mxout1.mail.janestreet.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1a1Hhk-0002O3-9H for caml-list@inria.fr; Tue, 24 Nov 2015 12:48:36 -0500 X-JS-Flow: external Received: by tot-qpr-mailcore2 with JS-mailcore (0.1) (envelope-from ) id BWVKL0-AAAGoA-Hj; 2015-11-24 12:48:36.242782-05:00 Received: from mail-ig0-f171.google.com ([209.85.213.171]) by mxgoog1.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1a1Hhk-0003V7-5I for caml-list@inria.fr; Tue, 24 Nov 2015 12:48:36 -0500 Received: by igcto18 with SMTP id to18so19574784igc.0 for ; Tue, 24 Nov 2015 09:48:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=cHrVlFVgduANFmqbTD4XbkK0V0L1wZn3kQngqTl8fCQ=; b=PZuSl4bRGnO0PFG0ENtUAhJ3s9sLdkEmrewWcouwFltgMXJ9fm3hLlxDkWZm2Jy5aq yAWZmWTGHJ4jbHJkAts2FcQkXbuhqni933UMrVRNuYF7f9wDu7dSDImW+b+CFi/cF6sw xduOnpMAgUgvZGShCfV2jzZYbtvB2VYz8U+6s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=cHrVlFVgduANFmqbTD4XbkK0V0L1wZn3kQngqTl8fCQ=; b=RhDUBAIr44riZ/bLCKcbDHIJvFu8IPi/o2KV0XEqzt/bxBFQDM3hH4loaEsdziaF2h 2Q1NfuA9Lc59RXCY/eq6MKZMrdD2QcwTEiSNPL8IJHb4v66tiillDFacKhXLK0EGQ/22 cUvvcKKlS0X/Jzt6reGD3BUZl5Fpo9PUyBUISrRN5bJVclwCRn+/sJaa4XJb0t2KPJ2c aCuAOoQjqiFF0yKmU4+/NsHS+yXtLo+34KPwhCXIxmSpu6PuDIidyeSHkSn0LhvSR37v Kmb2jdmxJDJVX/LIe+B+nw7IABw3qchl1bQPCb9sfLseeSG8P45K4rCJDoJFGqP6BA2Z r+Xw== X-Gm-Message-State: ALoCoQlkdAei8UCI7HdogFVrgI2Fz/osk/wqhCo5D0RPpqT5GtSml548hFpZhZKFaXtI96xAVPLk2eCuDt8mhkRTbn6iPKfx1qXSOvFDrb6f8rhbV0Roqq5EkHY6eByJ3RZEPrchqNgV X-Received: by 10.50.160.2 with SMTP id xg2mr20084124igb.54.1448387315783; Tue, 24 Nov 2015 09:48:35 -0800 (PST) MIME-Version: 1.0 X-Received: by 10.50.160.2 with SMTP id xg2mr20084100igb.54.1448387315620; Tue, 24 Nov 2015 09:48:35 -0800 (PST) Received: by 10.50.237.70 with HTTP; Tue, 24 Nov 2015 09:48:35 -0800 (PST) In-Reply-To: <5654A199.3010700@ens-lyon.fr> References: <5654971F.2070006@ens-lyon.fr> <5654A199.3010700@ens-lyon.fr> Date: Tue, 24 Nov 2015 17:48:35 +0000 Message-ID: From:Jeremie Dimino To:=?UTF-8?B?QXJtYcOrbCBHdcOpbmVhdQ==?= Cc:caml-list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-JS-Processed-by: mailcore Subject: Re: [Caml-list] Custom toplevel and ocamlbuild It might be to do with where foo.cmi ends up. When using ocamlbuild it will be in _build while when running the command manually it will be in the current directory. Toplevels are not standalone, they need to read the .cmi files at runtime. The cmi files are located by the OCaml compiler using a search path. Try running myutop.top as follow after building it with ocamlbuild: ./myutop.top -I _build Alternatively you can also use `#directory "_build";;` from inside the topl= evel. On Tue, Nov 24, 2015 at 5:42 PM, Arma=C3=ABl Gu=C3=A9neau wrote: > It sounds better to put "Foo" at the beginning of myutop.mltop > indeed! However, it still doesn't work here (same thing, the > toplevel cannot access Foo). > > What is super super weird is that if I manually run the build commands > _that ocamlbuild lists in the terminal_, which are: > > ocamlfind ocamlc -c -thread -package threads,utop -o foo.cmo foo.ml > ocamlfind ocamlc -c -thread -package threads,utop -o myutop_main.cmo > myutop_main.ml > ocamlfind ocamlmktop -linkpkg -thread -package threads,utop -package > threads,utop foo.cmo myutop_main.cmo -o myutop.top > > this time, it works... > > This smells like $PATH issues or something related to my setup, but I > triple-checked and I don't see where this could come from... > > On 24/11/15 17:14, Jeremie Dimino wrote: >> Did you try adding "Foo" at the beginning of myutop.mltop? foo.cmo > nee= ds >> to come before myutop_main.cmo and I suppose that ocamlbuild > puts the = cmo >> in the same order as the one specified in the .mltop > unless the >> dependencies force reordering. > > The reason foo.cmo needs to come befo= re >> is that OCaml run the > initialization code of linked compilation units = in >> the same order they > are specified on the command line and the toplevel= can >> only see > modules that have been initialized. > Myutop_main contains the >> entry point of the toplevel - i.e. the call > to the interactive loop - = so >> the toplevel doesn't have access to units > that are linked after >> myutop_main.cmo. That's also the reason why you > can't access Myutop_ma= in >> from the custom toplevel. > > On Tue, Nov 24, 2015 at 4:58 PM, Arma=C3= =ABl >> Gu=C3=A9neau > wrote: >> Hi list, >> >> I w= as trying >> to build a custom toplevel, bundled with my custom >> modules, and >> encountered a few issues. >> >> Following the last advice given by gasch= e on >> this reddit post >> >> https://www.reddit.com/r/ocaml/comments/3qjs1q/utop_is_a_much_better_top= level_than_ocaml_if_you/cwisrrj >> >> I copy-pasted the files from examples/custom-utop, added a foo.ml fil= e >> >> containing "let x =3D 3", and added "Foo" at the end of myutop.mltop. >>= >> >> Then, if I compile the custom toplevel using the provided Makefile >> (w= hich >> simply uses ocamlbuild and the builtin rule for .mltop files, I >> guess= ), >> the toplevel produced does not have access to the Foo module. >> >> Howe= ver, >> if I manually build using ocamlfind ocamlmktop: >> >> ocamlfind ocamlm= ktop >> -o myutop -thread -linkpkg -package utop foo.cmo >> myutop_main.cmo >> >> >> this time, it works, and `myutop` has access to Foo. >> >> Is the default >> ocamlbuild rule for building .mltop files missing some >> option? Am I >> doing something wrong? >> >> =E2=80=94 Arma=C3=ABl >> >> -- >> 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 Jeremie