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 die
if [ -n "$RW_MULTIPLATFORM_BUILD_IN_PROGRESS" ]; then
exit 0
fi
export RW_MULTIPLATFORM_BUILD_IN_PROGRESS=1
RW_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 name
if [[ "$SDK_NAME" =~ ([A-Za-z]+) ]]; then
RW_SDK_PLATFORM=${BASH_REMATCH[1]}
else
echo "Could not find platform name from SDK_NAME: $SDK_NAME"
exit 1
fi
# 2 - Extract the version from the SDK
if [[ "$SDK_NAME" =~ ([0-9]+.*$) ]]; then
RW_SDK_VERSION=${BASH_REMATCH[1]}
else
echo "Could not find sdk version from SDK_NAME: $SDK_NAME"
exit 1
fi
# 3 - Determine the other platform
if [ "$RW_SDK_PLATFORM" == "iphoneos" ]; then
RW_OTHER_PLATFORM=iphonesimulator
else
RW_OTHER_PLATFORM=iphoneos
fi
# 4 - Find the build directory
if [[ "$BUILT_PRODUCTS_DIR" =~ (.*)$RW_SDK_PLATFORM$ ]]; then
RW_OTHER_BUILT_PRODUCTS_DIR="${BASH_REMATCH[1]}${RW_OTHER_PLATFORM}"
else
echo "Could not find other platform build directory."
exit 1
fi
# 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_64
if [ "$RW_SDK_PLATFORM" == "iphonesimulator" ]; then
build_static_library "${SDK_NAME}"
fi
# Join the 2 static libs into 1 and push into the .framework
make_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 directories
cp -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 directory
ditto "${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.
Xcode 13.4.1 error: unable to attach DB: error: accessing build database (react native)
After almost one day of debugging this issue, came to know about this article which solves the problem for me, although article has more than one steps but I just tried the last one and it worked, mentioning the steps below,
rm -rf ~/Library/Developer/Xcode/DerivedData/
cd ios
pod deintegrate
pod update
cd..
yarn run ios or npm run ios
Xcode 10 beta error while building my project?
option:1
As I said with Legacy build system everything working fine but not with new build system.
option:2
Removed script and manually added SDK binary to my project tested with new build system works fine..
I am thinking with new build system when I am building SDK with help of script it's taking as two builds concurrently and throwing error.
Xcode build fail: Requested but did not find extension point
Quick fix:
Manually download Xcode Command Line Tools from https://developer.apple.com
Activate downloaded command line tools using
sudo xcode-select -s /Library/Developer/CommandLineTools
Restart Xcode
(only for official react-native setup): Comment out these lines from ios/Podfile:
use_flipper!()
# post_install do |installer|
react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
(only for official react-native setup): Run
pod update
Description of what went wrong:
I was finally able to fix the problem. Since I simply followed the setup guide for MacOs as described here, I think it is useful to elaborate on what I did in to fix the issue described above. Some people may face the same difficulties.
First things first: The underlying error is caused by Xcode itself.
error: unable to attach DB: error: accessing build database [...]
is only the consequence of the other two errors from the output, namely
Requested but did not find extension point with identifier Xcode [...]
These errors occur when running the application for the first time. When trying to restart the application, the earlier instance of the program still tries to access the database which causes the error.
Therefore, I will explain how to fix the missing dependencies Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS
and Xcode.DebuggerFoundation.AppExtensionHosts.watchOS
. I found out how to fix that error based on this Apple Community post. In my case, I had to manually install Xcode Command Line Tools from the Apple Developer Website. Next, Xcode has to integrate these downloaded command line tools using sudo xcode-select -s /Library/Developer/CommandLineTools
. Once you have restarted Xcode and followed the official setup guide from react-native you will face another build error.
This error will occur because the initial Xcode configuration collides with the Podfile generated by npm react-native init MyProject
on ios. To fix this, comment out lines from the podfile (see 4.) and after running pod update
, your setup of react-native should finally work.
I hope that I was able to help a couple of lost developers who want to get started with React Native for ios Apps.
Related Topics
Create a Copy of a Uiview in Swift
How to Use Core Location/Gps Without Any Internet Connection/Disabled Cellular Network
How to Lookup a String Constant at Runtime in Objective-C
Uicollectionview Spacing Margins
How to Make View the Size of Another View in Swiftui
Alternative iOS Layouts for Portrait and Landscape Using Just One .Xib File
Swift - How to Hide Back Button in Navigation Item
Distancefromlocation - Calculate Distance Between Two Points
Correct Implementation of Parent/Child Nsmanagedobjectcontext
Checking for Multiple Asynchronous Responses from Alamofire and Swift
Swiftui: What Is @Appstorage Property Wrapper
Why Is Uitextfield.Text an Optional
Swift 2.0 Sorting Array of Objects by Property
How to Change Uidatepicker to a Specific Time (In Code)
Getting a Normal Looking Unicode Down Arrow in a Uilabel Like This ⬇