[m-dev.] Porting Mercury 0.9.1 to Darwin

Roy Ward roy at albatross.co.nz
Thu Aug 3 00:49:10 AEST 2000


(Fergus Henderson suggested I send a copy of this here. I'll also send any
updates here if I improve these instructions - Roy).

Brief instructions for getting Mercury to run under Darwin 1.0.2 (and hence
possibly Macos X).

Some Caveats:
=============

1) This has only been tested with Mercury release 0.9.1. It doesn't yet
work on rotd 2000-06-27 (there's problems I haven't dealt with there).
2) These changes are all hacks - there are certainly better ways of doing
things. These changes will also break the code for any other platform.
3) Only grade none.gc has been tested afterwards - certainly grade
asm_fast.gc doesn't work (This may be lack of PowerPC support rather than a
Darwin problem though).
4) I think things such as shared libraries and library stripping are
disabled - code is pretty bloated.
5) This has only been tested with Darwin 1.0.2

Summary of issues:
==================
- configuration information
- no math library
- gcc vs. cc
- library issues.

On with the hacks:
==================

1) get recent versions of config.sub and config.guess

cp /usr/libexec/config.* .

This is so that the configure command knows what platform we are on

2) The garbage collector needs to be told separately which platform we are
on. Rrecent versions of the boehm gc know about this, but the version that
Mercury uses doesn't, so a hack for this is to add the line

#define macosx

somewhere near the top of boehm_gc/gcconfig.h

3) Darwin doesn't have the normal libm.a that most Unixes have (the math
stuff is linked in automatically), so -lm is an error. It is supposed to be
possible to create a dummy libm.a to work around this (Mercury isn't the
only port to suffer from this - even some of Darwins makefiles have to be
changed), but I couldn't get it to go.

Rremove the -lm from:
the end of the definition MLLIBS (about line 50) of compiler/Mmakefile,
the end of the definition MLLIBS (about line 50) of profiler/Mmakefile,
the definition SHARED_LIBS (about line 34) of scripts/ml,
the definition of STDLIBS (about line 987) of scripts/ml,
anywhere else it causes trouble.

4) There is no gcc in Darwin - it's called cc (but is still actually gcc,
just with a different name).

Change gcc to cc in the definition SHARED_LIBS (about line 34) of scripts/ml.

5) I'm not sure how Darwin handles library stripping, but it didn't like
the -s on about line 950 of scripts/ml, so remove it. (Actually, it would
be better to set the $strips variable correctly, but I said that this was a
hack).

6) After I compiled and installed Mercury, I found that I had to ranlib a
few libraries. I was prompted for this.

You can email me roy at albatross.co.nz about any feedback about this

Good luck,
Roy Ward.


--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list