Skip to content

Commit

Permalink
Merge pull request dmlc#490 from phunterlau/master
Browse files Browse the repository at this point in the history
add static link to gcc + openmp for MAC
  • Loading branch information
tqchen committed Sep 14, 2015
2 parents dd31267 + 529b804 commit b1c94c7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,17 @@ endif
ifeq ($(no_omp),1)
CFLAGS += -DDISABLE_OPENMP
else
CFLAGS += -fopenmp
#CFLAGS += -fopenmp
ifeq ($(omp_mac_static),1)
#CFLAGS += -fopenmp -Bstatic
CFLAGS += -static-libgcc -static-libstdc++ -L. -fopenmp
#LDFLAGS += -Wl,--whole-archive -lpthread -Wl --no-whole-archive
else
CFLAGS += -fopenmp
endif
endif


# by default use c++11
ifeq ($(cxx11),1)
CFLAGS += -std=c++11
Expand Down
12 changes: 12 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@

# See additional instruction in doc/build.md

#for building static OpenMP lib in MAC for easier installation in MAC
#doesn't work with XCode clang/LLVM since Apple doesn't support,
#needs brew install gcc 4.9+ with OpenMP. By default the static link is OFF
static_omp=0
if ((${static_omp}==1)); then
rm libgomp.a
ln -s `g++ -print-file-name=libgomp.a`
make clean
make omp_mac_static=1
echo "Successfully build multi-thread static link xgboost"
exit 0
fi

if make; then
echo "Successfully build multi-thread xgboost"
Expand Down

0 comments on commit b1c94c7

Please sign in to comment.