MergeSwiftModule failed with a nonzero exit code

I have a fairly large project which is failing to build with the Xcode 12 beta :confused:

The build error is as follows:

:0: error: circular reference
:0: note: through reference here
:0: note: through reference here
:0: note: through reference here
:0: error: circular reference
:0: note: through reference here
:0: note: through reference here
:0: note: through reference here
:0: error: circular reference
:0: note: through reference here
:0: note: through reference here
:0: note: through reference here

Command MergeSwiftModule failed with a nonzero exit code

Other possibly relevant details:

  • It is cross-platform, all of the targets (iOS, tvOS, macOS) fail to build in the same way.
  • There is an obj-c bridging header.
  • There are no 3rd party dependencies.

So my question is, how might I be able to work around this?
Even a general strategy for dealing with this sort of issue would be helpful!

Hey Syre,

I was having the same issue and I was able to get myself unblocked by changing the Compilation Mode in Build Settings from singlefile to wholemodule.

This definitely isn't a long-term solution, but this at least got me building with Xcode 12.0 beta (12A6159). Hope this helps you or someone else having this issue for now!

2 Likes

Hey there,

That has also got me building for now, thanks for the suggestion!
I'm going to file a bug report, hopefully this can get resolved during the betas.

1 Like

Update: Just circling back to this, seems like the issue is resolved in beta 5.

Hey there,
I got the same error with my xcode 13 and I have suggestion for you to just clean all Derived Data and Reset Packages.
After then if error persist just Do cmd + shift + k and do clean build.
Hopefully this solves the problem.