Menu Home

Fixing “virtual filesystem overlay file all-product-headers.yaml not found” error

In the last few days, I saw an increasing number of developers facing a common problem trying to use lldb during a debugging session.

error: virtual filesystem overlay file '/Users/salla/Library/Developer/Xcode/DerivedData/XPTO-eevwsdjquyrbxhbnnxoqlnmyvpax/Build/Intermediates.noindex/ArchiveIntermediates/XPTO/IntermediateBuildFilesPath/XPTO.build/Release-iphonesimulator/XYPTO.build/all-product-headers.yaml' not found

error: couldn't IRGen expression. Please check the above error messages for possible root causes.

This error could be really annoying, because it blocks the developer to use the lldb resources, such as po to verify values or conditions during runtime.

The root cause

There is a known problem for Swift community, about how the compiler generates some artifacts, used by LLDB to process the symbols during the debug session.

The generated DWARFs contains stored data in absolute paths; that means those data are bounded to fixed paths at the machine whose generated it.

Once a developer tries to import those DWARFs, the absolute path, that usually comes from the $HOME folder of the generator user, doesn’t exist in his machine, and LLDB emits an error saying that it doesn’t found the specified path in DWARF.

As this is a compilation problem, there is no easy way to fix that.

And the situation gets worse, because the symbolication tool searches everywhere in your machine for those DSYMs, using SpotLight, an Apple tool that index all files, to provide a faster and assertive search.

The only solution here is to remove the troublemakers from your machine: the DSYMs.

How to fix it

First, we need to identify which dsym is causing the problem.

For this, let’s get the images UUIDs that has been loaded in app execution.

Run the app, then place a breakpoint anywhere in your code. When the execution stops, run the following command in lldb:

image list

The LLDB will return a list containing all the loaded images with their UUIDs, as shown in the next image:

#blindPeople: the image shows the image list command after its execution, followed with a list of all the loaded images in the app.

Get the UUID of the image that is causing the error. For exemple, in the bellow error, we can see the framework that is causing the error as XYPTO:

error: virtual filesystem overlay file '/Users/salla/Library/Developer/Xcode/DerivedData/XPTO-eevwsdjquyrbxhbnnxoqlnmyvpax/Build/Intermediates.noindex/ArchiveIntermediates/XPTO/IntermediateBuildFilesPath/XPTO.build/Release-iphonesimulator/XYPTO.build/all-product-headers.yaml' not found

Looking for the framework in the image list, we will find the following UUID:

#blindPeople: the image shows an marked UUID, followed by its description, indicating that this UUID belongs to the framework called XYPTO.

Next, let’s run the command that will search for the broken dsym and delete it, running:

mdfind -0 "com_apple_xcode_dsym_uuids == UUID-DA-IMAGEM-AQUI" | xargs -0 rm -rf --

In our example, we will run the command as:

mdfind -0 "com_apple_xcode_dsym_uuids == 664A127D-C264-3415-8515-E0DB99B606C8" | xargs -0 rm -rf --

Next, let’s erase the DerivedData folder. It’s important to erase all the data contained in that folder, because we may found some left references for the dsym from previous compilations.

If your DerivedData folder is set as default, run the following code. Otherwise, look for the folder and erase it manually.

rm -rf $HOME/Library/Developer/Xcode/DerivedData

At the end, just build and run your application, and the LLDB’s commands like po will be available and working again.

Categories: Quick Tips

Tagged as:

André Salla