Skip to content

Commit

Permalink
Merge pull request #105 from yarny/fixed_mac_build
Browse files Browse the repository at this point in the history
Use static link on Mac version.
  • Loading branch information
criver authored Aug 5, 2016
2 parents 00da8b3 + 64a9054 commit 509c07a
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 15 deletions.
Binary file modified python/gbdt/lib/darwin_x86_64/libgbdt.so
Binary file not shown.
Binary file removed python/gbdt/lib/libgbdt.so
Binary file not shown.
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import sys

here = path.abspath(path.dirname(__file__))
sys.path.append('{0}/python'.format(here))
from gbdt import __version__

# Get the long description from the README file
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
Expand All @@ -22,7 +20,7 @@
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version=__version__,
version="0.21-beta",

description='GBDT',
long_description=long_description,
Expand Down
25 changes: 14 additions & 11 deletions setup_dependencies/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,42 +20,42 @@ function SystemType() {
}

function InstallGPerf() {
if [[ -e /usr/lib/libtcmalloc.a ]]; then
if [[ -e $1/lib/libtcmalloc.a ]]; then
return
fi
WORK_DIR=$PWD
cd /tmp
git clone https://github.com/gperftools/gperftools.git
cd gperftools
./autogen.sh
./configure --prefix=$1 --enable-static
./configure --prefix=$1 --enable-static --disable-shared
export CXXFLAGS="-fPIC" && make && sudo make install
cd $WORK_DIR
}

function InstallGlog() {
if [[ -e /usr/lib/libglog.a ]]; then
if [[ -e $1/lib/libglog.a ]]; then
return
fi
WORK_DIR=$PWD
cd /tmp
git clone git://github.com/google/glog
cd glog
mkdir -p build && cd build
mkdir -p build_targets && cd build_targets
export CXXFLAGS="-fPIC" && cmake -DCMAKE_INSTALL_PREFIX=$1 .. && make VERBOSE=1
sudo make install
cd $WORK_DIR
}

function InstallGflags() {
if [[ -e /usr/lib/libgflags.a ]]; then
if [[ -e $1/lib/libgflags.a ]]; then
return
fi
WORK_DIR=$PWD
cd /tmp
git clone https://github.com/gflags/gflags.git
cd gflags
mkdir -p build && cd build
mkdir -p build_targets && cd build_targets
export CXXFLAGS="-fPIC"
cmake -DCMAKE_INSTALL_PREFIX=$1 -DGFLAGS_NAMESPACE=google ..
make && sudo make install
Expand Down Expand Up @@ -83,13 +83,16 @@ SYSTEM_TYPE=$(SystemType)

if [[ $SYSTEM_TYPE =~ "OSX" ]];
then
sudo brew install protobuf --devel
sudo brew install gflags
sudo brew install glog
InstallGPerf "/usr/local"
sudo brew install google-perftools
sudo brew link --overwrite gperftools
sudo rm /usr/loca/lib/libtcmalloc*dylib*

InstallProtoBuf3 "/usr/local"
InstallGflags "/usr/local"
InstallGlog "/usr/local"
else
InstallGPerf "/usr"
InstallProtoBuf3 "/usr"
InstallGflags "/usr"
InstallGlog "/usr"
InstallGPerf "/usr"
fi
1 change: 1 addition & 0 deletions src/data_store/tsv_data_store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "tsv_data_store.h"

#include <future>
#include <gflags/gflags.h>
#include <memory>
#include <string>
#include <unordered_map>
Expand Down
2 changes: 2 additions & 0 deletions src/gbdt_algo/compute_tree_scores.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#include "compute_tree_scores.h"

#include <gflags/gflags.h>

#include "split_algo.h"
#include "src/base/base.h"
#include "src/data_store/data_store.h"
Expand Down
1 change: 1 addition & 0 deletions src/gbdt_algo/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "utils.h"

#include <gflags/gflags.h>
#include <string>
#include <unordered_set>
#include <vector>
Expand Down
1 change: 1 addition & 0 deletions src/loss_func/loss_func_pairwise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "loss_func_pairwise.h"

#include <algorithm>
#include <gflags/gflags.h>
#include <string>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions src/loss_func/loss_func_pointwise.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "loss_func_pointwise.h"

#include <functional>
#include <gflags/gflags.h>
#include <numeric>
#include <vector>

Expand Down
1 change: 1 addition & 0 deletions src/python/gbdt_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

#include <gflags/gflags.h>
#include <glog/logging.h>

#include "datastore_py.h"
Expand Down
3 changes: 2 additions & 1 deletion src/python/train_gbdt_py.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@

#include "train_gbdt_py.h"

#include <vector>
#include <gflags/gflags.h>
#include <map>
#include <memory>
#include <vector>

#include "external/cppformat/format.h"
#include "datastore_py.h"
Expand Down

0 comments on commit 509c07a

Please sign in to comment.