Files
mercury/README.macOS.md
Julien Fischer 736f6252d8 Update README.MacOS:
README.MacOS:
    Rename to README.macOS.md.

    Fix markdown in a few spots.

    Add a missing word.

    Describe the OS as "macOS", which is what Apple currently call it.

    Fix up some links.

README.md:
    Conform to the above change.
2023-01-22 16:26:02 +11:00

96 lines
3.2 KiB
Markdown

Mercury on macOS
================
This file documents the port of Mercury to macOS / OS X / Mac OS X
(i.e. the `*-apple-darwin*` configuration).
Versions of macOS prior to 10.9 are not supported.
Contents
--------
* Mercury on Intel Macs
* Note for users of Xcode 11
* Deployment Target Settings
* Deep profiling on macOS
Mercury on Intel Macs
----------------------
Mercury should build and install "out-of-the-box" on Intel Macs using macOS
10.9 onwards.
The `asm_fast*` and `reg*` grades are only available on 64-bit Intel systems
and only when using GCC version 4.3 or later as the C compiler.
If `clang` is being used as the C compiler then the only low-level C grades
available are the `none*` grades. The high-level C, Java and C# grades
all work. The C# grades require the Mono .NET implementation.
(See [README.CSharp.md](README.CSharp.md) for further details.)
If the `asm_fast.gc` grade is not available, and unless otherwise directed,
then the `hlc.gc` grade will be used as the default grade for compiling
applications.
On x86-64 machines, the default is to install 64-bit versions of the
executables and libraries in the Mercury system. On machines running versions
of macOS up to and including 10.14, users can choose to install 32-bit versions
instead by invoking Mercury's `configure` script either with the option
```
--with-cc="clang -m32"
```
or
```
--with-cc="gcc -m32"
```
depending on their preferred compiler. In either case, every invocation
of the selected C compiler on Mercury-generated C files will specify
the `-m32` option. The reason for the limitation to 10.14 is that
32-bit executables are not supported at all from macOS 10.15 onwards.
If, after installing Mercury, you encounter errors about missing `.mih` files,
and you have fink installed, then try removing the fink components from your
`PATH` (these usually start with `/sw`) and reinstalling.
Note for users of Xcode 11
--------------------------
Versions of Xcode 11 prior to 11.4 ship with a broken version of `clang`
that *cannot* be used to compile Mercury. The `configure` script will print
a warning if it detects that you are using the broken version.
A discussion of this issue can be found at
[this](<https://forums.developer.apple.com/thread/121887>) thread in the Apple
Developer forum.
This
[post](https://github.com/Mercury-Language/mercury/issues/88#issuecomment-624329679)
describes a way that has been found to fix the problem.
Deployment Target Settings
--------------------------
By default, the Mercury compiler is configured so that the macOS deployment
target for code generated by the Mercury compiler is set to the value of the
`MACOSX_DEPLOYMENT_TARGET` environment variable (if set), or else to the macOS
version of the host system.
You can specify a different deployment target at configuration time using
the `configure` script's `--with-macosx-deployment-target` option.
(See the "SDK Compatibility Guide" in the Apple developer documentation
for further information about the deployment target setting.)
Deep profiling on macOS
-----------------------
The Mercury deep profiler requires a local web server. To use the deep
profiler:
- Select and install a web server, and
- Install and enable the `mdprof_cgi` script according to the rules of that
web server.