Skip to content
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

Compiler warning when adding Swift framework #3200

Closed
steilerDev opened this issue Feb 28, 2015 · 51 comments
Closed

Compiler warning when adding Swift framework #3200

steilerDev opened this issue Feb 28, 2015 · 51 comments
Labels
t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome!

Comments

@steilerDev
Copy link

I have added two Swift frameworks (Locksmith and SwiftyUserDefaults) to my project, integrated through CocoaPods (using version 0.36.0.rc.1 and explicitly stating use_frameworks! within my PodFile).

Both framework produce the same xCode compiler warning (using xCode 6.3 Beta):

[...]/Pods/<module-includes>:1:1: Umbrella header for module 'SwiftyUserDefaults' does not include header 'SwiftyUserDefaults-Swift.h'

and

[...]/Pods/<module-includes>:1:1: Umbrella header for module 'Locksmith' does not include header 'Locksmith-Swift.h'

After talking to the developer of the frameworks we conclude that the root of the problem might be CocoaPods.

@segiddins
Copy link
Member

What leads you to conclude the issue is caused by CocoaPods? That might help us fix it :)

@steilerDev
Copy link
Author

It might be a xCode or Swift bug, but since the problem occurred with pods of two independent devs and both of them don't know how to fix this problem I thought it might be a problem with cocoapods.

On top of that the file causing the problem (the umbrella header) is as far as I can see a file created by cocoapods (isn't it?)

@segiddins
Copy link
Member

@mrackwitz any idea what could be causing this?

@jshier
Copy link

jshier commented Mar 2, 2015

I've been seeing this intermittently. It's usually fixable by clearing derived data. This is using the Xcode 6.3 beta too, as well as 0.36.beta.2, which I needed because I'm using pods with compiled libraries.

@neonichu
Copy link
Member

neonichu commented Mar 2, 2015

#3092 could be related. I'd be inclined to wait and see if this turns out to be an actual new warning or just beta noise. FWIW, our generated umbrella header does not include the generated ObjC compatibility header.

@steilerDev
Copy link
Author

Apparently beta noise and/or resolved in a recent update of cocoapods. No more warnings in latest Xcode beta. Thank you guys anyway.

@andreamazz
Copy link
Contributor

I'm having this issue using cocoapods 0.37 with Xcode 6.3.1.
The funny thing is that this happens only when I'm archiving the app for release on the AppStore, the debug build goes smoothly.
The archive process results in a corrupted archive.
Another detail that might help: if I strip down the watchkit and today extension's targets, no warning is raised and the archive is fine.
I'm trying to release a new version of this project:
https://github.com/FancyPixel/gulps

and the output:
screen shot 2015-05-04 at 13 11 48

@neonichu
Copy link
Member

neonichu commented May 4, 2015

I saw this today as well, think it makes sense to reopen.

@neonichu neonichu reopened this May 4, 2015
@neonichu neonichu self-assigned this May 4, 2015
@neonichu neonichu added the t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome! label May 4, 2015
@mrackwitz
Copy link
Member

It seems like the original bug was that clang complains about the Swift bridging headers as missing, which is surprising enough by itself because CocoaPods doesn't set the option -Wincomplete-umbrella yet, which is used to explicitly enable warnings about missing header includes. (See also #3428 and you may check whether this is configured in your projects, but unless the defaults were changed or there is a new undocumented explicit build setting for this warning, I'd be surprised if this would be present in any project's build settings in OTHER_C_FLAGS. For @andreamazz's Gulps I can confirm that this is not set.)
The Swift bridging headers used to be included by a glob in a submodule Swift in the default modulemap template, which was generated by early betas of Xcode 6 on build, if no custom is set. The modulemap generated from CocoaPods doesn't contain such a definition as the modulemap in Xcode today, but injects a custom umbrella header path.
Meanwhile it seems like this bug was fixed in Xcode, but a new regression was introduced, which causes that a custom umbrella header can now be claimed as missing. Did anybody tried to workaround by manually #import-ing the umbrella header in the umbrella header itself, (which seems silly)?

@neonichu
Copy link
Member

neonichu commented May 4, 2015

