Skip to content

Commit

Permalink
Disable UndefinedBehaviorSanitizer in debug build packages.
Browse files Browse the repository at this point in the history
Debug builds from CI have been crashing because they can't find the
UBSan dylib (even though it was in the bundles).
  • Loading branch information
kyleneideck committed Jun 21, 2020
1 parent ae724fe commit 026558d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ script:
./package.sh || (cat build_and_install.log && travis_terminate 1);
fi
# Install the .pkg.
# TODO: Debug packages are failing to install on Travis, but I can't reproduce the problem locally,
# so temporarily allow debug builds to pass even if the install fails.
- sudo installer -pkg Background-Music-*/BackgroundMusic-*.pkg -target / -verbose -dumplog || [[ "$TRAVIS_TAG" =~ .*DEBUG.* ]]
- sudo installer -pkg Background-Music-*/BackgroundMusic-*.pkg -target / -verbose -dumplog
# Print the installer logs. This only prints the current day's logs.
- echo -en '/var/log/install.log\ntravis_fold:start:install.log\\r'
- grep -A 9999 $(date +%Y-%m-%d) /var/log/install.log
Expand Down
10 changes: 10 additions & 0 deletions build_and_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,13 @@ else
ENABLE_ASAN="${ENABLE_ASAN:-NO}"
fi
enableUBSanArg() {
if [[ -n "$ENABLE_UBSAN" ]]; then
echo "-enableUndefinedBehaviorSanitizer"
echo "$ENABLE_UBSAN"
fi
}
# Clean all projects. Done separately to workaround what I think is a bug in Xcode 10.0. If you just
# add "clean" to the other xcodebuild commands, they seem to fail because of the DSTROOT="/" arg.
if [[ "${CLEAN}" != "" ]]; then
Expand Down Expand Up @@ -714,6 +721,7 @@ echo "[1/3] ${ACTIONING} the virtual audio device $(bold_face ${DRIVER_DIR}) to"
${SUDO} "${XCODEBUILD}" -scheme "Background Music Device" \
-configuration ${CONFIGURATION} \
-enableAddressSanitizer ${ENABLE_ASAN} \
$(enableUBSanArg) \
$(archivePath BGMDriver) \
BUILD_DIR=./build \
RUN_CLANG_STATIC_ANALYZER=0 \
Expand Down Expand Up @@ -743,6 +751,7 @@ xpcHelperInstallPathArg() {
${SUDO} "${XCODEBUILD}" -scheme BGMXPCHelper \
-configuration ${CONFIGURATION} \
-enableAddressSanitizer ${ENABLE_ASAN} \
$(enableUBSanArg) \
$(archivePath BGMXPCHelper) \
BUILD_DIR=./build \
RUN_CLANG_STATIC_ANALYZER=0 \
Expand All @@ -764,6 +773,7 @@ echo "[3/3] ${ACTIONING} $(bold_face ${APP_DIR}) to $(bold_face ${APP_PATH})" \
${SUDO} "${XCODEBUILD}" -scheme "Background Music" \
-configuration ${CONFIGURATION} \
-enableAddressSanitizer ${ENABLE_ASAN} \
$(enableUBSanArg) \
$(archivePath BGMApp) \
BUILD_DIR=./build \
RUN_CLANG_STATIC_ANALYZER=0 \
Expand Down
8 changes: 5 additions & 3 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ if [[ $packaging_operation == "repackage" ]]; then
elif [[ $packaging_operation == "make_debug_package" ]]; then
# Build using the debug configuration.
#
# Disable AddressSanitizer so we can distribute debug packages to users reporting bugs without
# worrying about loading the AddressSanitizer dylib in coreaudiod.
# Disable AddressSanitizer and UndefinedBehaviorSanitizer so we can distribute debug packages to
# users without worrying about loading the AddressSanitizer and UndefinedBehaviorSanitizer
# dylibs in coreaudiod. We've also had issues loading those dylibs in the other binaries when
# the binaries were built on other systems.
#
# TODO: Would debug packages be more useful if they were built with optimization (i.e. using the
# DebugOpt configuration instead of Debug)?
ENABLE_ASAN=NO bash build_and_install.sh -b -d
ENABLE_ASAN=NO ENABLE_UBSAN=NO bash build_and_install.sh -b -d
build_status=$?

# Set the paths to the build products (i.e. the bundles).
Expand Down

0 comments on commit 026558d

Please sign in to comment.