We have a Vapor project that we have been building fine for a while and then all of a sudden yesterday we started getting build errors complaining about redefinition of module
. We are currently using Xcode 11.3.1 and Swift 5.1.3.
This is a SPM project where the errors happen regardless of if we build using swift build
or running the project in Xcode. The same error is happening on our CI, on my machine and also on a colleagues machine and it all started happening yesterday without any obvious changes to the repo other than a few small code changes, no package settings etc.
When running swift build
this is what we currently see:
% swift build
/Users/dale/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/module.modulemap:1:8: error: redefinition of module 'AppleTextureEncoder'
module AppleTextureEncoder [system] [extern_c] {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/module.modulemap:1:8: note: previously defined here
module AppleTextureEncoder [system] [extern_c] {
^
/Users/dale/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/module.modulemap:7:8: error: redefinition of module 'Compression'
module Compression [system] [extern_c] {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/module.modulemap:7:8: note: previously defined here
module Compression [system] [extern_c] {
^
/Users/dale/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/module.modulemap:13:8: error: redefinition of module 'Darwin'
module Darwin [system] [extern_c] [no_undeclared_includes] {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/module.modulemap:13:8: note: previously defined here
module Darwin [system] [extern_c] [no_undeclared_includes] {
^
/Users/dale/Downloads/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/module.modulemap:1712:8: error: redefinition of module 'asl'
module asl [system] [extern_c] {
^
...
There have been suggestions on the Vapor discord to remove the command line tools but this seems an unsustainable solution, especially on our CI. Does anyone have any clues as to what's going on here?