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 E99807FFB6 for ; Tue, 15 Mar 2016 10:18:06 +0100 (CET) IronPort-PHdr: 9a23:ycWsThK1sg/7Wf6oI9mcpTZWNBhigK39O0sv0rFitYgULfrxwZ3uMQTl6Ol3ixeRBMOAu60C2rWd6vq8EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35vxhr/5osePKyxzxxODIppKZC2sqgvQssREyaBDEY0WjiXzn31TZu5NznlpL1/A1zz158O34YIxu38I46Fp34d6XK77Z6U1S6BDRHRjajhtpZ6jiR6WUguO+nYFT2wMkVIcHAjE8BzjQ57rsQPltuth1TCHNNf1C7cuVmLxwb1sTUrBhD0GOjhx1mjbh9Y42KtXuhOsoTR5xJLXJoaPO6wtLevmYdoGSD8ZDY5qXCtbD9b5NtNXAg== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=adrien@notk.org; spf=Pass smtp.mailfrom=adrien@notk.org; spf=None smtp.helo=postmaster@nautica.notk.org 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: A0A8BQAT0udW/5NHeVteg0ZSbYJtuWAZhXQCgTU8EAEBAQEBAQEBYyeCLYIVAQEEI1YQCxgCAgUTDgICDwUYHQETMYgLrG6PUAEBAQEBBQEBAQEcfIUehEKHOyuBDwWXT4Vvgi6DLYItCmSBARaNCoYKiHU3K4IDGYFKOy6KYwEBAQ X-IPAS-Result: A0A8BQAT0udW/5NHeVteg0ZSbYJtuWAZhXQCgTU8EAEBAQEBAQEBYyeCLYIVAQEEI1YQCxgCAgUTDgICDwUYHQETMYgLrG6PUAEBAQEBBQEBAQEcfIUehEKHOyuBDwWXT4Vvgi6DLYItCmSBARaNCoYKiHU3K4IDGYFKOy6KYwEBAQ X-IronPort-AV: E=Sophos;i="5.24,338,1454972400"; d="scan'208";a="207812308" Received: from nautica.notk.org ([91.121.71.147]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-GCM-SHA384; 15 Mar 2016 10:18:06 +0100 Received: by nautica.notk.org (Postfix, from userid 1003) id A0654C01D; Tue, 15 Mar 2016 10:18:05 +0100 (CET) Date: Tue, 15 Mar 2016 10:18:05 +0100 From: Adrien Nader To: whitequark Cc: "Soegtrop, Michael" , caml-list@inria.fr Message-ID: <20160315091805.GA835@notk.org> References: <0F7D3B1B3C4B894D824F5B822E3E5A172CEA76CE@IRSMSX102.ger.corp.intel.com> <921db39a51df11567295fcbbb1e6b394@whitequark.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <921db39a51df11567295fcbbb1e6b394@whitequark.org> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [Caml-list] [ANN] opam-cross-windows On Tue, Mar 15, 2016, whitequark wrote: > On 2016-03-15 11:26, Soegtrop, Michael wrote: > >Dear Whitequark, > > > >>I've released opam-cross-windows[1], a 4.02.3 OCaml toolchain in > >>the spirit > >>of opam-cross-android[2] (ex opam-android). > > > >Do you think there are good chances that this also works for cross > >compiling for MinGW on cygwin. > >Or asked in another way: are there known reasons why this > >shouldn't work? > > opam-cross-windows builds OCaml to run on top of bare Win32 i.e. it uses > win32unix and otherwise embeds such assumptions in the compiler > configuration. > Since Cygwin is striving to present a Unix-like environment, those > assumptions would not hold. So I don't think opam-cross-windows will > work on Cygwin, sorry. My understanding of the question was to build the cross-compiler from Cygwin rather than from Linux. As far as I'm concerned, I see no reason for this not to work besides small implementation. > >I made some scripts to compile things like GTK, pango, cairo, ocaml, > >menhir, Coq, CoqIDE, ... for MinGW on cygwin and also to setup cygwin > >with the required packages automatically in a reproducible way. A > >MinGW cross Opam for cygwin would be the logical next step. Together > >with my scripts this might be a reproducible and maintainable way to > >compile and setup ocaml and required libraries on Windows. > > Perhaps. I find Cygwin annoying to deal with so I don't care for it > much. > Feel free to fork opam-cross-windows and reuse my technique to solve > your problem. It can be adapted with minimal changes to almost any > set of host and target systems, given that the OCaml buildsystem > supports it. At that point I should point out win-builds.org which has the C packages buildable in a portable and reproducible manner. Not the OCaml ones because I hadn't been confident enough in its cross-compiler until now (seeing toplevel expressions not being evaluated sometimes has been a really cold shower). Unfotunately I need to finish a set of large changes before I can push a large update to win-builds that simplifies setup a lot. > >One more question: on Windows there is (or was) a circular dependency > >between flexdll and Ocaml. One of the two needs to be installed in > >binary form. Did you also run into this issue? If so, how did you > >solve it? > > Inherent deficiencies in the current OCaml buildsystem mean that > any cross-compiler build requires an OCaml compiler targeting the build > system, with exactly matching version and bitness. Similarly, since > opam-cross-windows does not provide a compiler switch, an OCaml compiler > is inherently present (and it is required anyway to compile packages > which invoke build system components such as ppx, camlp4, cppo, etc). > So, the need to build flexdll does not present a problem. I saw mentions of flexdll being embedded in the compiler sources now too so that it is possible to break that loop. Haven't had time to try it though. In any case, as whitequark points out, there is no such loop for cross-compilers. > >Btw: I also experimented with MSys, MSys2 instead of cygwin, but found > >that cross compiling mayn packages for for MinGW under cygwin is > >easier than under MSys, MSys2. > > Note that opam-cross-windows uses a toolchain that targets plain Win32 > API without using any kind of POSIX emulation such as MSYS or Cygwin. It is important to note that Msys was never meant for people to compile and link against but only as a posix environment to run applications in. MSYS2 updates it against a much more recent cygwin and builds many many more things against it. However noone wants their application to link against any msys*. The difference between cygwin and msys is that with cygwin you do cross-compile while with msys* you light a candle, pray to $deity and hope that whatever you're building will not notice it is building in a posix-ish environment that automatically translates paths that go to and come from win32 applications depending on a set of heuristics. It is possible to do cross-compilation under msys* too but I've found it to be less reliable, especially with msys2 because it does weird things and changes every other day. In particular, issues when building an ocaml cross-compiler seemed impossible to understand. -- Adrien Nader