This seems to me more a mix-up of the frameworks by Xcode when archiving. Note that e.g. the warning for the "Gulps" target complain about not having imported the umbrella headers for "-GulpsToday-" and "-Gulps WatchKit Extension-", indicating that it looks at frameworks intended for other targets.

@mrackwitz
Copy link
Member

@neonichu: Good point. The issue here is likely, that we scope using CONFIGURATION_BUILD_DIR, but this is not used for installing, but instead INSTALL_DIR is used and the frameworks in there are not scoped anymore, so that the umbrella headers, which are unique for each integrated pod target, are accumulated there and can cause warnings in that way. Until we can de-duplicate the targets, we'd need to scope them in INSTALL_PATH, too.

A possible workaround when using Xcode for archiving for now should be to either clean after archiving (& saving the build products) of a specific target or nuke derived data before archiving. This has to happen between archiving each target, separately. Archiving multiple targets at once in a single scheme could potentially also lead to this issue. When using xcodebuild from CLI, using the build action instead of install should not produce those errors.

@neonichu
Copy link
Member

neonichu commented May 4, 2015

It's not really feasible to archive extensions separately from the host app, I think, so we should think about scoping INSTALL_PATH for the time being.

@andreamazz
Copy link
Contributor

Yep, I can't build them separately, Xcode generates an incomplete .xcarchive

Normal archive (before switching to use_frameworks!)
screen shot 2015-05-04 at 12 02 50

Corrupted archive:
screen shot 2015-05-04 at 12 03 13

The archive is successful, but there's a lot missing.

@andreamazz
Copy link
Contributor

I removed the extensions' targets from the Podfile, removed the cocoapods integration from the extensions and integrated the common lib manually. The project now can be archived just fine.

@neonichu neonichu removed their assignment May 10, 2015
@claudiuvintila
Copy link

Hello,
I have the same problem. I get the Warning for all my 3 dependencies and the archiving fails. Here's my Podfiile:

source 'https://github.com/CocoaPods/Specs.git'

platform :osx, '10.10'
use_frameworks!
link_with ['Spot-em', 'Spot-emTests']

xcodeproj 'Spot-em'

pod 'sqlite3'
pod 'ZipArchive'
pod 'SwiftHTTP', '~> 0.9.4'

target 'Spot-em' do

end

target 'Spot-emTests' do

end

@ItsTipTop
Copy link

Same here.
It happens only when I'm archiving the app with extension. Before it's work fine. Now i can't archive my app: Xcode successfully archived my application, but the Archives Organizer does not list my archive.
Also i use !use_framework flag

Here my Podfile

source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'
inhibit_all_warnings!
use_frameworks!

def common_pods
    pod .....
end

target 'Target' do
    link_with 'TargetTests'
    common_pods
    pod ......
end

target 'TargetPostKit' do
    common_pods
end

target 'TargetShareExtension' do
    pod .......
end

post_install do |add_app_extension_macro|
    add_app_extension_macro.project.targets.each do |target|
        if target.name.include?("TargetPostKit")
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'AF_APP_EXTENSIONS=1']
            end
        end
        if target.name.include?("TargetShareExtension")
            target.build_configurations.each do |config|
                config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'AF_APP_EXTENSIONS=1']
                config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
            end
        end
    end
end

@ItsTipTop ItsTipTop mentioned this issue May 23, 2015
7 tasks
@Spacelapp
Copy link

+1 please fix this :D

@zipme
Copy link

zipme commented May 28, 2015

Ran into the same issue 😭looking for workaround to submit my app

@parkej60
Copy link

Having issues with this as well when trying to build an app with a WatchKit Extension. Using cocoa pods version 0.37.2.

I'm getting a bunch of Compiler warnings saying the Unblress Header for module... does not include header...-umbrella.h

This only happens when I attempt to archive the project. I have turned parallelize build off on all targets.

/Users/jamesonparker/Documents/iOS/Centare---EmployeeDirectory/EmployeeDirectory/Pods/<module-includes>:1:1: Umbrella header for module 'Alamofire' does not include header 'Pods-Directory WatchKit Extension-Alamofire-umbrella.h'

