Re: Building a cross-compiling ocaml

From: Xavier Leroy (Xavier.Leroy@inria.fr)
Date: Tue Mar 07 2000 - 11:54:57 MET

  • Next message: Julian Assange: "types returned from exceptions"

    > I am trying to get ocaml to produce code that can be linked against
    > the libc of a different operating system (the University of Utah's
    > OSKit project, for those who may know it). The key facts are:
    >
    > - The target architecture is the same, so all the normal build tools
    > and commands work; I just need to add some compile-time and
    > link-time options so gcc will use the proper header files and
    > libraries.
    >
    > - I'm using a different libc than the native (Linux) one, so the
    > ocamlrun produced in this manner cannot be run locally. In other
    > words, the normal build process gives me a broken ocamlc.

    Right. You need a native ocamlrun to run ocamlc, not the
    cross-compiled ocamlrun.

    The easiest solution is as follows:
    - leave the sources in byterun/ unchanged, so that the normal build
      procedure of ocaml will work;
    - make a copy of byterun/ in, say, byterun.cross;
    - modify the sources and Makefile in byterun.cross so that they can be
      cross-compiled and produce an ocamlrun for your target OS;
    - use byterun.cross/ocamlrun to run OCaml bytecode executables
      on the target OS.

    > My understanding is that bytecode files are entirely
    > system-independent

    They are almost entirely system-independent. For instance, if the
    target system has different ASCII codes for '\n' and '\r' than the
    native system, text I/O will look funny. (This is the case if you
    cross-compile between MacOS on the one side, and Unix or Windows on
    the other side.) This is the only system dependence that I can
    remember right now.

    - Xavier Leroy



    This archive was generated by hypermail 2b29 : Wed Mar 08 2000 - 18:25:03 MET