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 319DB7EEEF for ; Sat, 13 Jun 2015 15:06:25 +0200 (CEST) Received-SPF: Neutral (mail3-smtp-sop.national.inria.fr: domain of simon.cruanes.2007@m4x.org does not assert whether or not 129.104.30.34 is permitted sender) identity=pra; client-ip=129.104.30.34; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="SRS0=pErC=GX=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-sender="simon.cruanes.2007@m4x.org"; x-conformance=sidf_compatible; x-record-type="spf2.0" Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of SRS0=pErC=GX=m4x.org=simon.cruanes.2007@bounces.m4x.org designates 129.104.30.34 as permitted sender) identity=mailfrom; client-ip=129.104.30.34; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="SRS0=pErC=GX=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-sender="SRS0=pErC=GX=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-conformance=sidf_compatible; x-record-type="spf2.0" Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of postmaster@mx1.polytechnique.org designates 129.104.30.34 as permitted sender) identity=helo; client-ip=129.104.30.34; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="SRS0=pErC=GX=m4x.org=simon.cruanes.2007@bounces.m4x.org"; x-sender="postmaster@mx1.polytechnique.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CzAQBfKnxVnCIeaIFcg2Rfgx6rbZBahx5MAQEBAQEBEgEBAQEBCAsJCSEuQQWDXQEFIw8BOxsJAiUdAgJFEgYBEhKICAMSBAmWBp0ZkQgDhVYLAQEBAR2LRIQdHoM6L4EWBYVVCo16AoRQiGaGJ491hCFtgkcBAQE X-IPAS-Result: A0CzAQBfKnxVnCIeaIFcg2Rfgx6rbZBahx5MAQEBAQEBEgEBAQEBCAsJCSEuQQWDXQEFIw8BOxsJAiUdAgJFEgYBEhKICAMSBAmWBp0ZkQgDhVYLAQEBAR2LRIQdHoM6L4EWBYVVCo16AoRQiGaGJ491hCFtgkcBAQE X-IronPort-AV: E=Sophos;i="5.13,608,1427752800"; d="scan'208,217";a="136023832" Received: from mx1.polytechnique.org ([129.104.30.34]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 13 Jun 2015 15:06:24 +0200 Received: from [10.145.229.144] (unknown [178.251.23.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id 10465140912E1; Sat, 13 Jun 2015 15:06:21 +0200 (CEST) User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----LCWNYOBOYBZU1Y3TZZOZIK7AH1M0FS" Content-Transfer-Encoding: 8bit From: Simon Cruanes Date: Sat, 13 Jun 2015 15:06:16 +0200 To: Tim Cuthbertson ,caml-list@inria.fr Message-ID: <8AD46EC2-3269-4DD5-B1E7-C518B33EAC07@m4x.org> X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Sat Jun 13 15:06:23 2015 +0200 (CEST)) X-Spam-Flag: No, tests=bogofilter, spamicity=0.126765, queueID=29803140912ED X-Org-Mail: simon.cruanes.2007@polytechnique.org Subject: Re: [Caml-list] Determining what code is depending on `Unix` ------LCWNYOBOYBZU1Y3TZZOZIK7AH1M0FS Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 I don't have a general answer for finding such dependencies, but in the list you have it seems there is at least batteries that depends on Unix. Le 13 juin 2015 09:22:28 UTC+02:00, Tim Cuthbertson a écrit : >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? > >Thanks, > - Tim Cuthbertson > >-- >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 -- Simon ------LCWNYOBOYBZU1Y3TZZOZIK7AH1M0FS Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit I don't have a general answer for finding such dependencies, but in the list you have it seems there is at least batteries that depends on Unix.

Le 13 juin 2015 09:22:28 UTC+02:00, Tim Cuthbertson <tim@gfxmonk.net> a écrit :
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?

Thanks,
 - Tim Cuthbertson

--
Simon ------LCWNYOBOYBZU1Y3TZZOZIK7AH1M0FS--