-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.5.0, static libs] error: clang importer creation failed #7584
Comments
Please do provide a sample app, but also make sure you do a clean build for your project. |
Further investigation suggests it may be an issue with
|
Will wait on your sample app as right now it's hard to diagnose with the given info. |
Sample app: https://github.com/ileitch/cocoapods-7584
|
Further reduced example: All you need is a swift file that exports some Swift pod type to objc, e.g: // MyFramework/SomeClass.swift
import Foundation
import Alamofire
@objc public class SomeClass: NSObject {
@objc public init(parameters: Parameters) {} // Parameters is defined by Alamofire
} // MyApp/MyApp-Bridging-Header.h
@import MyFramework; People likely wouldn't import the module directly into their bridging header like this, but it makes no difference if imported directly or via some header. |
We're hitting this too. |
Having same issue with an objc pod |
Same here. |
Same for me |
I'm seeing the same failure when trying to import an ObjC pod into a pch. Sample app here: https://github.com/nsparks/PCHSample Importing in normal .h/.m files works as expected. Maybe it's an issue with bridging and precompiled headers? |
Same issue here with SDWebImage |
Same issue here when i've tried to import a objc static lib of pod into a prefix header by specifying BTW, the version of my cocoapods is 1.5.2 |
I found an ugly workaround for ObjC pods under your control: adding an empty swift file to the pod and listing it in the podspec's source_files allows that pod to be imported into a .pch. This doesn't solve the general case, but it does provide a clue as to what might be going wrong. |
You need to use |
Just curious if there's a planned fix for this, or if this is user error when linking static pods? I'm currently dealing with this issue in a very large project with a lot of old code and a massive bridging header. We recently switched over nearly ever pod we use from Autocomplete for Xcode relies on a background compiling process by using the SourceKit service. This process does not respect the precompiled bridging header flag in your project setting, and always uses a precompiled bridging header. If you hit this bug, then disable the precompiled bridging header to get around the issue, you end up with broken autocomplete in Swift files (Objective C files are unaffected). Ideally that background compiling process should respect the precompiled bridging header flag, and it's probably an Xcode bug. Radar here: https://openradar.appspot.com/40073447 I'm currently peeling back years of using whole-module imports in dozens of header files linked in the bridging header to fix the problem and turn the precompiled bridging header back on. It would be good to know if there's going to be a fix for this, or if this is expected behavior from static linking Thanks! |
This should be fixed in Xcode 10 beta |
@krze thanks for your input! Could you please clarify some details of your solution, as I've faced the same issue recently? If I get you right, the workaround is to replace @import MyFramework in obj-c files in my application with exact headers, declared in the umbrella header of MyFramework, like this #import <RequiredClassHeaderFromMyFramework.h> But what if I need to access not Obj-C, but Swift class/protocol from MyFramework? I cannot import the whole framework with Any thoughts would be appreciated! |
Yes, what you posted is correct. You need to replace whole-module imports in Objective C header files imported into bridging headers with explicit, single-file imports. Not just the first layer of imports into the bridging header, but any imports those header files bring in as well. Example:
In Swift, you can safely import the whole module. If you need Swift files from a module in an Objective C file, your only options are these:
|
Alternatively, option 3 would be to make an Objective-C factory class that returns an Objective-C protocol that the Swift file conforms to within the module. This may prove to be more trouble than it's worth, though. |
I can confirm disabling "Precompile Bridging Header" fixes the compilation issues. |
Disabling it fixed it for me too and the app is running fine.
@krze are you aware of any bad side-effect that this causes? |
Just wondered if anyone knew of any update to this issue? I've just hit it and found even with Xcode 10.1 beta 2, it is still the case that disabling "Precompile Bridging Header" breaks autocompletion as described in https://openradar.appspot.com/40073447. I may have missed it, but as kris asked, is there a planned fix for this module error, or is this a user error when linking static pods? |
When I disable precompile bridging header to get over this bug XCode 10.0 is currently crashing when I try to edit bridging header. So I have to edit it in separate editor, looks like. Any solution ? |
…s the compilation issues
Any update about this issue ? I still have the exact same problem. When using a Pod which defines modular framework (using PCH: #ifndef PrefixHeader_pch
#define PrefixHeader_pch
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
@import DemoLib;
#endif /* PrefixHeader_pch */ Build Log:
|
@dnkoutso I create a simple demo to 100% trigger this issue. It's more clear than currernt description. Please have a check : https://github.com/dreampiggy/CocoaPodsModularFrameworkPCHIssue Tested with the CocoaPods 1.6.0-rc.1, still have the issue...The workaround to disable precompile prefix header is OK in some cases. But it will increase the built time because the pch is not precompiled. So it's better to find the way out. More interesting, when you create a Dynamic framework or Static framework using native Xcode toolchain, this issue does not appear. So I guess it's not Xcode bug but the CocoaPods's config issue. |
Found at the end of last week that with the beta of Xcode 10.2, you may not need to disable "Precompile Bridging Header" any more. My impression remains though that using static modules is not that solid as yet. |
@jmfriend It's that a Xcode bug in conclusion ? Could you please, clone the demo project I posted above. Then run |
I think any developer can install the new Xcode beta, so you could perhaps try it yourself if you like with your demo project. I'm very tied up the next few days, |
You can use
in podfile |
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
I use this workaround to make all pods we use link as static frameworks
|
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. |
This issue will be auto-closed because there hasn't been any activity for a few months. Feel free to open a new one if you still experience this problem 👍 |
Is this issued marked as solved. Becaues Xcode 10.2 solve this issue ? Or anything extra about CocoaPods's generated structure cause the issue ? |
No changes from CocoaPods side as far as I know. Need to verify if the sample included here works with Xcode 10.2 and CocoaPods 1.7.5 (latest stable release as of now). I can re-open if its not working. |
It seems to be resolved for me! The original project I was having issues with now works fine with the latest Xcode / CocoaPods. |
this came for me after update to 1.7.5 |
Does any one had issue with Xcode 10.0 and IOS 10.13.6 and resolved after update of xcode ! If yes please update which version of Xcode will resolved it ! |
Report
What did you do?
use_frameworks!
withuse_modular_headers!
What did you expect to happen?
Project to build successfully.
This likely boils down to me not fully understanding what's provided by 1.5.0, and what's a reasonable expectation of what should work.
Should ObjC only pods that don't define modules work with
use_modular_headers!
ormodular_headers: true
?What happened instead?
It failed with:
CocoaPods Environment
Stack
Installation Source
Plugins
Podfile
Yeah, not posting that - too many internal details.
The offending pod in question is
SDWebImage
at version3.8.2
, though I get the above error for any ObjC pod.Project that demonstrates the issue
Will provide if needed.
The text was updated successfully, but these errors were encountered: