Swift Compiler: Unexpected character in prerequisites

There is an issue when compiling an Xcode workspace containing an iOS 14 app and a local package. When archiving the compiler logs errors and creates an invalid archive.

There are hundreds of errors like:

Code Block
error: error reading dependency file '/<UserDirectory>/Library/Developer/Xcode/DerivedData/<AppName>-<BuildID>/Build/Intermediates.noindex/ArchiveIntermediates/<AppName>/IntermediateBuildFilesPath/<PackageName>.build/Release-iphoneos/<PackageTargetName>.build/Objects-normal/arm64/<PackageTargetName>-master.d': unexpected character in prerequisites at position <LineNumberWithColon> (in target '<PackageTargetName>' from project '<PackageName>')


It is known that the compiler doesn't accept colons, but all of the colons don't come from my code. There are two situations as observed in the master.d files.
  • There is a file containing colons in the name, like: "<PackageName>::MAINGROUP::REF_3::REF_11.bc" generated by the compiler.

  • Some of the files with the .bc extension are displayed in the file as separated with a colon.

What could be the reason for the compiler to generate such an erroneous output? What can be done to further investigate the issue? Is it a compiler error?

Replies

Same issue here.
  1. The master.d file looks similar (lots of free-floating colons even though none of the source files contain them)

  2. The error occurs while archiving

  3. In a private Swift package


To all
Just to be sure. Did you try an option-clean build folder ?