Xcode 10: unable to attach DB error Xcode 10: unable to attach DB error ios ios

Xcode 10: unable to attach DB error


Okay, seems like I managed to solve it. I was having /bin/sh script in Build Phases that was trying to build fat static library. In the script, I had OBJROOT path set like this:

OBJROOT="${OBJROOT}"

Seems like Xcode 10 and new build system changed some paths on the way and this line was the source of the issue. It needs to be adjusted to:

OBJROOT="${OBJROOT}/DependentBuilds"

After that, xcodebuild manages to build this target without issues with new build system introduced in Xcode 10.

I didn't get to this solution by myself, big thanks to Matt Gallagher and his post in here: https://github.com/mattgallagher/CwlSignal/issues/24#issuecomment-396931001


As requested by @TMin in comment, here's how my script looks like:

set -e# If we're already inside this script then dieif [ -n "$RW_MULTIPLATFORM_BUILD_IN_PROGRESS" ]; thenexit 0fiexport RW_MULTIPLATFORM_BUILD_IN_PROGRESS=1RW_FRAMEWORK_NAME=${PROJECT_NAME}RW_INPUT_STATIC_LIB="lib${PROJECT_NAME}.a"RW_FRAMEWORK_LOCATION="${BUILT_PRODUCTS_DIR}/static/${RW_FRAMEWORK_NAME}Sdk.framework"function build_static_library {    echo "1"    echo "${BUILD_DIR}"    # Will rebuild the static library as specified    #     build_static_library sdk    xcrun xcodebuild -project "${PROJECT_FILE_PATH}" \    -target "${TARGET_NAME}" \    -configuration "${CONFIGURATION}" \    -sdk "${1}" \    ONLY_ACTIVE_ARCH=NO \    BUILD_DIR="${BUILD_DIR}" \    OBJROOT="${OBJROOT}" \    BUILD_ROOT="${BUILD_ROOT}" \    SYMROOT="${SYMROOT}" $ACTION}function make_fat_library {    # Will smash 2 static libs together    #     make_fat_library in1 in2 out    xcrun lipo -create "${1}" "${2}" -output "${3}"}# 1 - Extract the platform (iphoneos/iphonesimulator) from the SDK nameif [[ "$SDK_NAME" =~ ([A-Za-z]+) ]]; thenRW_SDK_PLATFORM=${BASH_REMATCH[1]}elseecho "Could not find platform name from SDK_NAME: $SDK_NAME"exit 1fi# 2 - Extract the version from the SDKif [[ "$SDK_NAME" =~ ([0-9]+.*$) ]]; thenRW_SDK_VERSION=${BASH_REMATCH[1]}elseecho "Could not find sdk version from SDK_NAME: $SDK_NAME"exit 1fi# 3 - Determine the other platformif [ "$RW_SDK_PLATFORM" == "iphoneos" ]; thenRW_OTHER_PLATFORM=iphonesimulatorelseRW_OTHER_PLATFORM=iphoneosfi# 4 - Find the build directoryif [[ "$BUILT_PRODUCTS_DIR" =~ (.*)$RW_SDK_PLATFORM$ ]]; thenRW_OTHER_BUILT_PRODUCTS_DIR="${BASH_REMATCH[1]}${RW_OTHER_PLATFORM}"elseecho "Could not find other platform build directory."exit 1fi# Build the other platform.build_static_library "${RW_OTHER_PLATFORM}${RW_SDK_VERSION}"# If we're currently building for iphonesimulator, then need to rebuild#   to ensure that we get both i386 and x86_64if [ "$RW_SDK_PLATFORM" == "iphonesimulator" ]; thenbuild_static_library "${SDK_NAME}"fi# Join the 2 static libs into 1 and push into the .frameworkmake_fat_library "${BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}" \"${RW_OTHER_BUILT_PRODUCTS_DIR}/${RW_INPUT_STATIC_LIB}" \"${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}Sdk"# Ensure that the framework is present in both platform's build directoriescp -a "${RW_FRAMEWORK_LOCATION}/Versions/A/${RW_FRAMEWORK_NAME}Sdk" \"${RW_OTHER_BUILT_PRODUCTS_DIR}/static/${RW_FRAMEWORK_NAME}Sdk.framework/Versions/A/${RW_FRAMEWORK_NAME}Sdk"# Copy the framework to the project directoryditto "${RW_FRAMEWORK_LOCATION}" "${SRCROOT}/Frameworks/static/${RW_FRAMEWORK_NAME}Sdk.framework"

Problem is in build_static_library method in this line:

OBJROOT="${OBJROOT}" \

Changing that line to:

OBJROOT="${OBJROOT}/DependantBuilds" \

solves the issue for me.


Open XCode File->Project Settings

Build System->Legacy Build System

Configure XCode of version 10.0 project settings can solve the problem.


If you use build script to build submodule's libraries like me.You also need to disable new build system in your build script explicitly by using -UseModernBuildSystem=NO in your xcodebuild command.

For example:

xcodebuild -configuration "${CONFIGURATION}" -project "${PROJECT_NAME}.xcodeproj" -target "${TARGET_NAME}" -sdk "${OTHER_SDK_TO_BUILD}" ${ACTION} RUN_CLANG_STATIC_ANALYZER=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" SYMROOT="${SYMROOT}" -UseModernBuildSystem=NO