Skip to content

Commit 6c9d63e

Browse files
authored
Merge pull request #302 from wegank/docs-fix-1
Provide better docs for building on macOS
2 parents befad17 + afd35f0 commit 6c9d63e

1 file changed

Lines changed: 22 additions & 12 deletions

File tree

INSTALL

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,35 @@ via github releases)
3030
4. Run `make install` in order to globally install the library and the binary
3131
of msolve.
3232

33+
Note to macOS users
34+
===================
3335

36+
On macOS, we recommend building msolve with LLVM Clang rather than Apple Clang,
37+
as LLVM Clang provides better OpenMP support. You can install LLVM Clang and
38+
the required dependencies with Homebrew:
3439

35-
NOTE TO MAC OS users
36-
====================
40+
```shell
41+
brew install autoconf automake flint gmp libomp libtool llvm mpfr
42+
```
3743

38-
To build a static binary file, you may need to run `./configure --enable-static`.
44+
Before building as described above, make sure to set these environment
45+
variables so the build uses the correct compiler and flags:
3946

40-
You may also need to proceed slightly differently by modifying the `Makefile` file as follows
41-
- add to the `LIBS` variable the `-fopenmp` option
42-
```
43-
LIBS = -lflint -lmpfr -lgmp -lm -fopenmp
44-
```
45-
- change the `CC` variable to your actual `gcc` compiler, e.g.
47+
```shell
48+
export CC="$(brew --prefix llvm)/bin/clang"
49+
export CFLAGS="-I$(brew --prefix)/include -I$(brew --prefix libomp)/include"
50+
export LDFLAGS="-L$(brew --prefix)/lib -L$(brew --prefix libomp)/lib"
4651
```
47-
CC = gcc-15
48-
```
49-
since by default `gcc` on MacOS is linked to `clang`.
5052

53+
If you choose a different compiler toolchain, such as GCC, make sure only one
54+
OpenMP runtime is linked. You can verify this with
55+
56+
```shell
57+
otool -L path/to/libmsolve.dylib
58+
```
5159

60+
If both `libomp` (LLVM's OpenMP runtime) and `libgomp` (GCC's OpenMP runtime)
61+
are listed, rebuild with a consistent toolchain and matching linker flags.
5262

5363
If you want to generate a distribution
5464
======================================

0 commit comments

Comments
 (0)