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 7D3CD7F75C for ; Fri, 12 Sep 2014 17:34:35 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of adrien@notk.org) identity=pra; client-ip=91.121.71.147; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="adrien@notk.org"; x-sender="adrien@notk.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of adrien@notk.org designates 91.121.71.147 as permitted sender) identity=mailfrom; client-ip=91.121.71.147; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="adrien@notk.org"; x-sender="adrien@notk.org"; 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@nautica.notk.org) identity=helo; client-ip=91.121.71.147; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="adrien@notk.org"; x-sender="postmaster@nautica.notk.org"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgMFADYSE1RbeUeT/2dsb2JhbABfgw2EJs1FAYEPFniEBAEBBCNWEAsYAgIFEw4CAg8FGB0BE4hZqByVbQEXgSyNNAsRAVAHgnk2gR0FnQcBlT+DYzuBPoFAAQEB X-IPAS-Result: AgMFADYSE1RbeUeT/2dsb2JhbABfgw2EJs1FAYEPFniEBAEBBCNWEAsYAgIFEw4CAg8FGB0BE4hZqByVbQEXgSyNNAsRAVAHgnk2gR0FnQcBlT+DYzuBPoFAAQEB X-IronPort-AV: E=Sophos;i="5.04,513,1406584800"; d="scan'208";a="94400271" Received: from nautica.notk.org ([91.121.71.147]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 12 Sep 2014 17:34:25 +0200 Received: by nautica.notk.org (Postfix, from userid 1003) id 8ABA1C009; Fri, 12 Sep 2014 17:34:24 +0200 (CEST) Date: Fri, 12 Sep 2014 17:34:24 +0200 From: Adrien Nader To: Yotam Barnoy Cc: Ocaml Mailing List Message-ID: <20140912153424.GA13391@notk.org> References: <5410522E.3050207@inria.fr> <1410359012.3003.34.camel@thinkpad> <54106B6D.4040607@gmail.com> <54115517.9020209@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [Caml-list] One build system to rule them all? On Fri, Sep 12, 2014, Yotam Barnoy wrote: > Also, while I understand some of the windows hatred, the fact is, most of > the world uses windows. Even using cygwin as a translation layer hurts > ocaml's ability to reach people. Ideally, a windows programmer could > download opam, ocaml and perhaps a mingw compiler, and begin to build > projects without any need for a shell or anything POSIX-like. This means > that the build system needs to obviate the need for any shell commands or > makefiles. I'm worried it my message which sounded like Windows hatred. I don't hate Windows, really. I hate cmake and qt however because the design they _chose_ was already a step back more than a decade ago. It's similar to advocating static linking despite the current needs to regularly update libraries because of security issues. (NB: similar feelings towards people who do not use ocamlfind; hopefully they're very uncommon nowadays) As for using only cmd.exe. Well. You probably don't know cmd.exe. You probably don't know how command-line argument parsing works on Windows. I can't believe you would and not do your best to avoid them. The main issue is that the newly-launched process does not receive its arguments as an array of strings. Instead it receives them as a string. When you call execv() on windows, it concatenates the string array you've given and it will be the new process which will have to split them back into a "char* []" for use with main(). So you have to prepare your arguments. But how? According to the spec of course! Ah, easy! Except there is no real logic behind it: it's completely ad-hoc stuff and while probably doable with only a few lines of code (probably as many as this email), it's looks error-prone (and, let's face it, boring). Oh and, it might well break compat and the issue has been in OCaml since 1994. This is the reason ocamlbuild depends on an sh.exe from msys/cygwin btw (I'm actually wondering if cygwin's is fit for this task...). It will receive a single string of arguments, parse it like it would do on POSIX; in other words, its only purpose is to get back to well-known and manageable parsing rules. To be honest, OCamlbuild also has a large tendency to shell-out but in 90% of the cases, it's not a big issue although re-implementing "cp -r" is annoying (did someone mention that if ocamlbuild moves out of the compiler, it can depend on Fileutils which implements this kind of operations?). That said, ocamlbuild works well on Windows because besides these few shell-outs, it's written in OCaml. Btw, there are open bug reports on mantis about that. If you're interested in getting these fixed, the links to the docs are already there and the work is definitely manageable so speak up. Btw2, there's a fairly recent "zsh for windows" (last release from 2011 or 2012) and which, if it works, and if it works for our use-case, could maybe be integrated in the ocaml installers and could simplify the process. (note the number of "ifs" and conditionals used above) In any case, if you plan on integrating with something else, and you will, unless you don't want to use any C stubs, including the ones for the OS, you will have to understand and integrate into the existing C-building setups which already exist one way or another. -- Adrien Nader