Post

Replies

Boosts

Views

Activity

Reply to Xcode 12 "Build input file cannot be found" $DERIVED_FILES_DIR
It appears that the build system under Xcode 12 and higher is now validating that any files referenced in the "Other Linker Flags" (probably other build settings as well before actually building the target. The workaround to the problem is to force the file into existence before the target itself starts to build by "touch"-ing it prior to the build. The the existing project build phase script can still be used to populate the file before the build gets to the linking stage, the file just has to exist on disk. The "Pre-action" scripts in build schemes don't really work well for our situation, as we have several schemes that include the build targets. The best solution I've found is to move the generated plist file to a project relative location (instead of in $DERIVEDFILESDIR  which is target specific). I then added an Aggregate build target to the actual target's project and made it a dependency of the original build target. This dependency gets built BEFORE Xcode validates the file existence. In the aggregate target, there is a build phase scipt that executes a "touch" on the necessary file, creating it if it's missing. The generated file is added to .gitignore so that it does not get committed since it's constantly changing. Otherwise it shows up as a modified file with every new build. Hope this helps anybody who runs across this problem.
Jan ’21