Build input file cannot be found

I have a project that imports SPM swift-navigation which in-turn imports SPM https://github.com/pointfreeco/swift-perception

I have a test target it builds and runs with no issues in XCode however if I run with xcodebuild i get the below error (I have done basics removed derived data etc.)

❌ error: Build input file cannot be found: '/Users/chris/mtp-iOS-retail-iPhone/build/Build/Products/Debug/PerceptionMacros'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'Perception' from project 'swift-perception')

Build input file cannot be found
 
 
Q