Multiple commands produce .swiftmodule or .swiftdoc

XCode 10 beta, I am getting this error regarding multiple commands:



Multiple commands produce '/Users/myName/Library/Developer/Xcode/DerivedData/MyApp-dzvbktbmuxvgjefvikelaxydqckv/Build/Products/Debug-iphoneos/MyApp.swiftmodule/arm64.swiftdoc':



1) Target 'MyApp Free' : Ditto /Users/myName/Library/Developer/Xcode/DerivedData/MyApp-dzvbktbmuxvgjefvikelaxydqckv/Build/Products/Debug-iphoneos/MyApp.swiftmodule/arm64.swiftdoc

/Users/myName/Library/Developer/Xcode/DerivedData/MyApp-dzvbktbmuxvgjefvikelaxydqckv/Build/Intermediates.noindex/MyApp.build/Debug-iphoneos/MyApp Free.build/Objects-normal/arm64/MyApp.swiftdoc



2) Target 'MyAppWidget' : Ditto /Users/myName/Library/Developer/Xcode/DerivedData/MyApp-dzvbktbmuxvgjefvikelaxydqckv/Build/Products/Debug-iphoneos/MyApp.swiftmodule/arm64.swiftdoc

/Users/myName/Library/Developer/Xcode/DerivedData/MyApp-dzvbktbmuxvgjefvikelaxydqckv/Build/Intermediates.noindex/MyApp.build/Debug-iphoneos/MyAppWidget.build/Objects-normal/arm64/MyApp.swiftdoc





I also get the same thing for .swiftmodule document.



Notice the first argument of the lines are the same, but the 2nd argument is different.



My main app has a widget bundled in it. Both have Swift code obviously. Unbundling the widget from the main app fixes this, but of course is not what we can do. It seems like the builds are putting the file into the same place but it has to get moved to another place?

Replies

For what it's worth, I have the exact same problem, but with a Mac target and it's bundled XPC service. I don't want to disable the modern build system, though that is an option (File > Workspace Settings... > Build System).


If anyone has insight into this problem, I'd be grateful.

Aha! Both my main app and the XPC extension were using the inherited "Product Module Name" from the Xcode project. Once I specified a unique name for the XPC target, the build problem was fixed.

I am having the same problem but candidly not sure what steps to take based on your comments. Would you mind spelling those steps out?

@villager Go to the build settings of your share extension target, search for "product module name" setting, and force it to be a different value than what the app target is using... maybe add "Ext" to the end or something. @chadseld's solution worked for me (thanks Chadseld!).

Thanks. I also read your other comments. I did do those steps back then and it did work. Warning for those using CloudKit. Changing the product name prevents you from using the default container. I had to initialize my containers as a work around.


Thanks for the follow up.

I gave a unique value to my project target 'Project38', but it still fails to compile. I then gave unique names to Project38Tests and Project38UITests in my target list, but it still fails. There's nothing else in my target list to change. I'm entering the value to the right of 'Product Module Name', and it seems to automatically change the 'Debug' and 'Release' rows below, so I think I'm doing it right!

I fixed this issue by editing my project file and removed PRODUCTMODULENAME in the main project settings (not the individual targets)
Post not yet marked as solved Up vote reply of sxu2 Down vote reply of sxu2