English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
OCaml 3.11.0+beta1 cross-compiler
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: ANNOUNCE: Windows cross-compiler (was: Re: [Caml-list] OCaml 3.11.0+beta1 cross-compiler)
[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.

  (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

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:

       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)


  $ 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"

There are about a million things to fix, but this should be enough to
get people started.


[1] https://fedoraproject.org/wiki/MinGW

Richard Jones
Red Hat