Fix MacOS build error. (#5080)

* Update build script.
* Update build doc.
This commit is contained in:
yage
2019-12-04 19:34:35 +08:00
committed by Jiaming Yuan
parent e3c34c79be
commit dcde433402
2 changed files with 27 additions and 23 deletions

View File

@@ -98,11 +98,11 @@ Building on OSX
Install with pip: simple method
--------------------------------
First, obtain ``gcc-8`` with Homebrew (https://brew.sh/) to enable multi-threading (i.e. using multiple CPU threads for training). The default Apple Clang compiler does not support OpenMP, so using the default compiler would have disabled multi-threading.
First, obtain ``gcc-9`` and ``OpenMP`` with Homebrew (https://brew.sh/) to enable multi-threading (i.e. using multiple CPU threads for training). The default Apple Clang compiler does not support OpenMP, so using the default compiler would have disabled multi-threading.
.. code-block:: bash
brew install gcc@8
brew install gcc@9 libomp
Then install XGBoost with ``pip``:
@@ -128,7 +128,7 @@ Now clone the repository:
git clone --recursive https://github.com/dmlc/xgboost
Create the ``build/`` directory and invoke CMake. Make sure to add ``CC=gcc-8 CXX=g++-8`` so that Homebrew GCC is selected. After invoking CMake, you can build XGBoost with ``make``:
Create the ``build/`` directory and invoke CMake. Make sure to add ``CC=gcc-9 CXX=g++-9`` so that Homebrew GCC is selected. After invoking CMake, you can build XGBoost with ``make``:
.. code-block:: bash
@@ -359,11 +359,11 @@ If all fails, try `Building the shared library`_ to see whether a problem is spe
Installing R package on Mac OSX with multi-threading
----------------------------------------------------
First, obtain ``gcc-8`` with Homebrew (https://brew.sh/) to enable multi-threading (i.e. using multiple CPU threads for training). The default Apple Clang compiler does not support OpenMP, so using the default compiler would have disabled multi-threading.
First, obtain ``gcc-9`` and ``OpenMP`` with Homebrew (https://brew.sh/) to enable multi-threading (i.e. using multiple CPU threads for training). The default Apple Clang compiler does not support OpenMP, so using the default compiler would have disabled multi-threading.
.. code-block:: bash
brew install gcc@8
brew install gcc@9 libomp
Now, clone the repository:
@@ -371,13 +371,13 @@ Now, clone the repository:
git clone --recursive https://github.com/dmlc/xgboost
Create the ``build/`` directory and invoke CMake with option ``R_LIB=ON``. Make sure to add ``CC=gcc-8 CXX=g++-8`` so that Homebrew GCC is selected. After invoking CMake, you can install the R package by running ``make`` and ``make install``:
Create the ``build/`` directory and invoke CMake with option ``R_LIB=ON``. Make sure to add ``CC=gcc-9 CXX=g++-9`` so that Homebrew GCC is selected. After invoking CMake, you can install the R package by running ``make`` and ``make install``:
.. code-block:: bash
mkdir build
cd build
CC=gcc-8 CXX=g++-8 cmake .. -DR_LIB=ON
CC=gcc-9 CXX=g++-9 cmake .. -DR_LIB=ON
make -j4
make install