[m-users.] Building Mercury on RiscOS, anybody tried ?
Julien Fischer
jfischer at opturion.com
Tue Jun 15 20:27:07 AEST 2021
Hi Sean,
On Tue, 15 Jun 2021, Sean Charles (emacstheviking) wrote:
> I have RiscOS on a Pi4 with 4GB of RAM… and it occurred to me that,
> with the rigour and beauty of Mercury, it would make a wonderful
> development tool, the FFI layer would be the first goal I guess to
> talk to the native UI libraries etc.
>
> I absolutely cannot believe how fast RiscOS runs even compared to
> 64-bit Ubuntu on the Pi, it feels like the good old days when a 1MHz
> 6502 was state of the art.
I'm not aware of anyone porting Mercury to RISC OS.
> I wondered what the technical hurdles might be… initially setting up a
> compiler environment for one thing and then, addressing the ‘unusual’
> way in which the RiscOS compiler addresses C files through a tree
> rather than a file extension, as I understand it so far.
A few pointers, when porting Mercury to a new platform you need to
consider:
* Does the Boehm GC work on the new platform?
* Is thre a usable build toolchain: C compiler, POSIX style shell,
GNU make, flex and bison available?
* Threads in Mecury currently assume the presence the POSIX threads
API.
Things may minimally work at that point, but most new ports also
require at least some of the following:
* Changes to runtime/mercury_conf_param.h to add macros related
to the new platform.
* Changes to the configure script, e.g. to tell the Mercury compiler
what flags to pass to the linker, how to build share objects on the
new platform.
Some tests in the configure script may need to be disabled or have
their results forced.
* To support the asm_fast and reg grades, various changes may need
to be made the runtime such as defining global registers (in
runtime/machdeps) and (maybe) runtime/mercury_goto.h. Also,
possibly to runtime/mercury_atomic_ops.h if the .par grades
are to be supported.
* Various places in scripts/mgnuc.in and scripts/ml.in may need
additions for the new platform. (Those scripts are what mmake
uses to "drive" the C compiler and linker respectively.)
The Mercury compiler itself may require similar changes in
compiler/compile_target_code.m so that mmc --make knows how
drive the C compiler toolchain.
* Platform dependent foreign_procs in the standard library may
need to be extended or have alternatives for the new platform
added. The io, dir and time modules are likely candidates for
requiring such changes.
> It MIGHT be easier to cross compile for ARM7 on my Mac though, if
> that’s possible with Mercury ?!
ARM7 should be supported, although it's been a while since anyone
has reported using it with Mercury. (It was being used with Linux,
last I heard anything about it.)
Recent ROTDs have a script for configuring Mercury as a cross compiler,
in tools/configure_cross. It currently supports cross compiling to
i686-*-mingw32, x86_64-*-mingw32 and aarch64-linux-gnu (see README.cross
for details), but it should be fairly straightforward to extend to other
platforms.
Julien.
More information about the users
mailing list