@@ -666,15 +666,15 @@ buildBoost_macOS()
666666 mkdir -p " $MACOS_OUTPUT_DIR "
667667
668668 echo building Boost for macOS
669- ./b2 $THREADS --build-dir=macos-build --stagedir=macos-build/stage toolset=clang \
670- --prefix= " $MACOS_OUTPUT_DIR /prefix " \
669+ ./b2 $THREADS --build-dir=macos-build --stagedir=macos-build/stage --prefix= " $MACOS_OUTPUT_DIR /prefix " \
670+ toolset=darwin- ${MACOS_SDK_VERSION} architecture=x86 \
671671 cxxflags=" ${CXX_FLAGS} ${MACOS_ARCH_FLAGS} ${EXTRA_MACOS_SDK_FLAGS} " \
672672 linkflags=" -stdlib=libc++ ${EXTRA_MACOS_SDK_FLAGS} " link=static threading=multi \
673673 macosx-version=${MACOS_SDK_VERSION} stage >> " ${MACOS_OUTPUT_DIR} /macos-build.log" 2>&1
674674 if [ $? != 0 ]; then echo " Error staging macOS. Check log." ; exit 1; fi
675675
676- ./b2 $THREADS --build-dir=macos-build --stagedir=macos-build/stage \
677- --prefix= " $MACOS_OUTPUT_DIR /prefix " toolset=clang \
676+ ./b2 $THREADS --build-dir=macos-build --stagedir=macos-build/stage --prefix= " $MACOS_OUTPUT_DIR /prefix " \
677+ toolset=darwin- ${MACOS_SDK_VERSION} architecture=x86 \
678678 cxxflags=" ${CXX_FLAGS} ${MACOS_ARCH_FLAGS} ${EXTRA_MACOS_SDK_FLAGS} " \
679679 linkflags=" -stdlib=libc++ ${EXTRA_MACOS_SDK_FLAGS} " link=static threading=multi \
680680 macosx-version=${MACOS_SDK_VERSION} install >> " ${MACOS_OUTPUT_DIR} /macos-build.log" 2>&1
@@ -1033,19 +1033,22 @@ if [[ -z $BUILD_IOS && -z $BUILD_TVOS && -z $BUILD_MACOS ]]; then
10331033 BUILD_MACOS=1
10341034fi
10351035
1036- # The EXTRA_FLAGS definition works around a thread race issue in
1036+ # Must set these after parseArgs to fill in overriden values
1037+ EXTRA_FLAGS=" -fembed-bitcode -Wno-unused-local-typedef -Wno-nullability-completeness"
1038+
1039+ # The EXTRA_ARM_FLAGS definition works around a thread race issue in
10371040# shared_ptr. I encountered this historically and have not verified that
10381041# the fix is no longer required. Without using the posix thread primitives
10391042# an invalid compare-and-swap ARM instruction (non-thread-safe) was used for the
10401043# shared_ptr use count causing nasty and subtle bugs.
10411044#
1042- # Should perhaps also consider/use instead: -BOOST_SP_USE_PTHREADS
1045+ # Note these flags (BOOST_AC_USE_PTHREADS and BOOST_SP_USE_PTHREADS) should
1046+ # only be defined for arm targets. They will cause random (but repeatable)
1047+ # shared_ptr crashes on macOS in boost thread destructors.
1048+ EXTRA_ARM_FLAGS=" -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -g -DNDEBUG"
10431049
1044- # Must set these after parseArgs to fill in overriden values
1045- EXTRA_FLAGS=" -DBOOST_AC_USE_PTHREADS -DBOOST_SP_USE_PTHREADS -g -DNDEBUG" `
1046- ` " -Wno-unused-local-typedef -fembed-bitcode -Wno-nullability-completeness"
1047- EXTRA_IOS_FLAGS=" $EXTRA_FLAGS -mios-version-min=$MIN_IOS_VERSION "
1048- EXTRA_TVOS_FLAGS=" $EXTRA_FLAGS -mtvos-version-min=$MIN_TVOS_VERSION "
1050+ EXTRA_IOS_FLAGS=" $EXTRA_FLAGS $EXTRA_ARM_FLAGS -mios-version-min=$MIN_IOS_VERSION "
1051+ EXTRA_TVOS_FLAGS=" $EXTRA_FLAGS $EXTRA_ARM_FLAGS -mtvos-version-min=$MIN_TVOS_VERSION "
10491052EXTRA_MACOS_FLAGS=" $EXTRA_FLAGS -mmacosx-version-min=$MIN_MACOS_VERSION "
10501053EXTRA_MACOS_SDK_FLAGS=" -isysroot ${MACOS_SDK_PATH} -mmacosx-version-min=${MIN_MACOS_VERSION} "
10511054
0 commit comments