From 0428cd4ff7f0c34576ea9fd7a9c09c303a3373df Mon Sep 17 00:00:00 2001 From: Stephan Zuercher Date: Mon, 21 Aug 2017 10:08:11 -0700 Subject: [PATCH 1/4] build: fix gperftools build on OS X --- ci/build_container/build_recipes/gperftools.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ci/build_container/build_recipes/gperftools.sh b/ci/build_container/build_recipes/gperftools.sh index 47444293bade4..9a37e41277a3d 100755 --- a/ci/build_container/build_recipes/gperftools.sh +++ b/ci/build_container/build_recipes/gperftools.sh @@ -7,5 +7,12 @@ VERSION=2.6.1 wget -O gperftools-$VERSION.tar.gz https://github.com/gperftools/gperftools/releases/download/gperftools-$VERSION/gperftools-$VERSION.tar.gz tar xf gperftools-$VERSION.tar.gz cd gperftools-$VERSION + +if [[ `uname` == "Darwin" ]]; +then + # enable ucontext(3) + export CPPFLAGS="-D_XOPEN_SOURCE=1" +fi + LDFLAGS="-lpthread" ./configure --prefix=$THIRDPARTY_BUILD --enable-shared=no --enable-frame-pointers --disable-libunwind make V=1 install From dfb46e49dffd80ff29c1bd4ce2157c6e7dbaf9bb Mon Sep 17 00:00:00 2001 From: Stephan Zuercher Date: Mon, 21 Aug 2017 11:50:46 -0700 Subject: [PATCH 2/4] valid _XOPEN_SOURCE value for ucontext; _DARWIN_C_SOURCE for syscall --- ci/build_container/build_recipes/gperftools.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/build_container/build_recipes/gperftools.sh b/ci/build_container/build_recipes/gperftools.sh index 9a37e41277a3d..31698ac607129 100755 --- a/ci/build_container/build_recipes/gperftools.sh +++ b/ci/build_container/build_recipes/gperftools.sh @@ -10,8 +10,8 @@ cd gperftools-$VERSION if [[ `uname` == "Darwin" ]]; then - # enable ucontext(3) - export CPPFLAGS="-D_XOPEN_SOURCE=1" + # enable ucontext(3) and syscall + export CPPFLAGS="-D_XOPEN_SOURCE=500 -D_DARWIN_C_SOURCE" fi LDFLAGS="-lpthread" ./configure --prefix=$THIRDPARTY_BUILD --enable-shared=no --enable-frame-pointers --disable-libunwind From 4b39dfb90708676d8d3bd92f7dd0e5b371a1fc76 Mon Sep 17 00:00:00 2001 From: Stephan Zuercher Date: Mon, 21 Aug 2017 11:55:23 -0700 Subject: [PATCH 3/4] preserve existing CPPFLAGS --- ci/build_container/build_recipes/gperftools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build_container/build_recipes/gperftools.sh b/ci/build_container/build_recipes/gperftools.sh index 31698ac607129..168f3a89abc67 100755 --- a/ci/build_container/build_recipes/gperftools.sh +++ b/ci/build_container/build_recipes/gperftools.sh @@ -11,7 +11,7 @@ cd gperftools-$VERSION if [[ `uname` == "Darwin" ]]; then # enable ucontext(3) and syscall - export CPPFLAGS="-D_XOPEN_SOURCE=500 -D_DARWIN_C_SOURCE" + export CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D_DARWIN_C_SOURCE" fi LDFLAGS="-lpthread" ./configure --prefix=$THIRDPARTY_BUILD --enable-shared=no --enable-frame-pointers --disable-libunwind From 58b3689f883d069d2adf8c20b920d39eca559c38 Mon Sep 17 00:00:00 2001 From: Stephan Zuercher Date: Mon, 21 Aug 2017 15:15:21 -0700 Subject: [PATCH 4/4] better comment for flag stuff --- ci/build_container/build_recipes/gperftools.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/build_container/build_recipes/gperftools.sh b/ci/build_container/build_recipes/gperftools.sh index 168f3a89abc67..3f41a07322ba2 100755 --- a/ci/build_container/build_recipes/gperftools.sh +++ b/ci/build_container/build_recipes/gperftools.sh @@ -8,9 +8,9 @@ wget -O gperftools-$VERSION.tar.gz https://github.com/gperftools/gperftools/rele tar xf gperftools-$VERSION.tar.gz cd gperftools-$VERSION +# TODO(zuercher): Remove this workaround for https://github.com/gperftools/gperftools/issues/910 if [[ `uname` == "Darwin" ]]; then - # enable ucontext(3) and syscall export CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D_DARWIN_C_SOURCE" fi