From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=AWL,DNS_FROM_SECURITYSAGE, SPF_FAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id AFC09BB84 for ; Sat, 15 Nov 2008 20:02:52 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArIDADurHknAXQIngWdsb2JhbACTVgEBFiK6DoJ5 X-IronPort-AV: E=Sophos;i="4.33,611,1220220000"; d="scan'208";a="17241659" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 15 Nov 2008 20:02:52 +0100 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id mAFJ2qcu030660 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 15 Nov 2008 20:02:52 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArIDADurHklQRFuwgWdsb2JhbACTVgEBFiK6DoJ5 X-IronPort-AV: E=Sophos;i="4.33,611,1220220000"; d="scan'208";a="19992831" Received: from furbychan.cocan.org ([80.68.91.176]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 15 Nov 2008 20:02:51 +0100 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1L1QPz-0005k7-3l for caml-list@inria.fr; Sat, 15 Nov 2008 19:02:51 +0000 Date: Sat, 15 Nov 2008 19:02:51 +0000 To: caml-list@inria.fr Subject: ANNOUNCE: Windows cross-compiler (was: Re: [Caml-list] OCaml 3.11.0+beta1 cross-compiler) Message-ID: <20081115190250.GA21705@annexia.org> References: <20081114125733.GA30050@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20081114125733.GA30050@annexia.org> User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Miltered: at concorde with ID 491F1CDC.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 ocaml:01 mingw:01 mingw:01 -ocamlopt:01 ocamlopt:01 bytecode:01 ocamlrun:01 cmx:01 cmxa:01 stdlib:01 dynlink:01 printf:01 printf:01 ocamlrun:01 [Oh well, the overwhelming rush of answers seems to indicate we are entering into new territory here ...] Here is a Linux -> Win32 OCaml cross-compiler, developed and sponsored by Red Hat's Fedora MinGW project[1]. Red Hat are sponsoring this project so that we can build our OCaml virt tools for Windows without the hassle of using Windows. http://hg.et.redhat.com/misc/fedora-mingw--devel/ (There is no direct link - to get the latest version you have to click "manifest" then "ocaml"). If you're not familiar with RPM builds, then start with the .spec file and the patches. Pay close attention to the 'BuildRequires' which are the parts of the MinGW project you will need to build it - in particular, we use a version of FlexDLL which we have modified for cross-compilation. It's probably best to say what does work, because the list of what _doesn't_ work is quite long. But with this you get: i686-pc-mingw32-ocamlopt The cross-compiler replacement for ocamlopt (bytecode so you need a corresponding ocamlrun interpreter to use it) *.cmx, *.cmxa The usual OCaml stdlib libraries, eg. nums, dynlink, unix, threads (only lightly tested) eg: $ cat /tmp/test.ml open Printf let () = printf "reported os_type = %S\n" Sys.os_type; printf "ok\n" $ boot/ocamlrun i686-pc-mingw32-ocamlopt -verbose -I stdlib /tmp/test.ml \ -o /tmp/test.exe + i686-pc-mingw32-as -o '/tmp/test.o' '/tmp/camlasm56b36c.s' + i686-pc-mingw32-as -o '/tmp/camlstartup4b26a5.o' '/tmp/camlstartup76cf6d.s' + flexlink -chain mingw -exe -o '/tmp/test.exe' -I'/usr/lib64/i686-pc-mingw32-ocaml' '-Lstdlib' '-L/usr/lib64/i686-pc-mingw32-ocaml' '/tmp/camlstartup4b26a5.o' 'stdlib/std_exit.o' '/tmp/test.o' 'stdlib/stdlib.a' 'stdlib/libasmrun.a' $ file /tmp/test.exe /tmp/test.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit $ wine /tmp/test.exe reported os_type = "Win32" ok There are about a million things to fix, but this should be enough to get people started. Rich. [1] https://fedoraproject.org/wiki/MinGW -- Richard Jones Red Hat