Repository: incubator-impala Updated Branches: refs/heads/master bdad90e69 -> 25ba76287
IMPALA-5207,IMPALA-5214: distcc fixes enable_distcc should reset IMPALA_DISTCC_ENABLED, otherwise disable_distcc is not reversible. Remove the requirement of a toolchain at /opt/Impala-Toolchain. We can easily identify paths starting with $IMPALA_TOOLCHAIN and remap them in distcc.sh. Testing: Did a local build with distcc with IMPALA_TOOLCHAIN at a different location. Tried toggling disable_distcc and enable_distcc. Change-Id: Ic6456d0101cd15287c543cb576be6cd2391f1f26 Reviewed-on: http://gerrit.cloudera.org:8080/6655 Reviewed-by: Tim Armstrong <[email protected]> Reviewed-by: Matthew Jacobs <[email protected]> Tested-by: Impala Public Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/25ba7628 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/25ba7628 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/25ba7628 Branch: refs/heads/master Commit: 25ba76287e36181c3fce81239763532f98fc9420 Parents: bdad90e Author: Tim Armstrong <[email protected]> Authored: Mon Apr 17 12:02:56 2017 -0700 Committer: Impala Public Jenkins <[email protected]> Committed: Mon May 8 22:38:00 2017 +0000 ---------------------------------------------------------------------- bin/distcc/README.md | 7 ++----- bin/distcc/distcc.sh | 28 +++++++++------------------- bin/distcc/distcc_env.sh | 2 +- 3 files changed, 12 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/25ba7628/bin/distcc/README.md ---------------------------------------------------------------------- diff --git a/bin/distcc/README.md b/bin/distcc/README.md index df1913a..4ebca45 100644 --- a/bin/distcc/README.md +++ b/bin/distcc/README.md @@ -22,10 +22,6 @@ The rest of the setup is done for you; here is a short description of what they install it if you have a yum or apt-get based system. Otherwise you should install distcc and ccache yourself through whatever package manager your system uses. 1. Configure the remote distcc hosts. -1. Your local compiler needs to be at the same path as it is on the remote build slaves. - That path is /opt/Impala-Toolchain/<gcc-version-folder>/bin/gcc. In other words, make - sure the Impala toolchain is available at /opt/Impala-Toolchain. That can be done - through a symlink, and that's what the scripts will attempt to setup. # Usage @@ -82,7 +78,8 @@ source "$IMPALA_HOME"/bin/distcc/distcc_env.sh Where num jobs = 2x the number of cores on the machine. (2x is recommended by distcc.) 1. Start distcc. 1. Edit distcc_env.sh to include the new host. -1. Install all gcc and binutils versions from the toolchain into /opt/Impala-Toolchain. +1. Install all required gcc, clang, binutils, etc, versions from the toolchain into + /opt/Impala-Toolchain. 1. ccache stores its cache in $HOME/.ccache. Assuming distcc is running as a non-root user that has no $HOME, you must sudo mkdir /.ccache, then sudo chmod 777 /.ccache. 1. If distcc runs as "nobody", sudo -u nobody ccache -M 25G. This sets the size of the http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/25ba7628/bin/distcc/distcc.sh ---------------------------------------------------------------------- diff --git a/bin/distcc/distcc.sh b/bin/distcc/distcc.sh index 9173706..bfe7fc1 100755 --- a/bin/distcc/distcc.sh +++ b/bin/distcc/distcc.sh @@ -35,26 +35,16 @@ if [[ -z "$DISTCC_HOSTS" || -z "$CXX_COMPILER" ]]; then exit 1 fi -TOOLCHAIN_DIR=/opt/Impala-Toolchain -if [[ ! -d "$TOOLCHAIN_DIR" ]]; then - if [[ -n "$IMPALA_TOOLCHAIN" && -d "$IMPALA_TOOLCHAIN" ]]; then - if ! sudo -n -- ln -s "$IMPALA_TOOLCHAIN" "$TOOLCHAIN_DIR" &>/dev/null; then - echo The toolchain must be available at $TOOLCHAIN_DIR for distcc. \ - Try running '"sudo ln -s $IMPALA_TOOLCHAIN $TOOLCHAIN_DIR"'. 1>&2 - exit 1 - fi - fi - echo "The toolchain wasn't found at '$TOOLCHAIN_DIR' and IMPALA_TOOLCHAIN is not set." \ - Make sure the toolchain is available at $TOOLCHAIN_DIR and try again. 1>&2 - exit 1 -fi +REMOTE_TOOLCHAIN_DIR=/opt/Impala-Toolchain -CMD= -CMD_POST_ARGS= if $IMPALA_DISTCC_LOCAL; then - CMD="distcc ccache" + if [[ "$CXX_COMPILER" == "$IMPALA_TOOLCHAIN"* ]]; then + # Remap the local toolchain path to the remote toolchain path. + CXX_COMPILER=$REMOTE_TOOLCHAIN_DIR/${CXX_COMPILER#$IMPALA_TOOLCHAIN} + fi + CMD="distcc ccache $CXX_COMPILER" +else + CMD="$CXX_COMPILER" fi -CMD+=" $CXX_COMPILER" - -exec $CMD "$@" $CMD_POST_ARGS +exec $CMD "$@" http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/25ba7628/bin/distcc/distcc_env.sh ---------------------------------------------------------------------- diff --git a/bin/distcc/distcc_env.sh b/bin/distcc/distcc_env.sh index d92044a..28d8096 100644 --- a/bin/distcc/distcc_env.sh +++ b/bin/distcc/distcc_env.sh @@ -97,8 +97,8 @@ function disable_distcc { } function enable_distcc { + export IMPALA_DISTCC_ENABLED=true switch_compiler distcc - export IMPALA_BUILD_THREADS=$(distcc -j) if ! clean_cmake_files; then echo Failed to clean cmake files. 1>&2 return 1
