Expanded MacOS Build Instructions
duncaneddy opened this issue · comments
First, I wanted to thank the authors and maintainers of KaMIS. It's a fantastic research as well as making, maintaining, and sharing KaMIS. It's very easy to get up and running as well as use. The update to migrate to using CMake is also a nice improvement.
For anyone who is developing and working on MacOS, I thought it might be helpful to share a little more detail on how I was able to get the project to build and run using the current release on MacOS (v10.15.6), gcc (v10.1.0), and KaMIS (v2.0).
-
Install Homebrew (https://brew.sh/)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-
Install gcc (which includes g++)
Even though MacOS claims it has g++ installed the default OS call ofg++
will actually result in a call toclang
and not g++.brew install gcc
As of this post will install g++ v10 which install the executable as
/usr/local/bin/g++-10
-
Install OpenMP
brew install libomp
-
Ensure that
/usr/local/bin
is part of the user PATH environment variable.
Brew installs bothg++
and the OpenMP library to/usr/local/bin
so it needs to be discoverable by CMake during compilation.
This can be done by adding the following to your your~/.bash_profile
(or whatever your shell profile is)export PATH=/usr/local/bin:$PATH
Then executing:
source ~/.bash_profile
-
Compile KaMIS using the g++-10 compile, instead of clang.
The default settings will have KaMIS try to compile with Clang, so instead we need to pass an extra variable to CMake to tell it to compile with g++ installed above. To do this we need to edit the base build script~/.compile_withcmake.sh
to change the line:cmake ../
to
cmake ../ -DCMAKE_C_COMPILER=/usr/local/bin/gcc-10 -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-10
-
Now you can run the base compile script as normal:
./compile_withcmake.sh
-
That’s it! You have now built KaMIS on MacOS.
Thanks a lot for the input! Could you issue a pull request, putting the description in a file called HowToMacOs.txt?
We could also do it, but then you would not get official credit on the github platform ;)
Thanks again!
Christian
Sure thing! Here's the PR for it. I made it as a markdown file so it renders nicely if viewed on github, but still can be readable as text. If you'd prefer it as a plain .txt
file happy to update the PR.
thanks!