Skip to content

Commit

Permalink
Merge pull request #6 from criteo-forks/fix_linux_build
Browse files Browse the repository at this point in the history
Do not build xgboost with libhdfs support
  • Loading branch information
trams authored Jul 22, 2019
2 parents ded7bd2 + d4c0fcd commit b489321
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 57 deletions.
6 changes: 0 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ matrix:

env:
global:
- LIBHDFS_DIR=$HOME/libhdfs-dev
- HADOOP_VERSION=2.6.0-cdh5.5.0
- SPARK_VERSION=2.4.1
- XGBOOST_BASE_VERSION=0.90-criteo-20190702
Expand All @@ -36,7 +35,6 @@ script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
docker run
-e XGBOOST_VERSION
-e LIBHDFS_DIR
-e HADOOP_VERSION
-e SCALA_VERSION
-e SPARK_VERSION
Expand All @@ -46,10 +44,6 @@ script:
/bin/bash -c "bash -xe /xgboost-jars/travis/docker.sh";
fi

cache:
directories:
- $LIBHDFS_DIR

deploy:
provider: releases
api_key:
Expand Down
48 changes: 0 additions & 48 deletions install_xgboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* XGBOOST_VERSION
* SCALA_VERSION
* SPARK_VERSION
* LIBHDFS_DIR containing libhdfs.{so,a} and hdfs.h
"""

from __future__ import print_function, unicode_literals
Expand All @@ -20,51 +19,6 @@
if __name__ == "__main__":
os.chdir("xgboost")
xgboost_dir = os.getcwd()
maybe_makedirs(os.path.join("lib", "native"))
maybe_makedirs(os.path.join("lib", "include"))

libhdfs_shared = {
"win32": "hdfs.dll",
"linux": "libhdfs.so",
"darwin": "libhdfs.dylib"
}[sys.platform]
libhdfs_static = {
"win32": "hdfs.lib",
"linux": "libhdfs.a",
"darwin": "libhdfs.a"
}[sys.platform]

libhdfs_dir = os.environ["LIBHDFS_DIR"]
shutil.copy(os.path.join(libhdfs_dir, libhdfs_static),
os.path.join("lib", "native"))
shutil.copy(os.path.join(libhdfs_dir, libhdfs_shared),
os.path.join("lib", "native"))
shutil.copy(os.path.join(libhdfs_dir, "hdfs.h"), "include")

if sys.platform == "win32":
maybe_makedirs("bin")
shutil.copy(os.path.join(libhdfs_dir, "winutils.exe"), "bin")

# HACK: library name was changed in the latest version.
# sed_inplace("CMakeLists.txt", "dmlccore", "dmlc")

# HACK: patch FindHDFS to support Windows.
sed_inplace(
"dmlc-core/cmake/Modules/FindHDFS.cmake",
"libhdfs.a",
"${CMAKE_STATIC_LIBRARY_PREFIX}hdfs${CMAKE_STATIC_LIBRARY_SUFFIX}")

# HACK: link with static libhdfs.
sed_inplace(
"dmlc-core/CMakeLists.txt",
"list(APPEND dmlccore_LINKER_LIBS ${HDFS_LIBRARIES}",
"list(APPEND dmlccore_LINKER_LIBS ${HDFS_STATIC_LIB}")

# HACK: add missing header.
sed_inplace(
"dmlc-core/src/io/hdfs_filesys.cc",
"// Copyright by Contributors",
"#include <algorithm>")

os.chdir("jvm-packages")
run("mvn -q -B versions:set -DnewVersion=" + os.environ["XGBOOST_VERSION"])
Expand All @@ -88,8 +42,6 @@
"cmake ..",
"cmake .. -DCMAKE_BUILD_TYPE=Release ")

sed_inplace("create_jni.py", '"USE_HDFS": "OFF"', '"USE_HDFS": "ON"')

run("mvn -q install -pl :xgboost4j,:xgboost4j-spark "
"-DskipTests -Dmaven.test.skip",
env=dict(os.environ,
Expand Down
4 changes: 1 addition & 3 deletions travis/install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set -xe

mkdir -p $LIBHDFS_DIR
if [ ! -z `find $LIBHDFS_DIR -prune -empty` ]; then python ./install_libhdfs.py; fi
python ./install_xgboost.py
python ./install_xgboost.py

0 comments on commit b489321

Please sign in to comment.