Xcode: built-in infrastructure "no such module"

My project currently has 3 built-in frameworks:

  • PersistenceLayer

    (Swift only)
  • TransportLayer

    (Swift only)
  • Socket

    (Objc)

Both PersistenceLayer

and Socket

do not refer to anything outside of themselves. However, it TransportLayer

imports PersistenceLayer

and Socket

. Oddly enough, after importing, I can use objects PersistenceLayer

:

import PersistenceLayer

struct User : Model {
  ...
}

      

Model

is defined in PersistenceLayer

, and Xcode allows me to use it as normal. However, when I try to build TransportLayer

, I get an error: No such Modul 'Persistencelayer'

. So Xcode recognizes the module, but it somehow "loses" it when it is created.

What madness it was that it worked. At some point, something changed and I can't figure out what. It is important to note that I am working on a project with several developers and I have merged

changes in it. However, switching to a pre-merge commit did not help. I've also tried:

  • Adding $(SRCROOT)

    (recursive) to database search paths
  • Removing everything from the directory ModuleCache

  • Clear project
  • Clear build folder

I suspect that something has changed in my project settings, but I can't figure out that and I checked, git diffs didn't help (nothing really changed in the project except the regular files.

It also TransportLayer

successfully imports and uses Socket

. I can build a TransportLayer if I remove references to PersistenceLayer

, but keep all references to Socket

.

Does anyone know why this might be happening or how to fix it?

Update

So, I removed the "offensive" files from the target to make sure it Socket

works (it is) and then added the files to the target again (quite literally by dumping git). Now he's building ... because it makes sense. But I tried to change the schematic from iOS Device

to simulator and it doesn't build anymore, but I get different errors:

  • in .modulemap: Header

    PersistenceLayer-Swift.h 'not found`
  • Also: Could not build Objective-C module 'Persistence Layer'

It's like I'm chasing random errors ...

+3


source to share


1 answer


I figured out the answer: open "Build Phases" in the target TransportLayer

and manually add PersistenceLayer

also Socket

to the Target Dependencies. This will ensure that whatever TransportLayer

depends on is created before it is created.

I had a hunch that the original cause was iOS Device

working because I removed the offending files, which allows everything to build correctly, including PersistenceLayer

which has been cached. After adding the import to the project, it kept working because there PersistenceLayer

was no need to build anymore. Other circuits didn't work because they were PersistenceLayer

n't built for those architectures. I confirmed this by cleaning up again and the builds failed. After some searching, I found Target Dependencies

and added two of my dependencies. Everything now builds all circuits and all architectures correctly.



My project has probably worked so far because it was working with cached Frameworks that were built before I used them: (I built PersistenceLayer

before I started working on TransportLayer

). I probably recently cleaned up a project that removed the cached frameworks and caused problems.

+2


source







All Articles