/Users/jamesonparker/Documents/iOS/Centare---EmployeeDirectory/EmployeeDirectory/Pods/<module-includes>:1:1: Umbrella header for module 'SwiftyJSON' does not include header 'Pods-Directory WatchKit Extension-SwiftyJSON-umbrella.h'

/Users/jamesonparker/Documents/iOS/Centare---EmployeeDirectory/EmployeeDirectory/<module-includes>:1:1: Umbrella header for module 'SwiftyJSON' does not include header 'Pods-Directory WatchKit Extension-SwiftyJSON-umbrella.h'

/Users/jamesonparker/Documents/iOS/Centare---EmployeeDirectory/EmployeeDirectory/<module-includes>:1:1: Umbrella header for module 'Alamofire' does not include header 'Pods-Directory WatchKit Extension-Alamofire-umbrella.h'
Pod file
platform :ios, '8.0'

use_frameworks!

link_with 'EmployeeDirectory','Directory WatchKit Extension'

def shared_pods
    pod 'SwiftyJSON', '~> 2.2'
    pod 'Alamofire', '~> 1.2.0'
end


target 'EmployeeDirectory' do
   shared_pods
   pod 'SVProgressHUD'
   pod 'HexColors', '~> 2.2'
end

target 'Directory WatchKit Extension' do
    shared_pods
end


post_install do |installer_representation|
    installer_representation.project.targets.each do |target|
        if target.to_s.include? 'Pods'
            target.build_configurations.each do |config|
                if !config.to_s.include? 'Debug'
                    config.build_settings['CODE_SIGN_IDENTITY[sdk=iphoneos*]'] = 'iPhone Distribution'
                end
            end
        end
    end
end

@parkej60
Copy link

Thought maybe this had something to do with using a bridging header to support objective-c libraries in my local project. Ripped that out and still the same issues.

@neonichu
Copy link
Member

Thanks for the detailed reports, the problem is well understood from our side. It is related to CP building individual frameworks for each target integration.

The changes in PR #3550 will eventually solve this, but it is not quite ready yet.

@neonichu
Copy link
Member

neonichu commented Jul 1, 2015

There's actually a beta release including the changes as well, which you can install using gem install cocoapods --pre

@sebromero
Copy link

Thank you @neonichu @basememara I tried that already, but it caused different issues. Particularly I have troubles with AWSiOSSDK and MagicalRecord. For the first one I had to enable "Include of non-modular header inside framework module" which is fine. But then I get the error message "Module 'MagicalRecord' not found" but only when building for an iOS device. It runs fine on iOS simulator. Also archiving still emits errors like "Umbrella header for module 'CocoaLumberjack' does not include header 'Pods-osceframeworkios-CocoaLumberjack-umbrella.h'". I spend almost a day trying to get that to work.
I probably may have to come up with an example project to make this reproducible for everyone.

@tanner0101
Copy link

I'm running into the same issue during archive (no issues during debug). Here's my Podfile:

platform :ios, '8.0'
use_frameworks!

target 'Decode' do
    pod 'DecodeKit', :path => '/Users/tanner/Blue Bite/decode/decode-kit/DecodeKit'
    pod 'BeckonKit'
end

target 'Nearby' do
    pod 'DecodeKit', :path => '/Users/tanner/Blue Bite/decode/decode-kit/DecodeKit'
end

The warnings:
screen shot 2015-07-16 at 11 34 18 am

And the product does not show up in the Organizer.

I tried to install the latest version of CocoaPods, but this is happening:

Gertrude:Decode tanner$ sudo gem install cocoapods --pre
Successfully installed cocoapods-0.38.0.beta.2
Parsing documentation for cocoapods-0.38.0.beta.2
Done installing documentation for cocoapods after 2 seconds
1 gem installed
Gertrude:Decode tanner$ pod --version
0.37.2

So I can't verify if the 0.38 beta fixes this issue.

@segiddins
Copy link
Member

pod _0.38.0.beta.2_ --version

@tanner0101
Copy link

Updated my project with pod _0.38.0.beta.2_ install and archive worked perfectly.

screen shot 2015-07-16 at 4 32 46 pm

Thank you, @segiddins !

@nmdias
Copy link

nmdias commented Jul 20, 2015

