caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: caml-list@inria.fr
Subject: ANNOUNCE: Windows cross-compiler (was: Re: [Caml-list] OCaml 3.11.0+beta1 cross-compiler)
Date: Sat, 15 Nov 2008 19:02:51 +0000	[thread overview]
Message-ID: <20081115190250.GA21705@annexia.org> (raw)
In-Reply-To: <20081114125733.GA30050@annexia.org>

[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


  reply	other threads:[~2008-11-15 19:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-14 12:57 OCaml 3.11.0+beta1 cross-compiler Richard Jones
2008-11-15 19:02 ` Richard Jones [this message]
2008-11-16  4:20   ` ANNOUNCE: Windows cross-compiler (was: Re: [Caml-list] OCaml 3.11.0+beta1 cross-compiler) Romain Beauxis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081115190250.GA21705@annexia.org \
    --to=rich@annexia.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).