Skip to content

Commit 042302f

Browse files
committed
DOC: Fix MacOS install instructions to use g++ over clang
1 parent 79a4c85 commit 042302f

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

doc/installation/dependencies.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,29 @@ If a path is printed, `cmake` is installed. To check the version, run `cmake
2121
The layout of this page is as follows:
2222

2323
- [Installing Dependencies](#installing-dependencies)
24-
- [Install C++ Compiler](#install-gcc)
24+
- [Install Compiler](#install-compiler)
2525
- [Install cmake](#install-cmake)
2626
- [Install JSON libraries](#install-json-libraries)
2727
- [Install Armadillo (and boost)](#install-armadillo-and-boost)
2828
- [Install NetCDF (optional)](#install-netcdf-optional)
2929

30-
## Install gcc
30+
## Install Compiler
3131

32-
On MacOS this can be installed, for
33-
example, using:
32+
On MacOS this can be installed, for example, using:
3433

3534
```bash
36-
sudo port install gcc11
35+
sudo port install g++
3736
```
3837

38+
> NOTE: On Macos, cmake will default to using clang instead of gcc.
39+
You need to set an environmental variable to tell cmake to use g++ instead.
40+
Do this with `export CXX=/opt/local/bin/g++`,
41+
and replace the path if it is placed somewhere different.
42+
3943
On Ubuntu, `gcc` (the C-compiler) is pre-installed, but the C++ compiler is not. This
4044
can be installed with (subsituting your machine's package manager command):
4145

42-
``bash
46+
```bash
4347
sudo apt install g++
4448
```
4549

@@ -103,7 +107,7 @@ sudo port install lapack
103107
sudo port install OpenBLAS
104108
sudo port install boost
105109
sudo port install armadillo
106-
sudo port install openmpi-bin libopenmpi-dev
110+
sudo port install openmpi
107111
```
108112

109113
## Install NetCDF (optional)
@@ -122,7 +126,7 @@ sudo port install netcdf-cxx4
122126
If you want the gcc version of netcdf, then:
123127

124128
```bash
125-
sudo port install netcdf-cxx4 +gcc10
129+
sudo port install netcdf-cxx4
126130
```
127131

128132
On Ubuntu, gcc is the default compiler, it seems like you can probably just do:

doc/installation/installation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ Here `FLAG` is a flag name and `VALUE` is the desired value (note the `-D`). A
9797
more complete discussion of the available compilation flags can be found on the
9898
[Compilation Options](build_opts.md) page.
9999

100-
If your default compiler isn't a GCC compiler, you will likely need to specify
101-
the desired GCC compiler at this step using:
100+
> If your default compiler isn't a GCC compiler, you will likely need to specify
101+
the desired GCC compiler at this step using the environmental variable `$CXX`, or:
102102

103-
```bash
103+
> ```bash
104104
cmake -DCMAKE_CXX_COMPILER=<gcc or mpi executable with full path>
105105
```
106106

0 commit comments

Comments
 (0)