Skip to content

Commit

Permalink
KUDU-1870: Fix Boost build to respect CC/CXX
Browse files Browse the repository at this point in the history
Boost doesn't respect the CC/CXX environment variables, but
they may have been set in the Kudu build environment. This
fixes this issue by configuring Boost's compiler using the
CC/CXX flags if they were set.

Testing:
- Ran thirdparty build locally, including for tsan. Checked
  that gcc/clang appeared to be set appropriately.
- Ran Impala's toolchain build with this change, verifying
  the toolchain compiler in CC/CXX was used.

Change-Id: I67002e074a67a3a83b8a96167906dbffe2db9522
Reviewed-on: http://gerrit.cloudera.org:8080/5986
Reviewed-by: Adar Dembo <[email protected]>
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <[email protected]>
  • Loading branch information
Matthew Jacobs authored and toddlipcon committed Feb 14, 2017
1 parent a29871f commit 3e659dc
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions thirdparty/build-definitions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -663,18 +663,10 @@ build_boost() {
BOOST_CXXFLAGS="$EXTRA_CXXFLAGS -fPIC -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG"
BOOST_LDFLAGS="$EXTRA_LDFLAGS"


case $BUILD_TYPE in
"normal")
# Default: use the default toolset.
;;
"tsan")
# We're using a custom clang, so we specify its path in the jamfile.
echo "using clang : : $CXX ;" > $USER_JAMFILE
echo "User jamfile location: $USER_JAMFILE"
echo "User jamfile contents:"
cat $USER_JAMFILE
TOOLSET="toolset=clang"
BOOST_LDFLAGS="-stdlib=libc++ $BOOST_LDFLAGS"
;;
*)
Expand All @@ -683,6 +675,21 @@ build_boost() {
;;
esac

# 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;}')

TOOLSET="toolset=${COMPILER}"
echo "Using $TOOLSET"
echo "using ${COMPILER} : : $CXX ;" > $USER_JAMFILE
echo "User jamfile location: $USER_JAMFILE"
echo "User jamfile contents:"
cat $USER_JAMFILE
fi

# Build the date_time boost lib.
./bootstrap.sh --prefix=$PREFIX threading=multi --with-libraries=date_time
./b2 clean $TOOLSET --build-dir="$BOOST_BDIR"
Expand Down

0 comments on commit 3e659dc

Please sign in to comment.