Updated to 0.38 :) Thank you so much!

screen shot 2015-07-20 at 17 22 49

@orta
Copy link
Member

orta commented Aug 6, 2015

Calling this fixed then 👍

@orta orta closed this as completed Aug 6, 2015
@chayelheinsen
Copy link

I'm on 0.38.2 and I'm still having this issue where I can't submit my app.
Here is my podfile.

source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
platform :ios, '8.0'

link_with 'Bubble', 'Bubble WatchKit Extension'

def shared_pods
    pod 'Parse'
end

target :Bubble do
    shared_pods
    pod 'ParseUI'
    pod 'ParseFacebookUtilsV4'
    pod 'AFNetworking', '~> 2.0'
    pod 'SlackTextViewController', '1.5'
    pod 'FBSDKCoreKit'
    pod 'FBSDKLoginKit'
    pod 'FBSDKShareKit'
    pod 'Mercury'
    pod 'JazzHands'
end

target :'Bubble WatchKit Extension' do
    shared_pods'
end

screen shot 2015-08-18 at 7 19 59 am

@neonichu
Copy link
Member

@chayelheinsen your problem is probably that you use both link_with and target blocks.

@chayelheinsen
Copy link

I also had the same problem without the link_with and just target blocks. Should I try I the other way around without target blocks?

Thank you.

@ale0xb
Copy link

ale0xb commented Sep 5, 2015

I'm also having the same issue as @chayelheinsen. Not using link_with, only target blocks.
I traced it back and I'm very positive it's caused by Bolts framework.

They recently split the project into two different Pod Specs, Bolts/Tasks and Bolts/AppLink

In @chayelheinsen's pod spec, he is including in his app extension:
Parse which depends on Bolts/Tasks ( >=1.2.1)

On the other hand, he's importing (taken from my own Podfile.lock)
- FBSDKCoreKit which depends on - Bolts (~> 1.1)

Ideally, Bolts framework should be built with the two subspecs Bolts/Tasks and Bolts/AppLink for the containing app and with Bolts/Tasks only for the extension.

However, this is not what is happening, as in the end the same framework file is being symlinked from the two targets:

screen shot 2015-09-05 at 14 58 13
screen shot 2015-09-05 at 14 57 57

-Notice the two targets reference Bolts.framework inside UninstalledProducts-
I think this may be the root of the problem. Unsure if it's an Xcode, Cocoapods or Bolts issue though, but Cocoapods 0.38.2 doesn't fix it.

If I remove all references to FBSDK* and ParseFacebookUtilsV4 it will produce a valid archive.

Any thoughts?

@neonichu
Copy link
Member

neonichu commented Sep 6, 2015

@ale0xb I think the issue might be that Xcode actually doesn't support two different versions of the same framework, so application extension and app itself need to use the same subspecs so that a valid archive can be produced.

@ale0xb
Copy link

ale0xb commented Sep 7, 2015

@neonichu You're totally right. I removed the use_frameworks! option and it compiles just fine. Goddammit Apple...

@dmathewwws
Copy link

@neonichu would love some clarification on this:

This is my podfile

use_frameworks!
platform :ios, '8.0'

target 'Annotate' do
pod 'Realm', :git => 'https://github.com/realm/realm-cocoa.git', :branch => 'swift-2.0'
pod 'RealmSwift', :git => 'https://github.com/realm/realm-cocoa.git', :branch => 'swift-2.0'
pod 'Parse'
end

target 'AnnotateShare' do
pod 'Realm', :git => 'https://github.com/realm/realm-cocoa.git', :branch => 'swift-2.0'
pod 'RealmSwift', :git => 'https://github.com/realm/realm-cocoa.git', :branch => 'swift-2.0'
end

if I try to remove use_frameworks! as @ale0xb suggested, i get the following error:
[!] Pods written in Swift can only be integrated as frameworks; this feature is still in beta. Add use_frameworks! to your Podfile or target to opt into using it. The Swift Pod being used is: RealmSwift

@r-shayestehpour
Copy link

I have xCode 7.1, this is my pod file:

target 'Trade' do
use_frameworks!
pod 'SwiftR'

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

pod 'Alamofire', '~> 3.0'

