Skip to content

Commit 7384ff0

Browse files
mbendiksenfaithfracture
authored andcommitted
Fixed macOS target problem that caused user-config.jam to be ignored, and fixed macOS specific share_ptr crasher caused by using -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS. (#32)
Fixed crashing bug caused by using -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS flags with macOS build when thread destructor is called. Modified so those options are only used for arm targets (everything but macOS).
1 parent 951271b commit 7384ff0

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

boost.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,15 @@ buildBoost_macOS()
658658
mkdir -p "$MACOS_OUTPUT_DIR"
659659

660660
echo building Boost for macOS
661-
./b2 $THREADS --build-dir=macos-build --stagedir=macos-build/stage toolset=clang \
662-
--prefix="$MACOS_OUTPUT_DIR/prefix" \
661+
./b2 $THREADS --build-dir=macos-build --stagedir=macos-build/stage --prefix="$MACOS_OUTPUT_DIR/prefix" \
662+
toolset=darwin-${MACOS_SDK_VERSION} architecture=x86 \
663663
cxxflags="${CXX_FLAGS} ${MACOS_ARCH_FLAGS} ${EXTRA_MACOS_SDK_FLAGS}" \
664664
linkflags="-stdlib=libc++ ${EXTRA_MACOS_SDK_FLAGS}" link=static threading=multi \
665665
macosx-version=${MACOS_SDK_VERSION} stage >> "${MACOS_OUTPUT_DIR}/macos-build.log" 2>&1
666666
if [ $? != 0 ]; then echo "Error staging macOS. Check log."; exit 1; fi
667667

668-
./b2 $THREADS --build-dir=macos-build --stagedir=macos-build/stage \
669-
--prefix="$MACOS_OUTPUT_DIR/prefix" toolset=clang \
668+
./b2 $THREADS --build-dir=macos-build --stagedir=macos-build/stage --prefix="$MACOS_OUTPUT_DIR/prefix" \
669+
toolset=darwin-${MACOS_SDK_VERSION} architecture=x86 \
670670
cxxflags="${CXX_FLAGS} ${MACOS_ARCH_FLAGS} ${EXTRA_MACOS_SDK_FLAGS}" \
671671
linkflags="-stdlib=libc++ ${EXTRA_MACOS_SDK_FLAGS}" link=static threading=multi \
672672
macosx-version=${MACOS_SDK_VERSION} install >> "${MACOS_OUTPUT_DIR}/macos-build.log" 2>&1
@@ -1003,19 +1003,22 @@ if [[ -z $BUILD_IOS && -z $BUILD_TVOS && -z $BUILD_MACOS ]]; then
10031003
BUILD_MACOS=1
10041004
fi
10051005

1006-
# The EXTRA_FLAGS definition works around a thread race issue in
1006+
# Must set these after parseArgs to fill in overriden values
1007+
EXTRA_FLAGS="-fembed-bitcode -Wno-unused-local-typedef -Wno-nullability-completeness"
1008+
1009+
# The EXTRA_ARM_FLAGS definition works around a thread race issue in
10071010
# shared_ptr. I encountered this historically and have not verified that
10081011
# the fix is no longer required. Without using the posix thread primitives
10091012
# an invalid compare-and-swap ARM instruction (non-thread-safe) was used for the
10101013
# shared_ptr use count causing nasty and subtle bugs.
10111014
#
1012-
# Should perhaps also consider/use instead: -BOOST_SP_USE_PTHREADS
1015+
# Note these flags (BOOST_AC_USE_PTHREADS and BOOST_SP_USE_PTHREADS) should
1016+
# only be defined for arm targets. They will cause random (but repeatable)
1017+
# shared_ptr crashes on macOS in boost thread destructors.
1018+
EXTRA_ARM_FLAGS="-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -g -DNDEBUG"
10131019

1014-
# Must set these after parseArgs to fill in overriden values
1015-
EXTRA_FLAGS="-DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -g -DNDEBUG"`
1016-
`" -Wno-unused-local-typedef -fembed-bitcode -Wno-nullability-completeness"
1017-
EXTRA_IOS_FLAGS="$EXTRA_FLAGS -mios-version-min=$MIN_IOS_VERSION"
1018-
EXTRA_TVOS_FLAGS="$EXTRA_FLAGS -mtvos-version-min=$MIN_TVOS_VERSION"
1020+
EXTRA_IOS_FLAGS="$EXTRA_FLAGS $EXTRA_ARM_FLAGS -mios-version-min=$MIN_IOS_VERSION"
1021+
EXTRA_TVOS_FLAGS="$EXTRA_FLAGS $EXTRA_ARM_FLAGS -mtvos-version-min=$MIN_TVOS_VERSION"
10191022
EXTRA_MACOS_FLAGS="$EXTRA_FLAGS -mmacosx-version-min=$MIN_MACOS_VERSION"
10201023
EXTRA_MACOS_SDK_FLAGS="-isysroot ${MACOS_SDK_PATH} -mmacosx-version-min=${MIN_MACOS_VERSION}"
10211024

changelog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
-- 2018-09-20 --
2+
* Fixed macOS target problem that caused user-config.jam to be ignored
3+
* Fixed macOS specific share_ptr crasher caused by using -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS
4+
15
-- 2018-08-24 --
26
* Fixed incorrect ordering of params for tar command
37

0 commit comments

Comments
 (0)