Repository: incubator-hivemall Updated Branches: refs/heads/v0.5.0 059f3167c -> 1835bcd1c
Fixed the script Project: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/commit/19e8fb4d Tree: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/tree/19e8fb4d Diff: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/diff/19e8fb4d Branch: refs/heads/v0.5.0 Commit: 19e8fb4d56558ee1b9ea9ddba984288bf98889b5 Parents: 059f316 Author: Makoto Yui <[email protected]> Authored: Mon Jan 15 21:55:31 2018 +0900 Committer: Makoto Yui <[email protected]> Committed: Mon Jan 15 21:55:31 2018 +0900 ---------------------------------------------------------------------- bin/build_xgboost.sh | 58 ++++++++++++++++------------------------------- 1 file changed, 20 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/19e8fb4d/bin/build_xgboost.sh ---------------------------------------------------------------------- diff --git a/bin/build_xgboost.sh b/bin/build_xgboost.sh index 361058b..8aa7abe 100755 --- a/bin/build_xgboost.sh +++ b/bin/build_xgboost.sh @@ -20,28 +20,18 @@ # xgboost requires g++-4.6 or higher (https://github.com/dmlc/xgboost/blob/master/doc/build.md), # so we need to first check if the requirement is satisfied. -COMPILER_REQUIRED_VERSION="4.6" +# g++-4.7 or higher is required when building on Ubuntu 14.04 on Docker. +COMPILER_REQUIRED_VERSION=4.7 # See simple version normalization: http://stackoverflow.com/questions/16989598/bash-comparing-version-numbers function compiler_version { echo "$@" | awk -F. '{ printf("%03d%03d%03d\n", $1,$2,$3); }'; } arch=$(uname -s) if [ $arch = 'Darwin' ]; then - if [ -z $CC ]; then - if [ -x `which gcc-5` ]; then - export CC=`which gcc-5` - elif [ -x `which gcc-6` ]; then - export CC=`which gcc-6` - else - echo 'export CC=`which gcc-X`; is required.' - echo 'Run `brew install gcc-5; export CC=gcc-5;`' - exit 1 - fi - fi if [ -z $CXX ]; then - if [ -x `which g++-5` ]; then + if type "g++-5" > /dev/null 2>&1; then export CXX=`which g++-5` - elif [ -x `which g++-6` ]; then + elif type "g++-6" > /dev/null 2>&1; then export CXX=`which gcc-6` else echo 'export CXX=`which g++-X`; is required.' @@ -50,30 +40,22 @@ if [ $arch = 'Darwin' ]; then fi fi else - # linux defaults - if [ -z $CC ]; then - if [ -x `which gcc` ]; then - export CC=`which gcc` - else - echo 'gcc does not find. export CC=`which gcc-X`; is required.' - exit 1 - fi - fi - if [ -z $CXX ]; then - if [ -x `which g++` ]; then - export CC=`which g++` - COMPILER_VERSION_NUMBER=`g++ --version 2> /dev/null | grep ^g++ | \ - awk 'match($0, /[0-9]+\.[0-9]+\.[0-9]+/) {print substr($0, RSTART, RLENGTH)}'` - if [ $(compiler_version $COMPILER_VERSION_NUMBER) -lt $COMPILER_REQUIRED_VERSION ]; then - echo "You must compile xgboost with GNU g++-$COMPILER_REQUIRED_VERSION or higher," \ - "but the detected compiler was g++-$COMPILER_VERSION_NUMBER" - exit 1 - fi - else - echo 'g++ does not find. export CXX=`which g++-X`; is required.' - exit 1 - fi - fi + # linux defaults + if [ -z $CXX ]; then + if type "g++" > /dev/null 2>&1; then + export CXX=`which g++` + COMPILER_VERSION_NUMBER=`${CXX} --version 2> /dev/null | grep ^g++ | \ + awk 'match($0, /[0-9]+\.[0-9]+\.[0-9]+/) {print substr($0, RSTART, RLENGTH)}'` + if [ $(compiler_version $COMPILER_VERSION_NUMBER) -lt $COMPILER_REQUIRED_VERSION ]; then + echo "You must compile xgboost with GNU g++-$COMPILER_REQUIRED_VERSION or higher," \ + "but the detected compiler was g++-$COMPILER_VERSION_NUMBER" + exit 1 + fi + else + echo 'g++ does not find. export CXX=`which g++-X`; is required.' + exit 1 + fi + fi fi # Move to a top directory
