Updated build.md for OS X

Ref: https://github.com/dmlc/xgboost/issues/596
This commit is contained in:
Dat Le 2015-11-04 13:54:56 +08:00
parent e436c94419
commit 117f26f865

View File

@ -17,7 +17,9 @@ Here is the complete solution to use OpenMp-enabled compilers to install XGBoost
1. Obtain gcc with openmp support by `brew install gcc --without-multilib` **or** clang with openmp by `brew install clang-omp`. The clang one is recommended because the first method requires us compiling gcc inside the machine (more than an hour in mine)! (BTW, `brew` is the de facto standard of `apt-get` on OS X. So installing [HPC](http://hpc.sourceforge.net/) separately is not recommended, but it should work.)
2. **if you are planing to use clang-omp** - in step 3 and/or 4, change line 9 in `xgboost/src/utils/omp.h` to
2. **if you are planing to use clang-omp**:
2.1 Change line 9 in `xgboost/src/utils/omp.h` to
```C++
#include <libiomp/omp.h> /* instead of #include <omp.h> */`
@ -27,27 +29,16 @@ Here is the complete solution to use OpenMp-enabled compilers to install XGBoost
`src/tree/../utils/omp.h:9:10: error: 'omp.h' file not found...`
3. Set the `Makefile` correctly for compiling cpp version xgboost then python version xgboost.
```Makefile
export CC = gcc-4.9
export CXX = g++-4.9
```
Or
2.2 Set the `Makefile` correctly for compiling cpp version xgboost then python version xgboost.
```Makefile
export CC = clang-omp
export CXX = clang-omp++
```
Remember to change `header` (mentioned in step 2) if using clang-omp.
Then `cd xgboost` then `bash build.sh` to compile XGBoost. And go to `python-package` sub-folder to install python version with `python setup.py install`.
Then `cd xgboost` then `bash build.sh` to compile XGBoost. And go to `wrapper` sub-folder to install python version.
4. Set the `Makevars` file in highest piority for R.
3. Set the `Makevars` file in highest piority for R.
The point is, there are three `Makevars` : `~/.R/Makevars`, `xgboost/R-package/src/Makevars`, and `/usr/local/Cellar/r/3.2.0/R.framework/Resources/etc/Makeconf` (the last one obtained by running `file.path(R.home("etc"), "Makeconf")` in R), and `SHLIB_OPENMP_CXXFLAGS` is not set by default!! After trying, it seems that the first one has highest piority (surprise!).