kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject kudu git commit: KUDU-1961: enable ccache when using devtoolset-3
Date Thu, 26 Oct 2017 21:45:08 GMT
Repository: kudu
Updated Branches:
  refs/heads/master 6097e2d1a -> 13908bd9f


KUDU-1961: enable ccache when using devtoolset-3

The original approach outlined in the bug report doesn't work because
although /opt/rh/devtoolset-3/ is ahead of /usr/bin during
enable_devtoolset.sh, it isn't when make is invoked, so ccache ends up
using the old system compiler and the build fails.

So here's a more complicated approach: set CC/CXX to explicit ccache
"helper" scripts, in the style of those found in build-support/ccache-clang.
We do nothing if CC or CXX are already set; presumably the user knows better
than us.

In this manner, ccache is used by default in almost all cases. To opt out,
set CCACHE_DISABLE in the environment when running make.

Change-Id: Ic3a264fc9471e6486a3f17475697f1fa7b64a943
Reviewed-on: http://gerrit.cloudera.org:8080/8392
Tested-by: Adar Dembo <adar@cloudera.com>
Reviewed-by: Todd Lipcon <todd@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/13908bd9
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/13908bd9
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/13908bd9

Branch: refs/heads/master
Commit: 13908bd9f74e47ea4ff095e2ee45c5632b6fdd8c
Parents: 6097e2d
Author: Adar Dembo <adar@cloudera.com>
Authored: Wed Oct 25 12:56:19 2017 -0700
Committer: Adar Dembo <adar@cloudera.com>
Committed: Thu Oct 26 21:44:11 2017 +0000

----------------------------------------------------------------------
 build-support/ccache-devtoolset-3/c++    | 21 ++++++++++++++++
 build-support/ccache-devtoolset-3/cc     | 21 ++++++++++++++++
 build-support/enable_devtoolset.sh       | 11 ++++++---
 build-support/enable_devtoolset_inner.sh | 35 +++++++++++++++++++++++++++
 4 files changed, 84 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/13908bd9/build-support/ccache-devtoolset-3/c++
----------------------------------------------------------------------
diff --git a/build-support/ccache-devtoolset-3/c++ b/build-support/ccache-devtoolset-3/c++
new file mode 100755
index 0000000..522ab6a
--- /dev/null
+++ b/build-support/ccache-devtoolset-3/c++
@@ -0,0 +1,21 @@
+#!/bin/bash -e
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Helper script that invokes devtoolset-3's c++ via ccache.
+
+exec ccache /opt/rh/devtoolset-3/root/usr/bin/c++ "$@"

http://git-wip-us.apache.org/repos/asf/kudu/blob/13908bd9/build-support/ccache-devtoolset-3/cc
----------------------------------------------------------------------
diff --git a/build-support/ccache-devtoolset-3/cc b/build-support/ccache-devtoolset-3/cc
new file mode 100755
index 0000000..b93ab8e
--- /dev/null
+++ b/build-support/ccache-devtoolset-3/cc
@@ -0,0 +1,21 @@
+#!/bin/bash -e
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Helper script that invokes devtoolset-3's c++ via ccache.
+
+exec ccache /opt/rh/devtoolset-3/root/usr/bin/cc "$@"

http://git-wip-us.apache.org/repos/asf/kudu/blob/13908bd9/build-support/enable_devtoolset.sh
----------------------------------------------------------------------
diff --git a/build-support/enable_devtoolset.sh b/build-support/enable_devtoolset.sh
index f600188..a331c33 100755
--- a/build-support/enable_devtoolset.sh
+++ b/build-support/enable_devtoolset.sh
@@ -16,17 +16,20 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-
-set -e
-
+#
 # Enables the Red Hat devtoolset on RHEL 6 based systems and executes the
 # arguments. On non-RHEL 6 systems, the arguments are executed without changes
 # to the environment.
 # USAGE: ./enable_devtoolset.sh <command> <args>...
 
+set -e
+
 if [[ "$OSTYPE" =~ ^linux ]] && \
    [[ "$(lsb_release -irs)" =~ (CentOS|RedHatEnterpriseServer)[[:space:]]+6\.[[:digit:]]+
]]; then
-  scl enable devtoolset-3 "$*"
+  # Invoke the inner script, which may do some additional customization within
+  # the devtoolset.
+  ROOT=$(cd $(dirname "$BASH_SOURCE") ; pwd)
+  scl enable devtoolset-3 "$ROOT/enable_devtoolset_inner.sh $*"
 else
   $@
 fi

http://git-wip-us.apache.org/repos/asf/kudu/blob/13908bd9/build-support/enable_devtoolset_inner.sh
----------------------------------------------------------------------
diff --git a/build-support/enable_devtoolset_inner.sh b/build-support/enable_devtoolset_inner.sh
new file mode 100755
index 0000000..c597f1f
--- /dev/null
+++ b/build-support/enable_devtoolset_inner.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Executes the provided arguments within the context of a Red Hat devtoolset.
+#
+# This script should not be used directly; it is called by enable_devtoolset.sh.
+
+set -e
+
+# If ccache was on the PATH and CC/CXX have not already been set, set them to
+# devtoolset-3 specific ccache helper scripts (thus enabling ccache).
+if [ $(which ccache 2> /dev/null) -a ! "$CC" -a ! "$CXX" ]; then
+  ROOT=$(cd $(dirname "$BASH_SOURCE") ; pwd)
+  export CC="$ROOT/ccache-devtoolset-3/cc"
+  export CXX="$ROOT/ccache-devtoolset-3/c++"
+fi
+
+# Execute the arguments.
+$*


Mime
View raw message