Xcode 11 GM - error: accessing build database - disk I/O error - objective-c

Encountering following error when only building a "Universal Binary Framework" for release distribution. Same project and settings works when building "Non-Universal" scheme in debug or release mode.
Project uses Objective-C & Xcode 11 GM (11A419c). Now, updating to Xcode 11 GM Seed 2 (11A420a).
error: accessing build database "/Users/john.doe/Library/Developer/Xcode/DerivedData/FrameworkSDK-esxhqchxkdevuiapyebthsdscpje/Build/Intermediates.noindex/XCBuildData/build.db": disk I/O error
Using following build command from a script:
xcodebuild -workspace ${PROJECT_NAME}.xcworkspace -scheme ${PROJECT_NAME} -sdk iphonesimulator -configuration ${CONFIGURATION} only_active_arch=no defines_module=yes clean build CONFIGURATION_BUILD_DIR=${BUILD_DIR}/${CONFIGURATION}-iphonesimulator 2>&1
Tried a few steps: Complete clean, pod update and steps mentioned on Related error for Xcode 10 & linked post - Doesn't solve this issue
No Answer on this question:
why error "accessing build database disk I/O error"?

In case someone is still stuck here.
I follow This Answer and get rid the disk I/O error.
Adding:
OBJROOT="${OBJROOT}/DependentBuilds"

Use Command Line Tools for Xcode 11
Ensuring that correct version of Command Line Tools (xcodebuild) is used works with complete clean & building universal framework fresh. And the project is using New Build System (Default). It also worked with Xcode 11 GM - Build 11A419c (seed 1).
Use following command to ensure proper link:
xcodebuild -version
Xcode 11.0
Build version 11A419c
Earlier it was using the old Xcode10.2 xcodebuild.
Alternative workaround(s)
Not a good fix as it usages Legacy Build System instead of modern system with Xcode 11.
One option is to use Legacy Build System with Shared Project Settings when for universal framework projects.
Tried using undocumented xcodebuild parameter -UseModernBuildSystem=NO, it didn't work. [working on command line fix, will update]
Relevant release note: for GM-2 seed: Released September 16, 2019 Build 11A420a
An XCFramework makes it possible to bundle a binary framework or
library for multiple platforms —including iOS devices, iOS simulators,
and Mac Catalyst — into a single distributable .xcframework bundle
that your developers can use within their own applications. An
.xcframework bundle can be added to an Xcode target’s Link Libraries
phase and Xcode uses the right platform’s version of the included
framework or library at build time. Creation of frameworks is
supported from the command line using xcodebuild -create-xcframework.
Frameworks or libraries bundled in an XCFramework should be built with
the Build Libraries for Distribution build setting set to YES.
(49948269)

I have the same problem when building our project with XCode 14.1. I added "-derivedDataPath ../derived_data" to the build command and it build without any issue. Hope this can help.
xcodebuild -sheme YourSheme -project YourProject.xcodeproj -sdk iphoneos -configuration YourConfiguration -derivedDataPath ../derived_data clean build"

Related

Xcode version problems. error:using bridging headers with module interfaces is unsupported Command CompileSwiftSources failed with a nonzero exit code

my iPhone just upgraded and now my iOS version is 15.3.1. Since my old version(12.4) of Xcode doesn't support that version of OS, I've installed newer version of Xcode(13.2.1). Now I cannot run my project and I got this error. I've changed Build Libraries for Distribution to NO and than my build is successful but when I set up breakpoint and start debagging I'm losing connection with debugger on my iPhone. Also I put device file(15.0) in /Aplications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport and in Supporting Files but it didn't
help. I will appreciate any help. Best regards.
Open your XCode,
Go to the Runner under PROJECTS -> search for 'distribution'
Make "Build Libraries for Distribution" to NO (if it is YES, change it to NO).
Do the same for Runner under TARGETS.
I also had the same problem I resolved it in this way.
Update:
Also don't forget to uncomment the following in iOS -> Podfile
platform :ios, '11.0'

Is it possible to compile and run sample projects from the Apple developer library without using a GUI?

I want to compile and run this application without using the Xcode GUI. Is this possible? I have so far only been successful with this baby step:
clang -framework AppKit main.m; ./a.out
But I need to compile and run the whole app, not just main.m.
Running xcodebuild will build the first Xcode project found in the current directory, using default settings. (If this isn't quite what you want, xcodebuild --help for more options.)

No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386)

While using the iphone simulator 64 bit, i'm getting the following architecture error. Also using the xcode 5.0. Any suggestions.
have a look under your build settings, check that the setting Build Active Architecture Only is set to No (might make compiling a bit slower but should fix the problem)
Also check that the Valid Architectures has arm64 in the list
Note if you are getting an error when submitting an app saying "Apps that include an arm64 architecture are required to include both armv7 and armv7s architectures”, setting it to No will also fix this
What you need to do is just set the ONLY_ACTIVE_ARCH to NO. Hope it will work.
if you getting error on test xcode project then delete it also resolved this problem.
other way is todo
I had the same error message after upgrading to XCode 5.1. Are you using CocoaPods? If so, this should fix the problem:
Delete the "Pods" project from the workspace in the left pane of Xcode and close Xcode.
Run "pod install" from the command line to recreate the "Pods" project.
Re-open Xcode and make sure "Build Active Architecture Only" is set to "No" in the build settings of both the "Pods" project and your own project.
Clean and build.

CocoaPods : cmd-line builds

It seems that in cmd-line builds, Pods don't get built automatically. Even when invoking xcodebuild to reference the workspace that declares how projects link to each other.
Is there a way to fix this, besides manually opening the project in Xcode and building?
I don't have any problem with such configuration: CocoaPods 0.28.0 and Xcode5 (+ Command-Line Tools) here and building using the Command-Line quite often (especially for Continuous Integration) without having any problem.
Neither with the Apple's xcodebuild command, nor with xctool (see also this NSHipster's article) when building my personnal project using Travis-CI either, everything works fine;
At work we have plenty of Xcode workspaces created using CocoaPods / pod install and we use Jenkins-CI to run xcodebuild to build them and no problem either.
Maybe you need to check a bit more about your configuration? Which CocoaPods & Xcode version, Which Command-Line Tools (xcode-select --print-path?), How is you Xcode configured (maybe you changed some of Xcode's default settings that broke it somehow)?
Tell us more about your specific configuration and the error/warning messages you got, because there should not be any problem.
Also make sure you have an up-to-date version of CocoaPods (some stuff were fixed some versions ago regarding Xcode5 and the new arm64 architecture, that broke implicit dependency detection in some cases)

Different behavior on Xcode and xcodebuild

I have a CI environment which builds my project. So when I compile my project with xcodebuild -target MyTarget and run it on a physical device, I get a visual bug with one of the Three20 libraries as well as a reproducible crash.
However, when I compile and run the project and the same target via Xcode I neither have the crash nor the visual problem.
Since I don't do anything fancy with xcodebuild I would expect the two builds to be identical. Generally I'd rather have the problem in two places than the two builds behave differently.
Has anyone run into similar issues and how can I make sure that the product of Xcode and xcodebuild is identical? Thanks a lot for your help.
Try running xcodebuild -scheme MyScheme, where MyScheme is most likely the name of your target if Xcode auto-generated the scheme for you.
The GUI uses schemes when building and I've found that you can usually get the same behavior by specifying a scheme to xcodebuild.