Xcode 10 Failed to emit precompiled header for bridging header
Asked Answered
D

6

18

Hi I'm getting a very annoying error on Xcode 10 that is

1 error generated. <unknown>:0: error: failed to emit precompiled header '/Users/me/Library/Developer/Xcode/DerivedData/APP-hlczpckeselwrtaqjcbxdpoiogkj/Build/Intermediates.noindex/PrecompiledHeaders/APP-Bridging-Header-swift_35K3KO8G70VCD-clang_3DGF15CYP79L0.pch' for bridging header '/Users/me/Desktop/Swift/Folder/APP/APP/UNLKV2-Bridging-Header.h'

I'm not sure how to solve this I have tried everything. It was very sudden today before there was no problem but the second I added the Firebase info.plist to the project I got this error. I have tried to delete the file, made sure the name of the header file was entered correctly in the "Objective-C Bridging Header" and I have it entered as
$(PROJECT_DIR)/$(PROJECT_NAME)/$(PROJECT_NAME)-Bridging-Header.h
I have cleaned and built the project multiple times and reinstalled all the pods.

Besides this, I also get an error that

JPSVolumeButtonHandler/JPSVolumeButtonHandler.h' file not found

I would really appreciate it if someone could help me solve this, I've been looking around all day at every single post and forum and nothing has worked for me. If you need any more information about this issue, please let me know.

Dark answered 23/9, 2018 at 5:13 Comment(4)
is this for a personal project ? if yes, it would be much easier to debug, if people can download the github project.Zach
No this isn't a personal project so I'm afraid I can't do that but feel free to point me to different areas to check and I can look and send you what I see and the information that you may needDark
Usually this kind of error is accompanied by other error, which are the actual cause of the problem. It might be that solving the second error will also fix the first one.Thorazine
How do I figure out what that second error is? I don't see anything as another error or at least an error mark in the compilerDark
S
3

Had same issue that I've tried to fix for hours. Ended up with this solution:

  1. select scheme, from appeared menu choose Manage Schemes...
  2. from popped up list of schemes find [Your Project Name] scheme, select it and delete by pressing - button in the bottom left corner of list
  3. Press Autocreate Schemes Now button in the top right corner

See screenshots below:

enter image description here

enter image description here

Semiramis answered 13/11, 2018 at 9:6 Comment(3)
I was able to fix this issue finally but thank you for your response and I will definitely try it out next time this happens to me...hopefully never because it's very annoyingDark
@Jaqueline, can you update your question with how you fixed the bridging header issue? It would help future searchers. ;)Quadripartite
Not a good answer, it did not re-create for me. Bad times.Flotage
D
1

I'm currently facing the exact same problem (with other pod headers missing) ; tried to delete all pod folder, clear cache install again, update pods... nothing works.

Also tried to do as told in xconfig file : FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR) "$(SRCROOT)" "$(SRCROOT)/Framework", but still blocked.

This bridging-header error happens when using the "legacy build system", since the new build system given w/ Xcode10 brings many more issues for older projects. Dunno if this is relevant but joining here current build phases of my target.

Edit : Eventually I found what my problem was, it may be the same for some.

In the workspace settings I changed the build system to the Legacy one. However, I also thought it was a good idea to change the Build Location to Legacy ; That was what caused my issue.

How I fixed :

a) in the Workspace Settings, let build system on 'Legacy build system'

b) click on Advanced, then change build location to Xcode Default

c) then my build would still fail because of the outdated library libstdc++ ; so i changed it with the libc++ library in my 'common.xconfig' file : CLANG_CXX_LIBRARY = libc++.

Everything works fine for me now. Hope this helps others.

Daphne answered 28/9, 2018 at 8:49 Comment(2)
Where can I find the common.xconfig file?Dark
you can CMD+Maj+O --> common.xconfig || mine is at "/Users/USERNAME/Desktop/PROJECT-IOS/MyProject/Build Configurations/common.xcconfig"Daphne
C
1

This issue can be many things, but it could be that you have declared a search path for this framework but the folders have been rearranged somehow. To fix it, try this:

On the target you are using click Build Settings and search for:

Search Paths

You'll probable have a number of paths there for Framework Search Paths or Header Search Paths.

Double click the paths and you'll get an editable window. On the right side you can select if you want Xcode to search for the framework non-recursive or recursive. Choose recursive for the troublesome framework.

Then hit Clean Build Folder (Cmd-Shift-K) and Run (Cmd R) and keep your fingers crossed.

Corker answered 8/2, 2021 at 16:29 Comment(0)
Z
0

Could you search for JPSVolumeButtonHandler/JPSVolumeButtonHandler.h in ...

  1. finder and make sure the file exists.
  2. make sure the file is included in your project.
  3. If JPSVolumeButtonHandler is included in the bridging-header.h but JPSVolumeButtonHandler is somehow missing in source, you could get a emit precompiled error.
Zora answered 26/9, 2018 at 21:37 Comment(8)
Ok so I went in and deleted that in my header because it turned out I wasn't even using it anymore also I deleted it out of my podfile so that solved that problem. However I know have a problem that "No such module ProgressHUD" and I have that in the header file, also the file is outside of the project, how do I check if that is incorpated in the project?Dark
Can you include ProgressHUD in your pod file? By outside the project do you mean it is included as a submodule?Zora
So actually what I have at the moment is ProgressHUD as a pod in my podfile and I can see that the files for it are under Framework, I also have ProgressHUD in my bridging header, however I get the same error of no such module like before.Dark
did you try to delete the pod folder and do a pod install? Other place to check is framework search path under build settings. you should have $(inherited) $(PROJECT_DIR) so it knows the path your framework resides. Same for Library Search Path and Header Search PathZora
I will check when I have access to my computer and let you knowDark
Ok so I checked and I added that to the Library Search Path and the Header search path but I'm still getting the same errorDark
Could you use source control and see the difference when it worked and didn't work. or checkout from a branch where you think it worked?. Is it possible that directory structure has accidentally changed? Is this a swift project and you are trying to access Objective C library?Zora
Yes I will look again this weekendDark
F
0

After a lot of searching and struggling, I found that adding the header file for which I get the error "file not found", to the Xcode project fixes it.

Hope it helps!

Foxhole answered 5/7, 2020 at 15:7 Comment(0)
S
0

The main problem is in Pod File. If you re using 2 targets, you need to define pod for the second target.

in your Pod file, you will have something like this.

platform :ios, '9.0'

use_frameworks!

target your_project_target_name do 
pod 'Alamofire' 

end 

But if you have two targets try this.

 platform :ios, '9.0'
 use_frameworks!

 def available_pods

 pod 'Alamofire'
    
 end 

target your_first_project_target do 

available_pods

end 

target your_second_project_target do 

available_pods

end 

I have fixed all errors with this solution. Cheers bro.

Steinway answered 4/10, 2020 at 22:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.