From the CMake 3.19 release notes:
The Xcode generator now uses the Xcode “new build system” when generating for Xcode 12.0 or higher. See the
CMAKE_XCODE_BUILD_SYSTEM
variable. One may use-T buildsystem=1
to switch to the legacy build system.
When I’m cross-compiling for iOS with CMake 3.19 and Xcode 12, using the new build system causes the build to consistently fail with this error message:
error: unable to attach DB: error: accessing build database "/path/to/project/build/ios/build/XCBuildData/build.db":
database is locked Possibly there are two concurrent builds running in the same filesystem location.
The issue seems to be a post-build rule that CMake creates for the install
target. In that post-build rule a second build is initiated while the first one is still in progress.
For the moment I can make the build work again by specifying -T buildsystem=1
, but this seems to be a temporary workaround only, because Xcode’s legacy build system has been deprecated and, knowing Apple’s relentless innovation drive, will go away rather sooner than later.
Is there a better way how to make cross-compiling for iOS work again without having to resort to -T buildsystem=1
?
Also the iOS cross-compiling section on the cmake-toolchains docs page fails to mention -T buildsystem=1
- it would be nice to update the page with a hint.