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 954DD7EEEF for ; Sat, 13 Jun 2015 14:07:26 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of edwin+ml-ocaml@etorok.net) identity=pra; client-ip=62.210.252.135; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="edwin+ml-ocaml@etorok.net"; x-sender="edwin+ml-ocaml@etorok.net"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of edwin+ml-ocaml@etorok.net designates 62.210.252.135 as permitted sender) identity=mailfrom; client-ip=62.210.252.135; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="edwin+ml-ocaml@etorok.net"; x-sender="edwin+ml-ocaml@etorok.net"; 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.etorok.net) identity=helo; client-ip=62.210.252.135; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="edwin+ml-ocaml@etorok.net"; x-sender="postmaster@mail.etorok.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BbBQDIG3xV/4f80j5cgxBUX4MewkECgSlMAQEBAQEBgQuEIwEBBCMdOAIBDgsYAgIFEwMLAgIJAwIBAgFFEwgCiC+yIXCEapIeAQaBIYojhB0eUoJogUWMaYZ3i0KBM5MCg1smgUmCMzsxgkcBAQE X-IPAS-Result: A0BbBQDIG3xV/4f80j5cgxBUX4MewkECgSlMAQEBAQEBgQuEIwEBBCMdOAIBDgsYAgIFEwMLAgIJAwIBAgFFEwgCiC+yIXCEapIeAQaBIYojhB0eUoJogUWMaYZ3i0KBM5MCg1smgUmCMzsxgkcBAQE X-IronPort-AV: E=Sophos;i="5.13,608,1427752800"; d="scan'208";a="136019702" Received: from mail.etorok.net ([62.210.252.135]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Jun 2015 14:07:25 +0200 Received: by mail.etorok.net (OpenSMTPD) with ESMTP id ff39ff58 for ; Sat, 13 Jun 2015 12:07:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=simple; d=etorok.net; h=message-id :date:from:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; s=ml; bh=V80ipIoJyb90Eh JN3/bRSSUITro=; b=mAiog0QeQRl8QRUHCNbrubHlouFIxjkNSssOnkrAt4Y3Il 8D7kPbkeHr4oN15IQgQPub19gLZ+njnifkT/386zzIZiQyL1ORJ9l32mUyWoDuMv vYG7WWtEtqCrvrBTin5DXcn4ek1Ce7SfFr7aqFQgkEHlJyVTPdYIRDtgr6EkA= DomainKey-Signature: a=rsa-sha1; c=simple; d=etorok.net; h=message-id :date:from:mime-version:to:subject:references:in-reply-to :content-type:content-transfer-encoding; q=dns; s=ml; b=Tr/sglBe HFh2Y67W8M0ce+Je8A9gsyAvmbfSoi16+IIFickGsoQpESpujjPRf+WUEYfu6m9E FHlpfcZ98xvfyLE8gKaC3UkJfEslAvmLXQszVrUpqW6S18UrzgmMZJVatzX/QshD /iMQlpD/H6z4N7nTWmcPb6u8W9e4MUiizLA= Received: by mail.etorok.net (OpenSMTPD) with ESMTPSA id 56d7c825 TLS version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO for ; Sat, 13 Jun 2015 12:07:24 +0000 (UTC) Message-ID: <557C1CFB.2030600@etorok.net> Date: Sat, 13 Jun 2015 15:07:23 +0300 From: =?UTF-8?B?VMO2csO2ayBFZHdpbg==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: caml-list@inria.fr References: In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Determining what code is depending on `Unix` On 06/13/2015 10:22 AM, Tim Cuthbertson wrote: > Hi all, > > I'm attempting to convert an existing (reasonably small) HTTP server written in OCaml to run on mirage's xen backend. I've gotten the compiler reasonably happy by replacing uses of Unix / Lwt_unix with appropriate mirage-compatible modules. But when it comes to link time, it seems that my application is still indirectly depending on Unix: > > + ocamlbuild -quiet -cflag -warn-error -cflag +a-3 -build-dir [...]/_build/mirage-xen -use-ocamlfind -lflags -g,-linkpkg,-dontlink,unix main.native.o > + ocamlfind ocamlopt -g -linkpkg -dontlink unix -output-obj -syntax camlp4o -package 'fat-filesystem, io-page, mirage-block-xen.front, batteries, yojson, safepass, sha, lwt, lwt.syntax, mirage-console.xen, mirage-types, mirage-types.lwt, mirage-net-xen, mirage-types,cohttp,cohttp.lwt, mirage-http, lwt, mirage.runtime, tcpip.stack-direct,tcpip.stack-socket,mirage-clock-xen,conduit.mirage' src/passe.cmx src/passe_server.cmx src/unikernel.cmx main.cmx -o main.native.o > File "_none_", line 1: > Error: No implementations provided for the following modules: > Unix referenced from /home/tim/.opam/mirage_4_01_0/lib/lwt/lwt-unix.cmxa(Lwt_engine), > /home/tim/.opam/mirage_4_01_0/lib/lwt/lwt-unix.cmxa(Lwt_unix), > /home/tim/.opam/mirage_4_01_0/lib/ipaddr/ipaddr_unix.cmxa(Ipaddr_unix) > Command exited with code 2. > > I can't figure out why those modules are being linked in, though. I have grepped all files in _build/mirage-xen/**/*.ml.depends (as well as my own source code), and nothing in there matches "unix", nor mentions any of the modules listed above. The only lwt_* matches are: > > Cohttp_lwt_body > Lwt_mutex > Lwt_stream > > Which all seem like they shouldn't depend on unix either directly or indirectly. > > Is there some way to see a tree / list of "what module in my source code is transitively depending on Unix, and via what modules is that dependency inherited?" Or even if there's no way to see a tree, is there a way to do it one step at a time (e.g "what is depending directly on Lwt_unix", then repeat the process for those modules listed until I see something that surprises me) > > Failing that, does anyone have tricks for weeding indirect `Unix` usage out of a codebase which is not directly using it? 'ocamlfind query -r' can be useful, in your case: $ ocamlfind query -r -p-format fat-filesystem io-page mirage-block-xen.front batteries yojson safepass sha lwt lwt.syntax mirage-console.xen mirage-types mirage-types.lwt mirage-net-xen mirage-types cohttp cohttp.lwt mirage-http lwt mirage.runtime tcpip.stack-direct tcpip.stack-socket mirage-clock-xen conduit.mirage | grep unix unix lwt.unix ipaddr.unix conduit.lwt-unix io-page.unix Drop cohttp.lwt, tcpip.stack-direct, tcpip.stack-socket (use tcpip.xen? and you already have mirage-http and cohttp.lwt-core), and then: $ ocamlfind query -r -p-format fat-filesystem io-page mirage-block-xen.front batteries yojson safepass sha lwt lwt.syntax mirage-console.xen mirage-types mirage-types.lwt mirage-net-xen mirage-types cohttp mirage-http lwt mirage.runtime mirage-clock-xen conduit.mirage | grep unix unix Best regards, --Edwin