platform :ios, '8.0'

pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'

end

as @dmathewwws said, if I comment the use_frameworks! line I get [!] Pods written in Swift can only be integrated as frameworks; add use_frameworks! to your Podfile or target to opt into using it. The Swift Pods being used are: Alamofire, SwiftR, and SwiftyJSON and the warning won't go away.

@r-shayestehpour
Copy link

I added #import "Alamofire.h" to Pods/Alamofire/Supporting Files/Alamofire-umbrella.h. The warning is not nagging any more but I don't know if this was a good way...

@mrackwitz
Copy link
Member

@r-shayestehpour:

if I comment the use_frameworks! line I get [!] Pods written in Swift can only be integrated as frameworks; add use_frameworks! to your Podfile or target to opt into using it. The Swift Pods being used are: Alamofire, SwiftR, and SwiftyJSON

If you want to use Swift dependencies, you need to keep use_frameworks!.
@neonichu suggested initially to use frameworks only with the same subspecs across multiple targets, which is what this issue was initially about. That suggestion was adopted by abandoning frameworks completely. @dmathewwws followed with that, even though he already had Swift dependencies, so that this was not the right solution for neither him nor you.

I added #import "Alamofire.h" to Pods/Alamofire/Supporting Files/Alamofire-umbrella.h. The warning is not nagging any more but I don't know if this was a good way...

That's definitively not a good way. You will loose your changes on the next run of pod install.

I wonder that this problem re-appears for you. Which version of CocoaPods are you using?

@r-shayestehpour
Copy link

@mrackwitz I'm using version 0.39.0

@kulakoff83
Copy link

Hi
I have same issue when during archive
:1:1: Umbrella header for module 'DateTools' does not include header 'Pods-MyProject-DateTools-umbrella.h'
:1:1: Umbrella header for module 'Alamofire' does not include header 'Pods-MyProjectWidget-Alamofire-umbrella.h'
I'm using version 0.39.0
my pod file :

source 'https://github.com/CocoaPods/Specs.git'
inhibit_all_warnings!

def shared_pods
use_frameworks!
pod 'Alamofire', '~> 2.0’
pod 'DateTools'
end

target 'MyProject' do
platform :ios, '8.0'
use_frameworks!
shared_pods
pod 'FloatingActionSheetController', '~> 1.1'
end

target 'MyProjectWidget' do
use_frameworks!
shared_pods
end

target 'MyProjectWatch Extension' do
platform :watchos, '2.0'
use_frameworks!
shared_pods
end

@taylorleh
Copy link

So it seems that this issue is a bit old and still unresolved? I too have cocoapods 0.39 and am getting the same warnings like everyone else. Has anybody tried using the cocoapods 1.0.0.beta.4?

@clau3107
Copy link

clau3107 commented Mar 8, 2016

+1. CocoaPods 0.39 and use_frameworks!

@clau3107
Copy link

I'm also experiencing this problem with CocoaPods 0.39. Any clues?

@davidck
Copy link

davidck commented Apr 8, 2016

Experiencing this with 1.0.0.beta.6 when archiving.

@VenuKotha
Copy link

VenuKotha commented Dec 16, 2016

Hi,
I developed a private pod using objc and swift in mix and match approach. As per apple documentation i imported "XXXXX-Swift.h" in my objc file and build was success. When i use this pod as dependent to my main project pod install is success. I am getting "XXXXX-Swift.h" header not found at main project compilation time and showing error in objc file of my private pod. But private pod is successfully compiled. How can i resolve this?
i am using cocoapods version 1.0.0
Thank you for your help

@benasher44
Copy link
Member

Hi @VenuKotha! Thanks for letting us know! This issue has been closed for a long time, so we'd appreciate if you could open a new issue and fill out the issue template. If you could do that, we'd be happy to help. Thanks!

@VenuKotha
Copy link

Hi Ben,
Thank you for your reply.
Can you please share the link that has the above issue.

@benasher44
Copy link
Member

@VenuKotha sorry I'm not sure what you mean. I was asking if you could file a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t2:defect These are known bugs. The issue should also contain steps to reproduce. PRs welcome!
Projects
None yet
Development

No branches or pull requests