Xcode error accessing build database while using the universal script for making framework builds

I am trying to build a Swift framework containing cocoapods, using the below universal framework script got from here: Swift universal framework depending on pod

The build fails when using Xcode 12 and UseModernBuildSystem=NO:

The Legacy Build System will be removed in a future release. You can configure the selected build system and this deprecation message in File > Workspace Settings.
Command PhaseScriptExecution failed with a nonzero exit code

error when using Xcode 12 and modern build system:

error: accessing build database
"/Users/user/Library/Developer/Xcode/DerivedData/SnapKit-gldcozqrglacwhcqsctatmsoiouc/Build/Intermediates.noindex/XCBuildData/build.db": disk I/O error

Does anyone know the right solution for this problem or a workaround?

Replies

I get the same thing after a build script that makes an xcframework action. But the build and framework create actions complete fine. This error just comes at the end. The file exists and perms are normal. Maybe an xcode bug?
I am still facing the same issue and I am unable to migrate my project to newer Xcode version.
Previously I was using Xcode 9 and Legacy build system, trying to migrate to the new build system and to the latest Xcode results in this error.

The problem is that the build.db file actually exists at the specified location but the Xcode throws up error saying

Code Block
Showing Recent Messages
error: accessing build database "/Users/sdks/Library/Developer/Xcode/DerivedData/Logger-ewosmmkmvdgsihehzkkffrtfeckw/Build/Intermediates.noindex/XCBuildData/build.db": disk I/O error

Can anyone suggest a proper solution to this issue?