31

I put another project inside my main project, this one called OAuthSwift and it contained a framework. When I tried to build it, I got this error:

<unknown>:0: error: invalid virtual filesystem overlay file '/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Intermediates/OAuthSwift.build/Debug/OAuthSwiftOSX.build/unextended-module-overlay.yaml'

<unknown>:0: error: clang importer creation failed

After some research, I tried everything all the people said - I opened the file called all-product-headers.yaml and I expected it to contain this (what the website said):

{
    'version': 0,
    'case-sensitive': 'false',
    'roots': [

but instead it contained this:

{
  'version': 0,
  'case-sensitive': 'false',
  'roots': [
    {
      'type': 'directory',
      'name': "/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Products/Debug/OAuthSwiftOSX.framework/Headers",
      'contents': [
        {
          'type': 'file',
          'name': "OAuthSwiftOSX-Swift.h",
          'external-contents': "/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Products/Debug/OAuthSwiftOSX.framework/Versions/A/Headers/OAuthSwiftOSX-Swift.h"
        },
        {
          'type': 'file',
          'name': "OAuthSwiftOSX.h",
          'external-contents': "/Users/gabrieljones/Desktop/Coding/Xcode/Paul's Console/OAuthSwift-master-11/OAuthSwiftOSX/OAuthSwiftOSX.h"
        }
      ]
    },
    {
      'type': 'directory',
      'name': "/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Products/Debug/OAuthSwiftOSX.framework/Modules",
      'contents': [
        {
          'type': 'file',
          'name': "module.modulemap",
          'external-contents': "/Users/gabrieljones/Library/Developer/Xcode/DerivedData/Paul's_Console-bbbxnfmomaaurfeabxmnchoqmwpa/Build/Intermediates/OAuthSwift.build/Debug/OAuthSwiftOSX.build/module.modulemap"
        }
      ]
    }
  ]
}

Yes, I changed it to the version I was supposed to like this:

{
 'version': 0,
 'case-sensitive': 'false',
 'roots': []
}

And then I locked it, but I got the unable to write to file error as WELL as the invalid virtual filesystem overlay file error. Can anyone help?

Community
  • 1
  • 1
brimstone
  • 3,370
  • 3
  • 28
  • 49

8 Answers8

39

Encountered this issue randomly while re-running my app after making changes on Xcode 8.0. I tried Product > Clean, and even deleted the build folder cmd + option + shift + k and deleted the derived data folder entirely, but that didn't end up working. Still got the same error. Restarting Xcode is what ended up working for me.

Stunner
  • 12,025
  • 12
  • 86
  • 145
27

Hey I got a feeling about this: I think this might just be a case where Xcode is broken when you have non-alphanumeric characters in your target name. My project also had and apostrophe in the target name

Yours: /Xcode/DerivedData/Paul's_Console

Mine: /Xcode/DerivedData/Lord's_Prayer

Can you try changing your target name. I got an hint about thought from here.

nanospeck
  • 3,388
  • 3
  • 36
  • 45
4

It seems that if any item in the path contains certain non-alphanumeric characters, then you will encounter this issue.

I encountered this problem, because the name of my Xcode scheme contained an apostrophe. My target's name was totally free of non-alphanumeric characters. Removing the apostrophe allowed me to build.

Thank you nanospeck for giving me the clue that lead to this discovery.

josephap
  • 2,075
  • 17
  • 24
3

Faced the same problem while archiving my project but you can get rid of this issue by deleting the DerivedData of the app.

Following are steps to delete DerivedData:

1) Select the Organizer from window menu of the xcode.

2) Now you need to select the builds one by one.

3) You can delete the selected build by pressing delete button from the keyboard.

This will clear up all the derivedData for the project and now you are ready to go ahead. Have fun guys :)

3

Not only deleting DerivedData works, you need to delete ModuleCache folder as well and it worked for me.

Mohammad Zaid Pathan
  • 16,304
  • 7
  • 99
  • 130
1

After Clean and Clean build folder... let the Xcode finish the Indexing, then build.

Jakub Truhlář
  • 20,070
  • 9
  • 74
  • 84
1

So after running into this issue myself I found that the cause is the use of ' in my project name. So I renamed my project following the steps outlined by Luke and Dan.

But after cleaning and building I got a linker error. The problem was solved by:

  • going clicking on the project in the "Project navigator" on the left then going selecting "Build Phases"
  • In the "Link Binary with Libraries" remove the library with the old name
  • then clean and build (Command + Shift + K to clean, Command + B to build).
Edwin R
  • 61
  • 2
  • 5
0

It in my case error was caused by enum nested in class

changing

class A {
    private enum E {
        ...
    }
    ...
}

into

fileprivate enum E {
    ...
}

class A {
    ...
}

solved problem

Pikacz
  • 431
  • 1
  • 5
  • 10