Xcode build error about "cycle" that doesn't exist?

My project builds after a clean, but then fails to build. I can't understand these error messages. I have a macOS app target ("MyArchives") and a library target ("HelpPG") in the project. The app uses the library. Logically, there is no cycle.

The library is an attempt to wrap PostgreSQL's libpq with some Swift stuff. It works when it runs after the clean build.

I don't know what it's talking about with "headers before sources". That is already the case for the library target. There are no headers in the app target (which is all Swift).


For readability, strings were substituted:
[DEBUG] = /Users/me/Library/Developer/Xcode/DerivedData/MyArchives-flyvnqgqeolefjeztyopfnoaqmaj/Build/Products/Debug
[UUID1] = bb030422ec80ba11076c24bcbd7fcd674d61e6313e2915ec58f3544977cb99a4
[UUID2] = bb030422ec80ba11076c24bcbd7fcd67db6f662ae7c65be0e231d735b4905dc3

Showing All Messages
Cycle in dependencies between targets 'MyArchives' and 'HelpPG'; building could produce unreliable results. This usually can be resolved by moving the target's Headers build phase before Compile Sources.
Cycle path: MyArchives → HelpPG → MyArchives
Cycle details:
→ Target 'MyArchives' has copy command from '[DEBUG]/libHelpPG.dylib' to '[DEBUG]/MyArchives.app/Contents/Frameworks/libHelpPG.dylib'
→ Target 'HelpPG' has link command with output '[DEBUG]/libHelpPG.dylib'
○ Target 'HelpPG' has copy command from '/usr/local/pgsql/lib/libpq.5.13.dylib' to '[DEBUG]/libpq.5.13.dylib'
○ Target 'HelpPG' has link command with output '[DEBUG]/libHelpPG.dylib'


Raw dependency cycle trace:

target:  ->

node: <all> ->

command: <all> ->

node: [DEBUG]/MyArchives.app/Contents/Frameworks/libHelpPG.dylib ->

command: target-MyArchives-[UUID1]-:Debug:PBXCp [DEBUG]/libHelpPG.dylib [DEBUG]/MyArchives.app/Contents/Frameworks/libHelpPG.dylib ->

node: [DEBUG]/libHelpPG.dylib/ ->

directoryTreeSignature: ~ ->

directoryContents: [DEBUG]/libHelpPG.dylib ->

node: [DEBUG]/libHelpPG.dylib ->

CYCLE POINT ->

command: target-HelpPG-[UUID2]-:Debug:Ld [DEBUG]/libHelpPG.dylib normal ->

node: [DEBUG]/libpq.5.13.dylib ->

command: target-HelpPG-[UUID2]-:Debug:PBXCp /usr/local/pgsql/lib/libpq.5.13.dylib [DEBUG]/libpq.5.13.dylib ->

node: <target-HelpPG-[UUID2]--phase1-compile-sources> ->

command: Gate target-HelpPG-[UUID2]--phase1-compile-sources ->

node: <Linked Binary [DEBUG]/libHelpPG.dylib> ->

command: target-HelpPG-[UUID2]-:Debug:Ld [DEBUG]/libHelpPG.dylib normal

I only did one thing and solved the problem perfectly: Select Target and then select Build Phase to move the Run Script to the front of Compile Sources. Clean Build Folder (for all libraries and frameworks) Run, compiled successfully. The principle is simple, just change the compilation order.

Xcode 13.3.1 & Swift 5.1

Xcode build error about "cycle" that doesn't exist?
 
 
Q