You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2019/08/19 16:14:47 UTC

[kudu] branch master updated: [thirdparty] fix boost build with clang from Xcode

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e9c950  [thirdparty] fix boost build with clang from Xcode
9e9c950 is described below

commit 9e9c950df8255c6fa423b08170ce9e886c5c111c
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Sat Aug 17 21:52:09 2019 -0700

    [thirdparty] fix boost build with clang from Xcode
    
    The clang version string in Xcode (see [1]) uses slightly different
    format than clang built via MacPorts/Homebrew or clang on various
    Linux flavors.  This patch adapts the build_boost() function to work
    with clang from Xcode.
    
    [1] https://gist.github.com/yamaya/2924292
    
    Change-Id: I082af11af012cfb80a89ddb5ddf638100eb74574
    Reviewed-on: http://gerrit.cloudera.org:8080/14089
    Tested-by: Kudu Jenkins
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
---
 thirdparty/build-definitions.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/thirdparty/build-definitions.sh b/thirdparty/build-definitions.sh
index 6fd7cc0..f125ea5 100644
--- a/thirdparty/build-definitions.sh
+++ b/thirdparty/build-definitions.sh
@@ -866,10 +866,16 @@ build_boost() {
 
   # If CC and CXX are set, set the compiler in user-config.jam.
   if [ -n "$CC" -a -n "$CXX" ]; then
-    # Determine the name of the compiler referenced in $CC. This assumes the compiler
-    # prints its name as the first word of the first line, which appears to work for gcc
-    # and clang, even when they're called through ccache.
-    local COMPILER=$($CC --version | awk 'NR==1 {print $1;}')
+    # Determine the name of the compiler referenced in $CC. This assumes
+    # the compiler prints its name in the first line of the output. The pattern
+    # matching works for various flavors of GCC and LLVM clang. As the last
+    # resort, output the first word of the first line. The '$CC --version'
+    # approach appears to work even if the compiler is called through ccache.
+    local COMPILER=$($CC --version | \
+      awk '/(Apple )?(clang|LLVM) version [[:digit:]]+\.[[:digit:]]+/ {
+             print "clang"; exit }
+           /\(GCC\) [[:digit:]]+\.[[:digit:]]+/{ print "gcc"; exit }
+           { print $1; exit }')
 
     # If the compiler binary used was 'cc' and not 'gcc', it will also report
     # itself as 'cc'. Coerce it to gcc.