You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by ad...@apache.org on 2018/10/31 04:47:39 UTC

[2/2] kudu git commit: thirdparty: work around an upstream LLVM build race

thirdparty: work around an upstream LLVM build race

There is a long-standing race[1] in LLVM's build that seems to only manifest
when the compiler-rt LLVM project (used for sanitizers and the like) is
built via make with certain values of -j.

I spent some quality time with the compiler-rt build but was unable to find
its root cause, so instead let's work around it in our own build.

1. https://bugs.llvm.org/show_bug.cgi?id=26054

Change-Id: Ia3bf2a171b85d34326e187a4d14dbffe7326100d
Reviewed-on: http://gerrit.cloudera.org:8080/11834
Reviewed-by: Andrew Wong <aw...@cloudera.com>
Tested-by: Kudu Jenkins


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

Branch: refs/heads/master
Commit: 0b2fef41d8d0b4ffc1afe566597d764299620e72
Parents: 973fc9a
Author: Adar Dembo <ad...@cloudera.com>
Authored: Tue Oct 30 16:54:13 2018 -0700
Committer: Adar Dembo <ad...@cloudera.com>
Committed: Wed Oct 31 04:47:19 2018 +0000

----------------------------------------------------------------------
 thirdparty/build-definitions.sh | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/0b2fef41/thirdparty/build-definitions.sh
----------------------------------------------------------------------
diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index 203d84d..d0c47ba 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -336,7 +336,27 @@ build_llvm() {
     $EXTRA_CMAKE_FLAGS \
     $LLVM_SOURCE
 
-  ${NINJA:-make} -j$PARALLEL $EXTRA_MAKEFLAGS install
+  # Retry the build a few times. Thanks to an LLVM bug[1], the build can fail
+  # sporadically when using certain values of $PARALLEL.
+  #
+  # 1. https://bugs.llvm.org/show_bug.cgi?id=26054
+  set +e
+  attempt_number=1
+  max_attempts=3
+  while true; do
+    ${NINJA:-make} -j$PARALLEL $EXTRA_MAKEFLAGS install
+    exit_status=$?
+    if [[ $exit_status -eq 0 ]]; then
+      break
+    elif [[ $attempt_number -lt $max_attempts ]]; then
+      echo "LLVM build failed, retrying"
+      attempt_number=$((attempt_number + 1))
+    else
+      echo "LLVM build failed $max_attempts times, aborting"
+      exit $exit_status
+    fi
+  done
+  set -e
 
   if [[ "$BUILD_TYPE" == "normal" ]]; then
     # Create a link from Clang to thirdparty/clang-toolchain. This path is used